Ticket #1457 (closed defect: fixed)
quickstart: tggenshi template overwrites the Elixir model
| Reported by: | nickmurdoch | Owned by: | fredlin |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.0.4 |
| Component: | GenshiQuickStart | Version: | trunk |
| Severity: | normal | Keywords: | |
| Cc: |
Description
tg-admin quickstart -i -e -t tggenshi starts an project with a standard SQLAlchemy model.py, rather than an Elixir model. Removing the tggenshi template from the quickstart sets up an Elixir model.py properly. It seems that the tggenshi template overwrites the Elixir model.
Attachments
Change History
comment:1 Changed 6 years ago by Chris Arndt
- Version changed from 1.0.3 to trunk
- Component changed from tg-admin (non-toolbox) to genshi
- Milestone set to 1.0.4
comment:3 Changed 6 years ago by sevenseeker
The included patch does not apply cleanly to the 1.0.4b2 release. Yet the problem persists, looks like some fixes made it in but not all.
Changed 6 years ago by chrisz
-
attachment
gsquickstart-r3672.patch
added
Patch against 1.0 branch in r3672
comment:4 Changed 6 years ago by chrisz
Here is a new patch against the current head of the 1.0 branch.
But Chris is right, ideally this should be fixed by refactoring the quickstart template inheritance. Maybe this can be done together with moving from Cheetah to Tempita.
comment:5 Changed 5 years ago by Chris Arndt
Here's a new approach (and patch) to the issue:
The tggenshi template should really inherit from the quickstart template and just overwrite the setup.py and the <package>/config/app.cfg file and add the genshi templates. The attached patch does that.
One problem with this approach: when you quickstart a project, the quickstart (paste) template will add some Kid template files and the tggenshi (paste) will delete them after it has created its Geshi templates. But when you run tg-admin update -t tggenshi in your project dir, the Kid templates will be created again. Now the tggenshi template can not just delete them again, because they might have been created eralier and on purpose by the developer.
What the new code does is: if it is an update command, prompt the user, if the files <package>/templates/{login,master,welcome}.kid should be removed (for each file). The default answer is 'n'.
Ultimately, as I said before, the template inheritance structure should be improved, but that will happen only in TG 1.1.
Changed 5 years ago by Chris Arndt
-
attachment
genshiquickstart-extends.patch
added
Patch against projects/GenshiQuickstart/trunk rev 2775
The model.py_tmpl file in the qsquickstart package - which provides the "tggenshi" template - is out of date, is does not contain support for Elixir yet.
Since the model.py in a project does not differ according to whether Kid or Genshi is used, we can just copy over the model.py_tmpl file from the quickstart template from the 1.0 branch. The attached patch does just that and also fixes an error in dev.cfg_tmpl and app.cfg_tmpl.
Ideally, gsquickstart should inherit from a template that contains the model.py_tmpl file, and not overwrite it, for example the "quickstart" template. But the "quickstart" template also contains the Kid templates, which are not needed for a project with Genshi templates. Maybe we need to restructure the template inheritance and provide a base template for TG application projects.
BTW: the 1.1 branch quickstart template uses Genshi templates per default.