示例#1
0
    def _getExpressionContext(self, extra={}, tal=False):
        """
        Returns the context for rendering TALES or TAL. If the tal argument
        is true, a dictionary of variables is returned. Otherwise, an
        an expression context object is returned.
        """

        context_vars = {
            'context': self.context,
            'request': self.request,
            'today': datetime.date.today(),
            'date': getDate,
            'timedelta': getTimeDelta,
            'unique_list': unique_list,
        }

        context_vars.update(extra)

        for plugin in self.plugins:
            plugin.processExpressionContext(context_vars)

        if tal:
            return context_vars
        return getEngine().getContext(context_vars)
    def _getExpressionContext(self, extra={}, tal=False):
        """
        Returns the context for rendering TALES or TAL. If the tal argument
        is true, a dictionary of variables is returned. Otherwise, an
        an expression context object is returned.
        """

        context_vars = {
            'context': self.context,
            'request': self.request,
            'today': datetime.date.today(),
            'date': getDate,
            'timedelta': getTimeDelta,
            'unique_list': unique_list,
        }

        context_vars.update(extra)

        for plugin in self.plugins:
            plugin.processExpressionContext(context_vars)

        if tal:
            return context_vars
        return getEngine().getContext(context_vars)
 def __init__(self, text):
     self.text = text
     if text.strip():
         self._v_compiled = getEngine().compile(text)
 def __init__(self, text):
     self.text = text
     if text.strip():
         self._v_compiled = getEngine().compile(text)