コード例 #1
0
ファイル: runtime.py プロジェクト: dejans11/my-gfeed
    def __getattr__(self, key):
        if self.callables and key in self.callables:
            return self.callables[key]

        if self.template and self.template.has_def(key):
            callable_ = self.template._get_def_callable(key)
            return util.partial(callable_, self.context)

        if self._module and hasattr(self._module, key):
            callable_ = getattr(self._module, key)
            return util.partial(callable_, self.context)

        if self.inherits is not None:
            return getattr(self.inherits, key)
        raise AttributeError(
                    "Namespace '%s' has no member '%s'" % 
                    (self.name, key))
コード例 #2
0
ファイル: runtime.py プロジェクト: bennihepp/sandbox
 def __getattr__(self, key):
     if key in self.callables:
         val = self.callables[key]
     elif hasattr(self.module, key):
         callable_ = getattr(self.module, key)
         val = util.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
コード例 #3
0
ファイル: runtime.py プロジェクト: AgentJay/webapp-improved
 def __getattr__(self, key):
     if key in self.callables:
         val = self.callables[key]
     elif hasattr(self.module, key):
         callable_ = getattr(self.module, key)
         val = util.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
ファイル: runtime.py プロジェクト: AgentJay/webapp-improved
    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'] = util.partial(capture, self)
 
        # "caller" stack used by def calls with content
        self.caller_stack = self._data['caller'] = CallerStack()
コード例 #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'] = util.partial(capture, self)
 
        # "caller" stack used by def calls with content
        self.caller_stack = self._data['caller'] = CallerStack()
コード例 #6
0
ファイル: runtime.py プロジェクト: dejans11/my-gfeed
 def __init__(self, buffer, **data):
     self._buffer_stack = [buffer]
     
     # original data, minus the builtins
     self._orig = data
     
     # the context data which includes builtins
     self._data = __builtin__.__dict__.copy()
     self._data.update(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'] = util.partial(capture, self)
     
     # "caller" stack used by def calls with content
     self.caller_stack = self._data['caller'] = CallerStack()
コード例 #7
0
ファイル: runtime.py プロジェクト: AgentJay/webapp-improved
 def get(key):
     callable_ = getattr(self.module, key)
     return util.partial(callable_, self.context)
コード例 #8
0
ファイル: runtime.py プロジェクト: AgentJay/webapp-improved
 def get(key):
     callable_ = self.template._get_def_callable(key)
     return util.partial(callable_, self.context)
コード例 #9
0
 def get(key):
     callable_ = getattr(self.module, key)
     return util.partial(callable_, self.context)
コード例 #10
0
 def get(key):
     callable_ = self.template._get_def_callable(key)
     return util.partial(callable_, self.context)