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

Ticket #2403 (closed defect: fixed)

Opened 10 years ago

Last modified 9 years ago

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:


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.


tgcommand.py Download (7.3 KB) - added by mcfletch 10 years ago.
TGCommand base-class

Change History

Changed 10 years ago by mcfletch

TGCommand base-class

comment:1 Changed 10 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:2 Changed 9 years ago by percious

  • Milestone changed from 2.1 to 2.1b2

comment:3 Changed 9 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 9 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).

comment:5 Changed 9 years ago by mcfletch

  • Status changed from new to closed
  • Resolution set to fixed

Okay, there is now a tgext.command extension which can be installed. The README.txt in this package is basically the original blog post updated for the new packaging. Still needs tests and the like.

Note: See TracTickets for help on using tickets.