Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Changes between Version 6 and Version 7 of ExtendingQuickstart


Ignore:
Timestamp:
07/18/06 11:56:56 (13 years ago)
Author:
milde
Comment:

Cheetah note; removing inherited template files

Legend:

Unmodified
Added
Removed
Modified
  • ExtendingQuickstart

    v6 v7  
    4444 
    4545{{{ 
    46  
     46#!python 
    4747from paste.script import templates 
    4848import pkg_resources 
     
    6565 
    6666/elvelind grandin 
     67 
     68== Notes == 
     69 
     70If you're indeed extending `quickstart` and not creating a fresh template, you may want to add `use_cheetah = True` as an attribute of your template class, as `quickstart` makes use of Cheetah for IdentityManagement, though it might not be necessary in 0.8. 
     71 
     72== Advanced Topics == 
     73 
     74=== Removing Inherited Files === 
     75 
     76Sometimes you'll want to use a quickstart template, but perhaps you don't like one part. In this case your template's `__init__.py` might look like this: 
     77 
     78{{{ 
     79#!python 
     80from paste.script import templates 
     81import pkg_resources 
     82import os 
     83 
     84class AdvancedStart(templates.Template): 
     85 
     86    egg_plugins = ['AdvancedStart'] 
     87    _template_dir = pkg_resources.resource_filename('advancedstart', 'template') 
     88    summary = 'TurboGears Advanced project template' 
     89    required_templates = ['turbogears'] 
     90    use_cheetah = True 
     91 
     92    def post(self, command, output_dir, vars): 
     93        templates.Template.post(self, command, output_dir, vars) 
     94        try: 
     95            path = os.path.join(output_dir, vars['package'] + '/controllers.py') 
     96            os.remove(path) 
     97            print 'Removing', path 
     98        except OSError: 
     99            pass 
     100}}} 
     101 
     102Note: the above was made for use with TurboGears 0.9's `quickstart` template.