예제 #1
0
 async def datahandle(self, request):
     path = self.resource.extract_path(request)
     g = ServerEnv()
     ns = DictObject()
     ns.update(g)
     ns.update(self.resource.env)
     ns.request = request
     ns.ref_real_path = self.path
     te = g.tmpl_engine
     self.content = te.render(path, **ns)
예제 #2
0
 async def datahandle(self, request):
     dict_data = {}
     config = getConfig()
     with codecs.open(self.path, 'r', config.website.coding) as f:
         b = f.read()
         dict_data = json.loads(b)
     ns = DictObject()
     g = ServerEnv()
     ns.update(g)
     ns.update(self.resource.env)
     ns.update(self.resource.getGetArgs(request))
     act = ns.get('action', 'getdata')
     action = self.actions.get(act)
     self.content = action(dict_data, ns, request)