Ticket #1640 (closed task: migrated)
Refactor and improve quickstart templates
|Reported by:||chrisz||Owned by:||chrisz|
|Severity:||normal||Keywords:||quickstart templates, tempita. migrate|
Description (last modified by Chris Arndt) (diff)
The quickstart templates of TG 1.0 should be refactored and improved in TG 1.1.
The problem is that some templates are duplicating others (e.g. root._py_tmpl in tgbig is a copy of controllers.py_tmpl, and the external tggenshi package also copies several templates) which is violating DRY and led to several bugs in the past because people forgot to update the copies (see also ticket #1457). We probably need to change the quickstart template hierarchy to use multiple inheritance for the different aspects of a project (model, view, controller, directory layout etc.).
When the project templates for the views will be properly separated from the rest of the project, it will be also easier to support more than one templating language (e.g. Kid for backward compatibility or Mako for performance).
Another problem is that the choice of names for the quickstart templates, packages and directories in TG 1.0 is very inconsistent and obscuring the connections between them. Currently we have the following mess:
|template||package||entry point name|
Another idea is to replace the use of Cheetah in the quickstart templates with Tempita which is pure Python and more lightweight than Cheetah, integrates well with Paste and will probably be required by TG 2.0 anyway, since it is needed by weberror. Then those who don't use Cheetah for web templating will not need to install Cheetah for TG any more.
There are also a lot of DRY issues in the quickstart/update command classes (and probably the other tg-admin commands too) and the template classes are misplaced in quickstart.py, they should live in the qstemplates package. The command.quickstart module should be refactored to amend this.
We also need automated tests for the quickstart command with all its options (this is #792). These tests should not only verify that quickstart creates the proper project layout, but also run the unit tests of the quickstarted projects.
Summary of the suggested tasks:
- create a better quickstart template hierarchy separating model, view and controller files as well as the project directory layout (small, big)
- use consistent names for these templates
- use Tempita instead of Cheetah in all quickstart template
- maybe support more than one templating engine (e.g. Kid, Genshi, Mako)
- refactor command.quickstart (and maybe other modules in the command package as well)
- automated tests for quickstart and quickstarted templates
- Owner changed from anonymous to Chris Arndt
- Status changed from new to assigned
- Description modified (diff)
comment:11 Changed 5 years ago by Chris Arndt
- Owner changed from Chris Arndt to chrisz
- Status changed from assigned to new
- Keywords templates, tempita. migrate added; templates tempita removed