Exemplo n.º 1
0
 def template(self, style = 'html'):
     from r2.config.templates import tpm
     from pylons import g
     debug = g.template_debug
     template = None
     if self.__class__ == Wrapped:
         for lookup in chain(self.lookups, (self.render_class,)):
             try:
                 template = tpm.get(lookup, style, cache = not debug)
             except AttributeError:
                 continue
     else:
         try:
             template = tpm.get(self, style, cache = not debug)
         except AttributeError:
             raise NoTemplateFound, (repr(self), style)
             
     return template
Exemplo n.º 2
0
 def template(self, style = 'html'):
     from r2.config.templates import tpm
     from pylons import g
     debug = g.template_debug
     template = None
     if self.__class__ == Wrapped:
         for lookup in self.lookups:
             try:
                 template = tpm.get(lookup, style, cache = not debug)
             except KeyError:
                 continue
     else:
         try:
             template = tpm.get(self, style, cache = not debug)
         except KeyError:
             raise NoTemplateFound, repr(self)
             
     return template
Exemplo n.º 3
0
    def template(self, style='html'):
        from r2.config.templates import tpm
        from pylons import g
        debug = g.template_debug
        template = None
        if self.__class__ == Wrapped:
            for lookup in chain(self.lookups, (self.render_class, )):
                try:
                    template = tpm.get(lookup, style, cache=not debug)
                except AttributeError:
                    continue
        else:
            try:
                template = tpm.get(self, style, cache=not debug)
            except AttributeError:
                raise NoTemplateFound, (repr(self), style)

        return template
Exemplo n.º 4
0
    def template(self, style = 'html'):
        """
        Fetches template from the template manager
        """
        from r2.config.templates import tpm
        from pylons import g

        debug = g.template_debug
        template = None
        try:
            template = tpm.get(self.render_class,
                               style, cache = not debug)
        except AttributeError:
            self._notfound(style)
        return template