Skip to content

Commit

Permalink
Streaming reg_reports page to client
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbyt3r committed Oct 17, 2024
1 parent 3138004 commit bc27217
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions uber/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,9 +579,14 @@ 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):
print(f"Rendering chunk {idx}")
import time
time.sleep(0.01)
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

0 comments on commit bc27217

Please sign in to comment.