librelist archives

« back to archive

Changes to Flask-Script

Changes to Flask-Script

From:
Dan Jacob
Date:
2010-07-14 @ 08:48
I'm making a number of changes to the Flask-Script extension for the
0.2 release. These changes are currently in the "decorators" branch
(see http://bitbucket.org/danjac/flask-script/ for source):

1. A couple of decorators for creating commands automatically from
functions, rather than using the Command class:

@manager.command
def hello(app, name):
    print "hello", name

@manager.options('-n', '--name', dest='name', help='your name')
def hello(app, name):
     print "hello", name

The Command class will remain, for more complex cases and for inbuilt
commands such as Server and Shell.

2. The "prompt_" Command methods have been moved into separate
functions. The current methods are deprecated.

3. The "description" attribute is deprecated; instead use docstrings
in command classes and functions for displaying help text.

I will release 0.2 some time this or next week time allowing, once
code and documentation are in good shape.