Changeset 18:432718b59587 for relatorio/reporting.py
- Timestamp:
- 07/17/08 00:11:51 (5 years ago)
- Branch:
- default
- Files:
-
- 1 modified
-
relatorio/reporting.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
relatorio/reporting.py
r16 r18 19 19 ############################################################################### 20 20 21 __revision__ = "$Id: reporting.py 1 7 2008-07-15 10:26:58Z nicoe $"21 __revision__ = "$Id: reporting.py 19 2008-07-17 00:11:51Z nicoe $" 22 22 __metaclass__ = type 23 23 24 24 import os, sys 25 25 import warnings 26 import cStringIO26 from cStringIO import StringIO 27 27 28 28 import pkg_resources … … 104 104 self.data_factory = factory 105 105 self.tmpl_loader = loader 106 self.filters = [] 106 107 107 108 def __call__(self, obj, **kwargs): 108 109 template = self.tmpl_loader.load(self.fpath, self.mimetype) 109 110 data = self.data_factory(obj, **kwargs) 110 report = template.generate(**data) 111 if not isinstance(report, (cStringIO.InputType, cStringIO.OutputType)): 112 report = StringIO(str(report)) 113 return report 111 return template.generate(**data).filter(*self.filters) 114 112 115 113 def __repr__(self):
