Ejemplo n.º 1
0
 def get(self):
     self.object = {
         'path': self.request.path,
         'headers': dict([(k, unicode(v)) for k, v in self.request.headers.items()]),
     }
     self.template = 'urquell/templates/function.html'
     self.context = {}
     self.status = 200
     try:
         path = [resolve_part(str(i))[1] for i in self.request.path[1:].split('/')]
         kwargs = dict([(str(resolve_part(k)[1]), resolve_part(v)[1]) for k, v in self.request.GET.items()])
         root.get(self, *path, **kwargs)
     except ErrorTrace, e:
         self.status = 500
         self.object['error'] = {
             'message': e.message,
             'trace': e.trace
         }
Ejemplo n.º 2
0
def invoke(responder, module, fn, *path, **kwargs):
    from urquell.value import resolve_part
    ihash = store_invocation(responder.request.url)
    responder.object['hash'] = u'*%s' % unicode(ihash)
    responder.object['name'] = '%s/%s' % (module.path(), fn.func_name)
    call_trace = [resolve_part(str(i)) for i in path]
    args = [x for u, x in call_trace]
    responder.object['args'] = [u for u, x in call_trace]
    responder.object['value'] = fn(*args, **kwargs)
    json = dumps(responder.object)
    if responder.object.has_key('value'):
        memcache.add(ihash, json, 300)
    return json, responder.object