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
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
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)
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)
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
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
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)
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)
def Factory(request): return currentUser(request)
def View(request): return render("dashboard.pt", request, context=currentUser(request))
def __init__(self, request): from checking.authentication import currentUser self.request=request self.user=currentUser(request)
def __init__(self, request): from checking.authentication import currentUser self.request = request self.user = currentUser(request)