Ejemplo n.º 1
0
    def __call__(self, value, system):
        # the API view should return a Bundle
        bundle = value

        # if bundle.obj=None we use the list view, otherwise detail view
        if bundle.obj:
            self.info.name = 'api/obj_detail.jinja2'
        else:
            self.info.name = 'api/obj_list.jinja2'

        # format JSON nicely for display
        data = bundle.__json__(system.get('request'))
        bundle.json = json.dumps(data, indent=4, sort_keys=True)

        renderer = renderer_factory(self.info)
        return renderer({'bundle': bundle}, system)
Ejemplo n.º 2
0
 def _callFUT(self, info):
     from pyramid_jinja2 import renderer_factory
     return renderer_factory(info)
Ejemplo n.º 3
0
 def _callFUT(self, info):
     from pyramid_jinja2 import renderer_factory
     return renderer_factory(info)
Ejemplo n.º 4
0
 def _callFUT(self, info):
     # initialize renderer with dummy info containing our configs
     from pyramid_jinja2 import renderer_factory
     return renderer_factory(info)
Ejemplo n.º 5
0
 def _callFUT(self, info):
     # initialize renderer with dummy info containing our configs
     from pyramid_jinja2 import renderer_factory
     return renderer_factory(info)