コード例 #1
0
ファイル: listing.py プロジェクト: aburan28/reddit
 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
コード例 #2
0
ファイル: listing.py プロジェクト: shuapeng/reddit
 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
コード例 #3
0
ファイル: listing.py プロジェクト: DFectuoso/culter
 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
コード例 #4
0
ファイル: jsontemplates.py プロジェクト: cmak/reddit
 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())))
コード例 #5
0
ファイル: listing.py プロジェクト: shuapeng/reddit
 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
コード例 #6
0
ファイル: listing.py プロジェクト: pra85/reddit
 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
コード例 #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())))
コード例 #8
0
ファイル: jsontemplates.py プロジェクト: cmak/reddit
    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
コード例 #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
コード例 #10
0
 def _thing(self, thing, action = None):
     d = replace_render(JsonListingStub(), thing)
     if action:
         d['action'] = action
     return d