#NEWLINE# def recent_products( request ) : #NEWLINE# #INDENT# 'Puts the recently-viewed products in the page variables' #NEWLINE# recent = request . session . get ( 'RECENTLIST' , [ ] ) #NEWLINE# maxrecent = config_value ( 'PRODUCT' , 'RECENT_MAX' ) #NEWLINE# products = [ ] #NEWLINE# for slug in recent : #NEWLINE# #INDENT# if ( len ( products ) > maxrecent ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# p = Product . objects . get_by_site ( slug__exact = slug ) #NEWLINE# products . append ( p ) #NEWLINE# #UNINDENT# except Product . DoesNotExist : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# return { #NEWLINE# #INDENT# 'recent_products' : products , #NEWLINE# #UNINDENT# }