Beispiel #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
Beispiel #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
Beispiel #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)
Beispiel #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)
Beispiel #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
Beispiel #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
Beispiel #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)
Beispiel #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)
Beispiel #9
0
def Factory(request):
    return currentUser(request)
Beispiel #10
0
def View(request):
    return render("dashboard.pt", request,
            context=currentUser(request))
Beispiel #11
0
 def __init__(self, request):
     from checking.authentication import currentUser
     self.request=request
     self.user=currentUser(request)
Beispiel #12
0
 def __init__(self, request):
     from checking.authentication import currentUser
     self.request = request
     self.user = currentUser(request)
Beispiel #13
0
def View(request):
    return render("dashboard.pt", request, context=currentUser(request))
Beispiel #14
0
def Factory(request):
    return currentUser(request)