Пример #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)
Пример #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)
Пример #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
Пример #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
Пример #5
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(capture, self)

        # "caller" stack used by def calls with content
        self.caller_stack = self._data["caller"] = CallerStack()
Пример #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(capture, self)

        # "caller" stack used by def calls with content
        self.caller_stack = self._data['caller'] = CallerStack()
Пример #7
0
 def get(key):
     callable_ = self.template._get_def_callable(key)
     return compat.partial(callable_, self.context)
Пример #8
0
 def get(key):
     callable_ = self.template._get_def_callable(key)
     return compat.partial(callable_, self.context)