def create_app(self): return create_app(TestConfig())
sys.exit(1) print e self.print_usage() sys.exit(1) class AddressFetcher(Command): @property def description(self): return 'Lists emails from the "{}" mailing list'.format(self.list_name) def __init__(self, list_name, *args, **kwargs): Command.__init__(self, *args, **kwargs) self.list_name = list_name def run(self): l = MailingList.query.filter( MailingList.name==self.list_name).one() for user in l.users: print user.email app = create_app(production_settings) manager = MailingListManager(app, with_default_commands=False) if __name__ == '__main__': with app.test_request_context(): commands = dict([(l.name, AddressFetcher(l.name)) for l in MailingList.query.filter_by(public=True)]) manager.run(commands, fail_silently=True)
def create_app(self): app = create_app(TestConfig()) db.app = app db.init_app(app) return app