Example #1
0
 def get_items(self):
     from r2.lib.template_helpers import replace_render
     things = self.things
     for t in things:
         if not hasattr(t, "render_replaced"):
             t.render = replace_render(self, t, t.render)
             t.render_replaced = True
     return things, None, None, 0, 0
Example #2
0
 def get_items(self):
     from r2.lib.template_helpers import replace_render
     things = self.things
     for t in things:
         if not hasattr(t, "render_replaced"):
             t.render = replace_render(self, t, t.render)
             t.render_replaced = True
     return things, None, None, 0, 0
Example #3
0
 def get_items(self, *a, **kw):
     """Wrapper around builder's get_items that caches the rendering."""
     from r2.lib.template_helpers import replace_render
     builder_items = self.builder.get_items(*a, **kw)
     for item in self.builder.item_iter(builder_items):
         # rewrite the render method 
         item.render = replace_render(self, item, item.render)
     return builder_items
Example #4
0
 def rendered_data(self, thing):
     from r2.lib.filters import spaceCompress
     from r2.lib.template_helpers import replace_render
     from pylons import c
     listing = thing.listing if hasattr(thing, "listing") else None
     return dict(id = thing._fullname,
                 vl = self.points(thing),
                 content = spaceCompress(replace_render(listing, thing,
                                                        style=get_api_subtype())))
Example #5
0
 def get_items(self, *a, **kw):
     """Wrapper around builder's get_items that caches the rendering."""
     from r2.lib.template_helpers import replace_render
     builder_items = self.builder.get_items(*a, **kw)
     for item in self.builder.item_iter(builder_items):
         # rewrite the render method
         if not hasattr(item, "render_replaced"):
             item.render = replace_render(self, item, item.render)
             item.render_replaced = True
     return builder_items
Example #6
0
 def get_items(self, *a, **kw):
     """Wrapper around builder's get_items that caches the rendering."""
     from r2.lib.template_helpers import replace_render
     builder_items = self.builder.get_items(*a, **kw)
     for item in self.builder.item_iter(builder_items):
         # rewrite the render method
         if c.render_style != "api" and not hasattr(item, "render_replaced"):
             item.render = replace_render(self, item, item.render)
             item.render_replaced = True
     return builder_items
Example #7
0
 def rendered_data(self, thing):
     from r2.lib.filters import spaceCompress
     from r2.lib.template_helpers import replace_render
     from pylons import c
     listing = thing.listing if hasattr(thing, "listing") else None
     return dict(id=thing._fullname,
                 vl=self.points(thing),
                 content=spaceCompress(
                     replace_render(listing, thing,
                                    style=get_api_subtype())))
Example #8
0
    def rendered_data(self, thing):
        from r2.lib.filters import spaceCompress
        from r2.lib.template_helpers import replace_render

        res = []
        for a in thing.things:
            a.listing = thing
            r = replace_render(thing, a, style = 'api')
            if isinstance(r, str):
                r = spaceCompress(r)
            res.append(r)
        return res
Example #9
0
    def rendered_data(self, thing):
        from r2.lib.filters import spaceCompress
        from r2.lib.template_helpers import replace_render

        res = []
        for a in thing.things:
            a.listing = thing
            r = replace_render(thing, a, style='api')
            if isinstance(r, str):
                r = spaceCompress(r)
            res.append(r)
        return res
Example #10
0
 def _thing(self, thing, action = None):
     d = replace_render(JsonListingStub(), thing)
     if action:
         d['action'] = action
     return d