Package tdi :: Package integration :: Module wtf_service :: Class GlobalTemplate
[frames] | no frames]

Class GlobalTemplate

source code

object --+
         |
        GlobalTemplate

Actual global template service object
Instance Methods
 
__init__(self, locations, autoreload=False, require_scopes=False, require_methods=False, filters=None)
Initialization
source code
callable
lister(self, extensions, ignore=None)
Create template lister from our own config
source code
wtf.app.services.resources.ResourceStream
stream(self, name, mode='rb', buffering=-1, blockiter=0)
Locate file in the template directories and open a stream
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables
bool autoreload
Automatically reload templates?
bool require_methods
Require all render methods?
bool require_scopes
Require all scopes?
Properties

Inherited from object: __class__

Method Details

__init__(self, locations, autoreload=False, require_scopes=False, require_methods=False, filters=None)
(Constructor)

source code 
Initialization
Parameters:
  • locations (iterable) - Resource locations (['token', ...])
  • autoreload (bool) - Automatically reload templates?
  • require_scopes (bool) - Require all scopes?
  • require_methods (bool) - Require all render methods?
  • filters (dict) - Filter factories to apply
Overrides: object.__init__

lister(self, extensions, ignore=None)

source code 
Create template lister from our own config
Parameters:
  • extensions (iterable) - List of file extensions to consider (required)
  • ignore (iterable) - List of (simple) directory names to ignore. If omitted or None, a default list is applied (DirectoryTemplateLister.DEFAULT_IGNORE)
Returns: callable
a template lister

stream(self, name, mode='rb', buffering=-1, blockiter=0)

source code 
Locate file in the template directories and open a stream
Parameters:
  • name (str) - The relative filename
  • mode (str) - The opening mode
  • buffering (int) - buffering spec
  • blockiter (int) - Iterator mode (1: Line, <= 0: Default chunk size, > 1: This chunk size)
Returns: wtf.app.services.resources.ResourceStream
The resource stream
Raises:
  • IOError - File not found

Instance Variable Details

autoreload

Automatically reload templates?
Type:
bool

require_methods

Require all render methods?
Type:
bool

require_scopes

Require all scopes?
Type:
bool