Changes between Version 15 and Version 16 of EggCookingTutorial/AdvancedEggCooking2


Ignore:
Timestamp:
Jun 14, 2006, 7:38:27 PM (9 years ago)
Author:
maxb
Comment:

Wrap overly long Python source lines. Change <img> tag into an XHTML-compliant one. Also, sync my recent change to previous tutorial step.

Legend:

Unmodified
Added
Removed
Modified
  • EggCookingTutorial/AdvancedEggCooking2

    v15 v16  
    2626#!text/css
    2727div.helloworld h1 {
    28         color: red;
     28        color: red;
    2929}
    3030}}}
     
    5353      version=VERSION,
    5454      packages=['helloworld'],
    55       package_data={'helloworld' : ['htdocs/css/*.css', 'htdocs/images/*.jpg',
    56                                     'templates/*.cs' ]}
    5755      entry_points={'trac.plugins': '%s = helloworld' % PACKAGE},
     56      package_data={'helloworld': ['htdocs/css/*.css', 'htdocs/images/*.jpg',
     57                                   'templates/*.cs']},
    5858)
    5959}}}
     
    6969#!python
    7070    def get_htdocs_dirs(self):
    71         """
    72         Return a list of directories with static resources (such as style
     71        """Return a list of directories with static resources (such as style
    7372        sheets, images, etc.)
    7473
     
    7675        `prefix` part defines the path in the URL that requests to these
    7776        resources are prefixed with.
    78        
     77
    7978        The `abspath` is the absolute path to the directory containing the
    8079        resources on the local file system.
     
    9897{{{
    9998#!python
    100 from trac.web.chrome import INavigationContributor, ITemplateProvider, add_stylesheet
     99from trac.web.chrome import INavigationContributor, ITemplateProvider, \
     100        add_stylesheet
    101101}}}
    102102
     
    108108
    109109from trac.core import *
    110 from trac.web.chrome import INavigationContributor, ITemplateProvider, add_stylesheet
     110from trac.web.chrome import INavigationContributor, ITemplateProvider, \
     111        add_stylesheet
    111112from trac.web.main import IRequestHandler
    112113from trac.util import escape, Markup
     
    114115class UserbaseModule(Component):
    115116    implements(INavigationContributor, IRequestHandler, ITemplateProvider)
    116        
     117
    117118    # INavigationContributor methods
    118119    def get_active_navigation_item(self, req):
    119120        return 'helloworld'
    120                
     121
    121122    def get_navigation_items(self, req):
    122123        yield 'mainnav', 'helloworld', Markup('<a href="%s">Hello</a>',
    123                                          self.env.href.helloworld())
    124        
     124                self.env.href.helloworld())
     125
    125126    # IRequestHandler methods
    126127    def match_request(self, req):
    127128        return req.path_info == '/helloworld'
    128                                        
     129
    129130    def process_request(self, req):
    130131        add_stylesheet(req, 'hw/css/helloworld.css')
    131132        return 'helloworld.cs', None
    132                
     133
    133134    # ITemplateProvider methods
    134135    def get_templates_dirs(self):
    135         """
    136         Return the absolute path of the directory containing the provided
    137         ClearSilver templates.
     136        """Return a list of directories containing the provided ClearSilver
     137        templates.
    138138        """
    139139        from pkg_resources import resource_filename
    140140        return [resource_filename(__name__, 'templates')]
    141    
     141
    142142    def get_htdocs_dirs(self):
    143         """
    144         Return a list of directories with static resources (such as style
     143        """Return a list of directories with static resources (such as style
    145144        sheets, images, etc.)
    146145
     
    148147        `prefix` part defines the path in the URL that requests to these
    149148        resources are prefixed with.
    150        
     149
    151150        The `abspath` is the absolute path to the directory containing the
    152151        resources on the local file system.
     
    168167<div id="content" class="helloworld">
    169168 <h1>Hello world!</h1>
    170  <img src="<?cs var:chrome.href ?>/hw/images/helloworld.jpg">
     169 <img src="<?cs var:chrome.href ?>/hw/images/helloworld.jpg" />
    171170</div>
    172171