Exemplo n.º 1
0
 def _get_star(self):
     if self.callables:
         for key in self.callables:
             yield (key, self.callables[key])
     for key in dir(self.module):
         if key[0] != '_':
             callable_ = getattr(self.module, key)
             if compat.callable(callable_):
                 yield key, compat.partial(callable_, self.context)
Exemplo n.º 2
0
 def _get_star(self):
     if self.callables:
         for key in self.callables:
             yield (key, self.callables[key])
     for key in dir(self.module):
         if key[0] != '_':
             callable_ = getattr(self.module, key)
             if compat.callable(callable_):
                 yield key, compat.partial(callable_, self.context)
Exemplo n.º 3
0
 def __getattr__(self, key):
     if key in self.callables:
         val = self.callables[key]
     elif hasattr(self.module, key):
         callable_ = getattr(self.module, key)
         val = compat.partial(callable_, self.context)
     elif self.inherits:
         val = getattr(self.inherits, key)
     else:
         raise AttributeError("Namespace '%s' has no member '%s'" % (self.name, key))
     setattr(self, key, val)
     return val
Exemplo n.º 4
0
 def __getattr__(self, key):
     if key in self.callables:
         val = self.callables[key]
     elif hasattr(self.module, key):
         callable_ = getattr(self.module, key)
         val = compat.partial(callable_, self.context)
     elif self.inherits:
         val = getattr(self.inherits, key)
     else:
         raise AttributeError("Namespace '%s' has no member '%s'" % (self.name, key))
     setattr(self, key, val)
     return val
Exemplo n.º 5
0
Arquivo: runtime.py Projeto: 10sr/hue
    def __init__(self, buffer, **data):
        self._buffer_stack = [buffer]

        self._data = data

        self._kwargs = data.copy()
        self._with_template = None
        self._outputting_as_unicode = None
        self.namespaces = {}

        # "capture" function which proxies to the
        # generic "capture" function
        self._data['capture'] = compat.partial(capture, self)

        # "caller" stack used by def calls with content
        self.caller_stack = self._data['caller'] = CallerStack()
Exemplo n.º 6
0
    def __init__(self, buffer, data):
        self._buffer_stack = [buffer]

        self._data = data

        self._kwargs = data.copy()
        self._with_template = None
        self._outputting_as_unicode = None
        self.namespaces = {}

        # "capture" function which proxies to the
        # generic "capture" function
        self._data['capture'] = compat.partial(mako_runtime.capture, self)

        # "caller" stack used by def calls with content
        self.caller_stack = self._data['caller'] = mako_runtime.CallerStack()
Exemplo n.º 7
0
Arquivo: runtime.py Projeto: 10sr/hue
 def get(key):
     callable_ = getattr(self.module, key)
     return compat.partial(callable_, self.context)
Exemplo n.º 8
0
Arquivo: runtime.py Projeto: 10sr/hue
 def get(key):
     callable_ = self.template._get_def_callable(key)
     return compat.partial(callable_, self.context)
Exemplo n.º 9
0
 def get(key):
     callable_ = getattr(self.module, key)
     return compat.partial(callable_, self.context)
Exemplo n.º 10
0
 def get(key):
     callable_ = self.template._get_def_callable(key)
     return compat.partial(callable_, self.context)