I'm trying to subclass flaskext.script.Server and have run into several problems. The splitting of option specifications between init, get_options and run doesn't seem to make much sense. I can't easily override individual options from the superclass (e.g., making host default to 0.0.0.0 instead of 127.0.0.1). This is the best I could figure out:
#!python
class Record(Server):
description = 'records responses from the Xxxx data service'
def __init__(self, host='0.0.0.0', **kw):
super(Record, self).__init__(host, **kw)
def get_options(self):
return (super(Record, self).get_options() +
(Option('-o', '--xxxx-host',
dest='xxxx_host', required=True),))
def run(self, app, xxxx_host, *args, **kw):
app.config.update(XXXX_HOST=xxxx_host, PLAYBACK=False)
super(Record, self).run(app, *args, **kw)
but it isn't exactly pretty.