Skip to content

Commit

Permalink
LoID fixup: only create new on non-static render types
Browse files Browse the repository at this point in the history
  • Loading branch information
KeyserSosa committed Feb 26, 2016
1 parent ea17655 commit 5dabab7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion r2/r2/controllers/reddit_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,6 @@ def set_content_type():
e = request.environ
c.render_style = e['render_style']
response.content_type = e['content_type']
c.loid = LoId.load(request)

if e.has_key('extension'):
c.extension = ext = e['extension']
Expand Down Expand Up @@ -510,6 +509,11 @@ def to_js(content):
if ext in ("mobile", "m", "compact"):
if request.GET.get("keep_extension"):
c.cookies['reddit_mobility'] = Cookie(ext, expires=NEVER)

# allow content and api calls to set an loid
if is_api() or c.render_style in ("html", "mobile", "compact"):
c.loid = LoId.load(request)

# allow JSONP requests to generate callbacks, but do not allow
# the user to be logged in for these
callback = request.GET.get("jsonp")
Expand Down

0 comments on commit 5dabab7

Please sign in to comment.