Show
Ignore:
Timestamp:
08/26/08 09:42:46 (5 years ago)
Author:
Nicolas ?vrard <nicoe@…>
Branch:
default
Message:

PyLinted? the sources

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • relatorio/templates/__init__.py

    r26 r62  
    2121__metaclass__ = type 
    2222 
    23 from genshi.template import Template as GenshiTemplate, MarkupTemplate 
     23import genshi.core 
    2424 
    2525 
    26 class NullTemplate(GenshiTemplate): 
     26class RelatorioStream(genshi.core.Stream): 
     27    "Base class for the relatorio streams." 
    2728 
    28     def __init__(self, source, filepath=None, filename=None, loader=None, 
    29                  encoding=None, lookup='strict', allow_exec=True): 
    30         raise NotImplementedError 
     29    def render(self, method=None, encoding='utf-8', out=None, **kwargs): 
     30        "calls the serializer to render the template" 
     31        return self.serializer(self.events) 
    3132 
    32     def _parse(self, source, encoding): 
    33         pass 
    34      
    35     def _prepare(self, stream): 
    36         pass 
     33    def serialize(self, method='xml', **kwargs): 
     34        "generates the bitstream corresponding to the template" 
     35        return self.render(method, **kwargs) 
    3736 
    38     def generate(self, *args, **kwargs): 
    39         pass 
     37    def __or__(self, function): 
     38        "Support for the bitwise operator" 
     39        return RelatorioStream(self.events | function, self.serializer)