Make picker work generically
authorSverre Rabbelier <srabbelier@gmail.com>
Thu, 05 Feb 2009 23:43:52 +0000
changeset 1227 38afecddfbed
parent 1226 a671f0d63562
child 1228 b24796279fb9
Make picker work generically Also removed some unused params from the JSON object. Deleted the now unused checkHasPickGetArgs method. Patch by: Sverre Rabbelier
app/soc/views/helper/access.py
app/soc/views/helper/params.py
app/soc/views/models/base.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):
--- 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()
--- 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)