Exemple #1
0
    def save(self):
        try:
            data=self.form.validate(self.request)
        except formish.FormError:
            return False

        user=currentUser(self.request)
        customer=Customer(account=user, **data)
        meta.Session.add(customer)
        return True
Exemple #2
0
    def save(self):
        try:
            data = self.form.validate(self.request)
        except formish.FormError:
            return False

        user = currentUser(self.request)
        customer = Customer(account=user, **data)
        meta.Session.add(customer)
        return True
Exemple #3
0
def Overview(request):
    user=currentUser(request)
    session=meta.Session()
    customers=session.query(Customer.id, Customer.title, Customer.invoice_code)\
            .filter(Customer.account==user)\
            .order_by(Customer.title)
    customers=[dict(id=row.id,
                    title=row.title,
                    invoice_code=row.invoice_code,
                    url=route_url("customer_view", request, id=row.id))
               for row in customers]
    return render("customer_overview.pt", request,
            section="customers",
            customers=customers)
Exemple #4
0
def Overview(request):
    user = currentUser(request)
    session = meta.Session()

    invoices = (
        session.query(Invoice)
        .select_from(orm.join(Invoice, Customer))
        .filter(Customer.account == user)
        .order_by(Invoice.sent.desc())
        .options(orm.joinedload(Invoice.entries))
    )

    summary = summaryInvoices(invoices)

    return render("invoice_overview.pt", request, section="invoices", **summary)
Exemple #5
0
def checkCSRF(request):
    """Check if the request has a valid CSRF token."""
    from checking.authentication import currentUser

    user = currentUser(request)
    if user is None:
        return True

    token = request.POST.getall("csrf_token")
    if [user.secret]==token:
        return True

    log.warning("Invalid CSRF token from account %s (id=%d): %r",
                user.login, user.id, token)
    return False
Exemple #6
0
def checkCSRF(request):
    """Check if the request has a valid CSRF token."""
    from checking.authentication import currentUser

    user = currentUser(request)
    if user is None:
        return True

    token = request.POST.getall("csrf_token")
    if [user.secret] == token:
        return True

    log.warning("Invalid CSRF token from account %s (id=%d): %r", user.login,
                user.id, token)
    return False
Exemple #7
0
def Overview(request):
    user = currentUser(request)
    session = meta.Session()

    invoices=session.query(Invoice)\
            .select_from(orm.join(Invoice, Customer))\
            .filter(Customer.account==user)\
            .order_by(Invoice.sent.desc())\
            .options(orm.joinedload(Invoice.entries))

    summary = summaryInvoices(invoices)

    return render("invoice_overview.pt",
                  request,
                  section="invoices",
                  **summary)
Exemple #8
0
def Overview(request):
    user = currentUser(request)
    session = meta.Session()
    customers=session.query(Customer.id, Customer.title, Customer.invoice_code)\
            .filter(Customer.account==user)\
            .order_by(Customer.title)
    customers = [
        dict(id=row.id,
             title=row.title,
             invoice_code=row.invoice_code,
             url=route_url("customer_view", request, id=row.id))
        for row in customers
    ]
    return render("customer_overview.pt",
                  request,
                  section="customers",
                  customers=customers)
Exemple #9
0
def Factory(request):
    return currentUser(request)
Exemple #10
0
def View(request):
    return render("dashboard.pt", request,
            context=currentUser(request))
Exemple #11
0
 def __init__(self, request):
     from checking.authentication import currentUser
     self.request=request
     self.user=currentUser(request)
Exemple #12
0
 def __init__(self, request):
     from checking.authentication import currentUser
     self.request = request
     self.user = currentUser(request)
Exemple #13
0
def View(request):
    return render("dashboard.pt", request, context=currentUser(request))
Exemple #14
0
def Factory(request):
    return currentUser(request)