Skip to content

Instantly share code, notes, and snippets.

@1xch
Created April 9, 2013 02:55
Show Gist options
  • Save 1xch/5342561 to your computer and use it in GitHub Desktop.
Save 1xch/5342561 to your computer and use it in GitHub Desktop.
A simple header w/context processor
def topbar_pack(current_user):
if current_user.get_id():
nav_pack = nav_in_pack()
user_pack = user_in_pack()
else:
nav_pack = nav_out_pack()
user_pack = user_out_pack()
tp = get_template_attribute('macros/topbar.html', 'topbar')
return tp(nav_pack, user_pack, current_user)
def _topbar_pack():
return dict(topbar_pack = topbar_pack(current_user))
BLUEPRINT.app_context_processor(_topbar_pack)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment