#NEWLINE# def view_submission_list( request , username ) : #NEWLINE# #INDENT# form_user = get_object_or_404 ( User , username__iexact = username ) #NEWLINE# ( profile , created ) = UserProfile . objects . get_or_create ( user = form_user ) #NEWLINE# authenticator = HttpDigestAuthenticator ( ) #NEWLINE# if ( not authenticator . authenticate ( request ) ) : #NEWLINE# #INDENT# return authenticator . build_challenge_response ( ) #NEWLINE# #UNINDENT# id_string = request . GET . get ( 'formId' , None ) #NEWLINE# xform = get_object_or_404 ( XForm , id_string__exact = request , user__username__iexact = username ) #NEWLINE# if ( not has_permission ( xform , form_user , request , xform . shared_data ) ) : #NEWLINE# #INDENT# return HttpResponseForbidden ( 'Not shared.' ) #NEWLINE# #UNINDENT# num_entries = request . GET . get ( 'numEntries' , None ) #NEWLINE# cursor = request . GET . get ( 'cursor' , None ) #NEWLINE# instances = xform . instances . filter ( deleted_at = None ) . order_by ( 'pk' ) #NEWLINE# cursor = _parse_int ( cursor ) #NEWLINE# if cursor : #NEWLINE# #INDENT# instances = instances . filter ( pk__gt = cursor ) #NEWLINE# #UNINDENT# num_entries = _parse_int ( num_entries ) #NEWLINE# if num_entries : #NEWLINE# #INDENT# instances = instances [ : num_entries ] #NEWLINE# #UNINDENT# data = { #NEWLINE# #INDENT# 'instances' : instances , #NEWLINE# #UNINDENT# } #NEWLINE# resumptionCursor = 0 #NEWLINE# if instances . count ( ) : #NEWLINE# #INDENT# last_instance = instances [ ( instances . count ( ) - 1 ) ] #NEWLINE# resumptionCursor = last_instance . pk #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( instances . count ( ) == 0 ) and cursor ) : #NEWLINE# #INDENT# resumptionCursor = cursor #NEWLINE# #UNINDENT# #UNINDENT# data [ 'resumptionCursor' ] = resumptionCursor #NEWLINE# return render ( request , 'submissionList.xml' , data , content_type = 'text/xml; charset=utf-8' )