From c03a291ccf5c59227b59526179870dd37cd14188 Mon Sep 17 00:00:00 2001 From: bsimpson63 Date: Thu, 18 Oct 2012 10:58:23 -0400 Subject: [PATCH] Delete temporary rendering attributes from the user. Using safe_set_attr makes the Account not dirty, but it sets the attributes directly on the object rather than in the _t dict. If the account was later _commit()'ed it would get stuck with these extra attributes. --- r2/r2/lib/cssfilter.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/r2/r2/lib/cssfilter.py b/r2/r2/lib/cssfilter.py index ff311dc05..08d3d3a11 100644 --- a/r2/r2/lib/cssfilter.py +++ b/r2/r2/lib/cssfilter.py @@ -405,8 +405,10 @@ def rendered_link(links, media, compress): with c.user.safe_set_attr: c.user.pref_compress = compress c.user.pref_media = media - links = wrap_links(links, show_nums = True, num = 1) - return links.render(style = "html") + links = wrap_links(links, show_nums = True, num = 1) + delattr(c.user, 'pref_compress') + delattr(c.user, 'pref_media') + return links.render(style = "html") def rendered_comment(comments): return wrap_links(comments, num = 1).render(style = "html")