def __call__(self):
     """ Return a JSON response
     """
     request = self.request
     response = ''
     plugin = self.plugin
     entity = self.entity
     if plugin:
         if entity:
             subpath = self._subpath()
             data = entity(request, subpath=subpath)
             response = plugin.json(data) if data else '{}'
         else:
             response = plugin.json(plugin.entities())
     else:
         data = []
         plugins = utils.plugins()
         for plugin in plugins:
             tmp = {
                 'name': plugin.name,
                 'title': plugin.title,
                 'uri': plugin.uri
             }
             data.append(plugin.json(tmp))
         response = '[{0}]'.format(', '.join(data))
     request.response.setHeader('Content-Type',
                                'application/json;charset=utf-8')
     return response
Exemple #2
0
 def __call__(self):
     """ Return a JSON response
     """
     request = self.request
     response = ''
     plugin = self.plugin
     entity = self.entity
     if plugin:
         if entity:
             subpath = self._subpath()
             data = entity(request, subpath=subpath)
             response = plugin.json(data) if data else '{}'
         else:
             response = plugin.json(plugin.entities())
     else:
         data = []
         plugins = utils.plugins()
         for plugin in plugins:
             tmp = {
                 'name': plugin.name,
                 'title': plugin.title,
                 'uri': plugin.uri
             }
             data.append(plugin.json(tmp))
         response = '[{0}]'.format(', '.join(data))
     request.response.setHeader('Content-Type',
                                'application/json;charset=utf-8')
     return response
Exemple #3
0
 def plugins(self):
     """ Open Data Plugins"""
     registered = utils.plugins()
     plugins = [self._p(p) for p in registered]
     return plugins
 def plugins(self):
     """ Open Data Plugins"""
     registered = utils.plugins()
     plugins = [self._p(p) for p in registered]
     return plugins