Ejemplo n.º 1
0
 def simple_build(self,ar,elem,tpl,target):
     #~ from lino.models import get_site_config
     #~ from appy.pod.renderer import Renderer
     #~ renderer = None
     """
     When the source string contains non-ascii characters, then 
     we must convert it to a unicode string.
     """
     lang = str(elem.get_print_language())
     logger.info(u"appy.pod render %s -> %s (language=%r,params=%s",
         tpl,target,lang,settings.SITE.appy_params)
     def f():
         context = elem.get_printable_context(ar)
         context.update(self=elem)
         Renderer(ar,tpl, context, target,**settings.SITE.appy_params).run()
     dbutils.run_with_language(lang,f)
     return os.path.getmtime(target)
Ejemplo n.º 2
0
    def simple_build(self, ar, elem, tpl, target):
        # ~ from lino.models import get_site_config
        # ~ from appy.pod.renderer import Renderer
        # ~ renderer = None
        """
        When the source string contains non-ascii characters, then
        we must convert it to a unicode string.
        """
        lang = str(elem.get_print_language())
        logger.info("appy.pod render %s -> %s (language=%r,params=%s", tpl, target, lang, settings.SITE.appy_params)

        def f():
            context = elem.get_printable_context(ar)

            # backwards compat for existing .odt templates.  Cannot
            # set this earlier because that would cause "render() got
            # multiple values for keyword argument 'self'" exception
            context.update(self=context["this"])

            Renderer(ar, tpl, context, target, **settings.SITE.appy_params).run()

        dbutils.run_with_language(lang, f)
        return os.path.getmtime(target)