Changes between Version 3 and Version 4 of TraciStanPlugin


Ignore:
Timestamp:
Apr 25, 2006 12:23:11 AM (8 years ago)
Author:
pacopablo
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TraciStanPlugin

    v3 v4  
    2222 
    2323== Example == 
    24  
    25 TracIStan wraps the IRequestHandler interface to allow for using Stan templates. 
     24TracIStan exposes the {{{IStanRequestHandler}}} and {{{IStanRenderer}}} interfaces so that the [http://divmod.org/trac/wiki/DivmodNevow Nevow] Stan templating system can be used in Trac plugins. 
    2625 
    2726To use it: 
    28  * Subclass TracIStan 
    29  * Set template data in {{{req.standata}}} (a dict) 
    30  * Return a call to {{{self._return(req, 'template', 'text/html')}}} in the {{{process_request}}} method 
     27 * implement the {{{IStanRequestHandler}}} and/or the {{{IStanRenderer}}} interfaces 
     28 * Set template data in {{{req.standata}}}. Attention should be paid to possible existing values in the req.standata dictionary.  Thus, {{{req.standata.update()}}} should be used if filling {{{req.standata}}} from an existing dict. 
    3129 
    32 {{{ 
    33 #!python 
    34 from tracistan import TracIStan 
     30The {{{IStanRequestHandler}}} is intentionally similar to the {{{IRequestHandler}}} interface.  The only difference is that data that should be available in the Stan template must be stored in the {{{req.standata}}} dictionary. 
    3531 
    36 class TestStan(TracIStan): 
    37     """A simple test class illustrating usage""" 
     32For a more detailed example, see the [source:tracistanplugin/0.10/example/aftracistan aftracistan] example in the example directory of the source. 
    3833 
    39     def match_request(self, req): 
    40         """For the sake of completeness, let's match someting""" 
    41         return req.path_info == '/test' 
    42  
    43     def process_request(self, req): 
    44         """Here is where one would process all the yummy stuff""" 
    45  
    46         # do some stuff here 
    47  
    48         return self._return(req, 'template.stan') 
    49 }}} 
     34The template used in the aftracistan example was done by [http://andreasviklund.com/ Andreas Viklund].  He makes nice templates.  Props to him. 
    5035 
    5136== Recent Changes ==