scaffold the forwarding of requests to the backend
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Fri, 8 Mar 2013 14:54:03 +0000 (15:54 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Fri, 8 Mar 2013 14:54:03 +0000 (15:54 +0100)
engine/manifoldapi.py
engine/manifoldproxy.py
engine/manifoldquery.py
trash/dashboard.py

index b900855..21a9ec9 100644 (file)
@@ -28,3 +28,16 @@ class ManifoldAPI:
         if debug: print methodName, self.auth, self.url,'->',result
         return result
       return func
+
+  # 4amine : xxx
+  def send_manifold_query (self, manifold_query):
+    (action,method)= (raw_query.action,raw_query.method)
+    if action=='get':
+      return self.Get(method,
+                      # need to fill in the other args here
+                      )
+    # xxx...
+    elif action=='others':
+      return None
+
+    
index 52c747f..109f593 100644 (file)
@@ -9,6 +9,8 @@ import json
 #from django.core import serializers
 from django.http import HttpResponse, HttpResponseForbidden
 
+from engine.manifoldquery import ManifoldQuery
+
 # xxx should probably cater for
 # format_in : how is the query encoded in POST
 # format_out: how to serve the results
@@ -23,6 +25,13 @@ def api (request,format):
         return
 
     # xxx actually ask the backend here
+    # 4amine
+    # manifold_query = ManifoldQuery()
+    # manifold_query.fill_from_dict(request.POST)
+    # locate the api and/or the auth
+    # api=
+    # forward
+    # answer=api.send_manifold_query (manifold_query)
     hard_wired_answer = [ {'slice_hrn':'a.b.c'}, {'slice_hrn':'ple.inria.foo' } ]
     answer=hard_wired_answer
     return HttpResponse (json.dumps(answer), mimetype="application/json")
index 188a1d4..e48c94d 100644 (file)
@@ -46,3 +46,14 @@ class ManifoldQuery:
             sq="{%s}"%sq
         
         return """ new Query('%(a)s', '%(m)s', '%(t)s', %(f)s, %(p)s, %(c)s, %(unique)s, '%(uuid)s', %(aq)s, %(sq)s)"""%locals()
+    
+    # 4amine
+    # xxx
+    # this should build an object from a dict as received from javascript
+    # to see an example just look at the server's output
+    # incoming POST <QueryDict: {u'query[method]': [u'slice'], u'query[fields][]': [u'slice_hrn'], u'query[ts]': [u'latest'], u'query[action]': [u'get']}>
+    def fill_from_dict (self, d):
+        # mandatory...
+        self.action=d['action']
+        self.method=d['method']
+        # 
index e7ea899..0991ea5 100644 (file)
@@ -33,7 +33,7 @@ def dashboard_view (request):
 
     main_plugin = SimpleList ( # setting visible attributes first
         pluginset=pluginset,
-        title='SimpleList and dataTables',
+        title='Asynchroneous SimpleList',
         header='slices list', 
         with_datatables=True,
         toggled=False,
@@ -59,7 +59,7 @@ def dashboard_view (request):
 #    template_env [ 'content_related' ] = related_plugin.render (request)
 
     # more general variables expected in the template
-    template_env [ 'title' ] = 'SimpleList Test View'
+    template_env [ 'title' ] = 'Test view for a full request cycle'
     # the menu items on the top 
     template_env [ 'topmenu_items' ] = topmenu_items('dashboard', request) 
     # so we can sho who is logged