Ticket #2403 (closed defect: fixed)
Provide a TGCommand base class within TurboGears 2.x core
| Reported by: | mcfletch | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.1b2 |
| Component: | TurboGears | Version: | 2.0.3 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
I've got a recipe for setting up a TurboGears CLI command. It sets up tg.config, SQLAlchemy, and if lang is defined in the config, attempts to set up i18n (thanks to tmu).
This *seems* like it is functionality that should be available by default from TurboGears. There's enough black-magic stuff necessary that it really seems it shouldn't be something we're asking the (new) user to know how to do.
Attachments
Change History
Changed 2 years ago by mcfletch
-
attachment
tgcommand.py
added
comment:1 Changed 2 years ago by jorge.vargas
- Milestone changed from __unclassified__ to 2.1
+1 this must go into 2.1. I have about 3 half done implementations on several projects.
comment:3 Changed 2 years ago by percious
Can you provide an rst file explaining usage? Do we have to put an entry in setup.py to use this?
comment:4 Changed 2 years ago by mcfletch
There is a documented (short) description in the 2.1 documentation which describes a much smaller approach to this. The TGCommand module doesn't currently have any test-cases. Percious suggests that we not include TGCommand without tests.
TGCommand is basically a real-world example of what is needed to prevent cron-bombing and otherwise creating an official command, but there's some question as to whether people really *want* that, or just want a simple couple-of-line script to integrate into their general code-bases.
Suggestion is to make tgcommand into tgext.tgcommand (i.e. an extension module).
TGCommand base-class