# HG changeset patch # User Lennard de Rijk # Date 1249955374 25200 # Node ID e8a98669ec8cdbca75cd54627b79630c0945352d # Parent e3e3be4bed01482be346db4cd433df16c11e80f0 _getResultsViewRecordFields does not need fields argument anymore. It now returns its own filter dictionary when called. Should be overwritten by subclasses who wish to use other filters. diff -r e3e3be4bed01 -r e8a98669ec8c app/soc/views/models/survey.py --- a/app/soc/views/models/survey.py Mon Aug 10 18:03:55 2009 -0700 +++ b/app/soc/views/models/survey.py Mon Aug 10 18:49:34 2009 -0700 @@ -708,15 +708,8 @@ except: pass - # only show records for the retrieved survey - fields = {'survey': entity} - - if not allowed_to_read: - # this user is not allowed to view all the Records so only show their own - fields['user'] = user_entity - - # call the hook for adjusting the SurveyRecord filter - fields = self._getResultsViewRecordFields(fields, entity, allowed_to_read) + # get the filter for the SurveyRecords + fields = self._getResultsViewRecordFields(entity, allowed_to_read) list_params = params.copy() list_params['logic'] = record_logic @@ -734,17 +727,24 @@ return self._list(request, list_params, contents, page_name, context) - def _getResultsViewRecordFields(self, fields, survey, allowed_to_read): - """Hook for adjusting the Results View filter for SurveyRecords. + def _getResultsViewRecordFields(self, survey, allowed_to_read): + """Retrieves the Results View filter for SurveyRecords. Args: - fields: filter dictionary to adjust survey: Survey instance for which the Records need to be shown allowed_to_read: specifies if the current User has read access Returns: Returns the dictionary containing the fields to filter on """ + + # only show records for the retrieved survey + fields = {'survey': survey} + + if not allowed_to_read: + # this user is not allowed to view all the Records so only show their own + fields['user'] = user_logic.getForCurrentAccount() + return fields @decorators.merge_params