Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Streaming Responses #4416

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions uber/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def log_pageview(func):
def with_check(*args, **kwargs):
with uber.models.Session() as session:
try:
session.admin_account(cherrypy.session.get('account_id'))
session.current_admin_account()
except Exception:
pass # no tracking for non-admins yet
else:
Expand Down Expand Up @@ -579,9 +579,11 @@ def render(template_name_list, data=None, encoding='utf-8'):
data = renderable_data(data)
env = JinjaEnv.env()
template = env.get_or_select_template(template_name_list)
rendered = template.render(data)
cherrypy.response.stream = True
rendered = template.generate(data)
if encoding:
return rendered.encode(encoding)
for idx, chunk in enumerate(rendered):
yield chunk.encode(encoding)
return rendered


Expand Down
1 change: 1 addition & 0 deletions uber/site_sections/reg_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def attendee_receipt_discrepancies(self, session, include_pending=False, page=1)
'attendees': receipt_query.limit(50).offset(offset),
'include_pending': include_pending,
}
attendee_receipt_discrepancies._cp_config = {'response.stream': True}

@log_pageview
def attendees_nonzero_balance(self, session, include_no_receipts=False):
Expand Down
Loading