@contextfunction
def account_notification_count(context):
 request = context['request']
 user = None
 if request.user.username:
  try:
   user = request.user.profile
  except Exception:
   pass
 notifications = 0
 account = None
 if user:
  modules = user.get_perspective().get_modules()
  account = modules.filter(name='treeio.account')
  if account:
   notifications = user.notification_set.count()
 response_format = 'html'
 if ('response_format' in context):
  response_format = context['response_format']
 return Markup(render_to_string('account/tags/notification_count', {'account': account, 'notifications': notifications}, response_format=response_format))

@ contextfunction def account_notification_count ( context ) : request = context [ 'request' ] user = None if request . user . username : try : user = request . user . profile except Exception : pass notifications = 0 account = None if user : modules = user . get_perspective ( ) . get_modules ( ) account = modules . filter ( name = 'treeio.account' ) if account : notifications = user . notification_set . count ( ) response_format = 'html' if ( 'response_format' in context ) : response_format = context [ 'response_format' ] return Markup ( render_to_string ( 'account/tags/notification_count' , { 'account' : account , 'notifications' : notifications } , response_format = response_format ) )
account notification count .