Python flask_script.prompt_bool() Examples

The following are 6 code examples of flask_script.prompt_bool(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module flask_script , or try the search function .
Example #1
Source File: manage.py    From ara-archive with GNU General Public License v3.0 5 votes vote down vote up
def dropall():
    """ Drops all database tables """

    if prompt_bool('Are you sure ? You will lose all your data !'):
        db.drop_all() 
Example #2
Source File: manage.py    From web_develop with GNU General Public License v3.0 5 votes vote down vote up
def dropdb():
    if prompt_bool(
            'Are you sure you want to lose all your data'):
        db.drop_all() 
Example #3
Source File: tsctl.py    From timesketch with Apache License 2.0 5 votes vote down vote up
def run(self):
        """Drop all tables after user ha verified."""
        verified = prompt_bool(
            'Do you really want to drop all the database tables?')
        if verified:
            sys.stdout.write('All tables dropped. Database is now empty.\n')
            drop_all() 
Example #4
Source File: tsctl.py    From timesketch with Apache License 2.0 5 votes vote down vote up
def run(self, index_name):
        """Delete timeline in both Timesketch and Elasticsearch.

        Args:
            index_name: The name of the index in Elasticsearch
        """
        if not isinstance(index_name, six.text_type):
            index_name = codecs.decode(index_name, 'utf-8')

        searchindex = SearchIndex.query.filter_by(
            index_name=index_name).first()

        if not searchindex:
            sys.stdout.write('No such index\n')
            sys.exit()

        es = ElasticsearchDataStore(
            host=current_app.config['ELASTIC_HOST'],
            port=current_app.config['ELASTIC_PORT'])

        timelines = Timeline.query.filter_by(searchindex=searchindex).all()
        sketches = [
            t.sketch for t in timelines
            if t.sketch and t.sketch.get_status.status != 'deleted'
        ]
        if sketches:
            sys.stdout.write('WARNING: This timeline is in use by:\n')
            for sketch in sketches:
                sys.stdout.write(' * {0:s}\n'.format(sketch.name))
                sys.stdout.flush()
        really_delete = prompt_bool(
            'Are you sure you want to delete this timeline?')
        if really_delete:
            for timeline in timelines:
                db_session.delete(timeline)
            db_session.delete(searchindex)
            db_session.commit()
            es.client.indices.delete(index=index_name) 
Example #5
Source File: manage.py    From glossary-bot with MIT License 5 votes vote down vote up
def dropdb():
    if prompt_bool("Are you sure you want to lose all your data?"):
        db.drop_all() 
Example #6
Source File: manage.py    From infosec_mentors_project with GNU General Public License v3.0 5 votes vote down vote up
def dropdb():
    if prompt_bool(
        "Are you sure you want to drop the database?"):
        db.drop_all()
        print "Database has been dropped"