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
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
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())))
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
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
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())))
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
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
def _thing(self, thing, action = None): d = replace_render(JsonListingStub(), thing) if action: d['action'] = action return d