#NEWLINE# def render( self , context ) : #NEWLINE# #INDENT# user = context [ 'user' ] #NEWLINE# if user . is_authenticated ( ) : #NEWLINE# #INDENT# cache_key = ( 'recommends:recommendations:%s:%s:%s' % ( settings . SITE_ID , user . id , self . limit ) ) #NEWLINE# suggestions = cache . get ( cache_key ) #NEWLINE# if ( suggestions is None ) : #NEWLINE# #INDENT# suggestions = set ( ) #NEWLINE# for provider in recommendation_registry . providers : #NEWLINE# #INDENT# suggestions . update ( provider . storage . get_recommendations_for_user ( user , int ( self . limit ) ) ) #NEWLINE# #UNINDENT# cache . set ( cache_key , suggestions , RECOMMENDS_CACHE_TEMPLATETAGS_TIMEOUT ) #NEWLINE# #UNINDENT# context [ self . varname ] = suggestions #NEWLINE# #UNINDENT# return ''