# HG changeset patch # User Sverre Rabbelier # Date 1233877432 0 # Node ID 38afecddfbed8fa5044bba95a91540c5d1b239f9 # Parent a671f0d63562fb6df26141e79cfebea3a0cc6af8 Make picker work generically Also removed some unused params from the JSON object. Deleted the now unused checkHasPickGetArgs method. Patch by: Sverre Rabbelier diff -r a671f0d63562 -r 38afecddfbed app/soc/views/helper/access.py --- a/app/soc/views/helper/access.py Thu Feb 05 23:41:02 2009 +0000 +++ b/app/soc/views/helper/access.py Thu Feb 05 23:43:52 2009 +0000 @@ -877,25 +877,6 @@ return - def checkHasPickGetArgs(self, django_args): - """Raises an alternate HTTP response if the request misses get args. - - Args: - django_args: a dictionary with django's arguments - - Raises: - AccessViolationResponse: - * if continue is not in request.GET - * if field is not in request.GET - """ - - get_args = django_args.get('GET', {}) - - if 'continue' in get_args and 'field' in get_args: - return - - raise out_of_band.Error(message_fmt=DEF_NEED_PICK_ARGS_MSG) - @denySidebar @allowDeveloper def checkIsDocumentReadable(self, django_args): diff -r a671f0d63562 -r 38afecddfbed app/soc/views/helper/params.py --- a/app/soc/views/helper/params.py Thu Feb 05 23:41:02 2009 +0000 +++ b/app/soc/views/helper/params.py Thu Feb 05 23:43:52 2009 +0000 @@ -78,7 +78,7 @@ rights['edit'] = ['checkIsDeveloper'] rights['delete'] = ['checkIsDeveloper'] rights['list'] = ['checkIsDeveloper'] - rights['pick'] = ['checkHasPickGetArgs'] + rights['pick'] = ['checkIsUser'] # TODO(SRabbelier): proper check new_params = {} new_params['scope_logic'] = logic.getScopeLogic() diff -r a671f0d63562 -r 38afecddfbed app/soc/views/models/base.py --- a/app/soc/views/models/base.py Thu Feb 05 23:41:02 2009 +0000 +++ b/app/soc/views/models/base.py Thu Feb 05 23:43:52 2009 +0000 @@ -564,24 +564,12 @@ get_dict = request.GET - # scope_path is not required - scope_path = get_dict.get('scope_path', None) - return_url = get_dict['continue'] - field = get_dict['field'] - - filter = {} - - if scope_path: - filter['scope_path'] = scope_path - - data = self._logic.getForFields(filter=filter, limit=1000) + data = self._logic.getForFields(filter=get_dict, limit=1000) data = [i.toDict() for i in data] to_json = { 'data': data, - 'return_url': return_url, - 'field': field, } json = simplejson.dumps(to_json)