#NEWLINE# def rooms( request ) : #NEWLINE# #INDENT# 'Display the authenticated users rooms page or a list of the users rooms\n\n    Authentication is required.\n    ' #NEWLINE# if ( not request . session . get ( 'nickname' , None ) ) : #NEWLINE# #INDENT# return HttpResponseRedirect ( reverse ( 'login' ) ) #NEWLINE# #UNINDENT# f = friendfeed . FriendFeed ( request . session [ 'nickname' ] , request . session [ 'key' ] ) #NEWLINE# if ( 'list' in request . GET ) : #NEWLINE# #INDENT# data = f . fetch_user_profile ( request . session [ 'nickname' ] ) #NEWLINE# if ( not ( 'errorCode' in data ) ) : #NEWLINE# #INDENT# extra_context = { #NEWLINE# #INDENT# 'rooms' : data [ 'rooms' ] , #NEWLINE# #UNINDENT# } #NEWLINE# template = 'rooms_list.html' #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# start = max ( get_integer_argument ( request , 'start' , 0 ) , 0 ) #NEWLINE# num = get_integer_argument ( request , 'num' , NUM ) #NEWLINE# data = f . fetch_rooms_feed ( ** request_to_feed_args_dict ( request ) ) #NEWLINE# if ( not ( 'errorCode' in data ) ) : #NEWLINE# #INDENT# entries = [ entry for entry in data [ 'entries' ] if ( not entry [ 'hidden' ] ) ] #NEWLINE# hidden = [ entry for entry in data [ 'entries' ] if entry [ 'hidden' ] ] #NEWLINE# extra_context = { #NEWLINE# #INDENT# 'entries' : entries , #NEWLINE# 'hidden' : hidden , #NEWLINE# 'next' : ( start + num ) , #NEWLINE# #UNINDENT# } #NEWLINE# if ( start > 0 ) : #NEWLINE# #INDENT# extra_context [ 'has_previous' ] = True #NEWLINE# extra_context [ 'previous' ] = max ( ( start - num ) , 0 ) #NEWLINE# #UNINDENT# template = 'rooms.html' #NEWLINE# #UNINDENT# #UNINDENT# if ( 'errorCode' in data ) : #NEWLINE# #INDENT# return error ( request , data ) #NEWLINE# #UNINDENT# return render_to_response ( template , extra_context , context_instance = RequestContext ( request ) )