From 7060c1d41763c367c2108b5a71ca0af72654c1c4 Mon Sep 17 00:00:00 2001 From: Mark Murnane Date: Thu, 17 Oct 2024 17:28:51 -0400 Subject: [PATCH 1/2] Reverting admin retrieval --- uber/decorators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uber/decorators.py b/uber/decorators.py index 32872518a..feac6e933 100644 --- a/uber/decorators.py +++ b/uber/decorators.py @@ -53,7 +53,7 @@ def log_pageview(func): def with_check(*args, **kwargs): with uber.models.Session() as session: try: - session.current_admin_account() + session.admin_account(cherrypy.session.get('account_id')) except Exception: pass # no tracking for non-admins yet else: From d41eb2e7b00a0856ab96b7a2baed8f4b132eee2a Mon Sep 17 00:00:00 2001 From: Mark Murnane Date: Thu, 17 Oct 2024 17:57:18 -0400 Subject: [PATCH 2/2] Removing expunge_all --- uber/decorators.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/uber/decorators.py b/uber/decorators.py index feac6e933..039abd5c7 100644 --- a/uber/decorators.py +++ b/uber/decorators.py @@ -559,7 +559,6 @@ def with_session(*args, **kwargs): with uber.models.Session() as session: try: retval = func(*args, session=session, **kwargs) - session.expunge_all() return retval except HTTPRedirect: session.commit() @@ -579,10 +578,9 @@ 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) - cherrypy.response.stream = True rendered = template.generate(data) if encoding: - for idx, chunk in enumerate(rendered): + for chunk in rendered: yield chunk.encode(encoding) return rendered