Skip to content

Commit

Permalink
Merge pull request #4418 from magfest/reverting_admin
Browse files Browse the repository at this point in the history
Fixing detached db objects
  • Loading branch information
kitsuta authored Oct 17, 2024
2 parents 87bde96 + d41eb2e commit e61ed62
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 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.current_admin_account()
session.admin_account(cherrypy.session.get('account_id'))
except Exception:
pass # no tracking for non-admins yet
else:
Expand Down Expand Up @@ -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()
Expand All @@ -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

Expand Down

0 comments on commit e61ed62

Please sign in to comment.