def create_app(self): app = create_app() app.config['TESTING'] = True app.config['PRESERVE_CONTEXT_ON_EXCEPTION'] = False app.config['WIKI_PATH'] = '/tmp/%s' % random_string(12) app.config['DB_URI'] = 'sqlite:////tmp/%s.db' % random_string(12) app.config.update(self.configure()) return app
def create_app(self): self.tempdir = tempfile.mkdtemp() app = create_app() app.config['TESTING'] = True app.config['PRESERVE_CONTEXT_ON_EXCEPTION'] = False app.config['WIKI_PATH'] = os.path.join(self.tempdir, random_string(12)) app.config['DB_URI'] = 'sqlite:///%s/%s.db' % (self.tempdir, random_string(12)) app.config.update(self.configure()) return app
def create_app(self): self.tempdir = tempfile.mkdtemp() app = create_app() app.config['TESTING'] = True app.config['PRESERVE_CONTEXT_ON_EXCEPTION'] = False app.config['WIKI_PATH'] = os.path.join(self.tempdir, random_string(12)) app.config['DB_URI'] = 'sqlite:///{0}/{1}.db'.format(self.tempdir, random_string(12)) app.test_client_class = FlaskClient app.testing = True app.config.update(self.configure()) return app
def create_app(self): self.tempdir = tempfile.mkdtemp() app = create_app() app.config['TESTING'] = True app.config['PRESERVE_CONTEXT_ON_EXCEPTION'] = False app.config['WIKI_PATH'] = os.path.join(self.tempdir, random_string(12)) app.config['DB_URI'] = 'sqlite:///{0}/{1}.db'.format( self.tempdir, random_string(12)) app.test_client_class = FlaskClient app.testing = True app.config.update(self.configure()) return app
def create_user(username, email, password): """ Create a new user """ show_pass = not password if not password: password = random_string(12) if User.get_by_username(username): red("Username %s already exists" % username) return if User.get_by_email(email): red("Email %s already exists" % email) return User.create(username, email, password) green("User %s created" % username) if show_pass: yellow("Password: %s" % password)
def create_user(username, email, password): """ Create a new user """ show_pass = not password if not password: password = random_string(12) if User.get_by_username(username): click.secho("Username %s already exists" % username, fg='red') return if User.get_by_email(email): click.secho("Email %s already exists" % email, fg='red') return User.create(username, email, password) click.secho("User %s created" % username, fg='green') if show_pass: click.secho("Password: %s" % password, fg='yellow')
kw[p.name] = v ctx.invoke(fn, **kw) @cli.command() @click.option('--site-title', default=config.SITE_TITLE, prompt='Enter site title.') @click.option('--base_url', default=config.BASE_URL, prompt='Enter base URL.') @click.option('--port', default=config.PORT, prompt='Enter port number.') @click.option('--secret-key', default=config.SECRET_KEY if config.SECRET_KEY != "CHANGE_ME" else random_string(64), prompt='Enter secret key.') @click.option('--wiki-path', default=config.WIKI_PATH, prompt='Enter wiki data directory.', help='Wiki Directory (git repo)') @click.option('--allow-anon', default=config.ALLOW_ANON, is_flag=True, prompt='Allow anonymous edits?') @click.option('--registration-enabled', default=config.REGISTRATION_ENABLED, is_flag=True, prompt='Enable registration?') @click.option('--cache-type', default=config.CACHE_TYPE,
v = click.prompt(p.prompt, p.default, p.hide_input, p.confirmation_prompt, p.type) kw[p.name] = v ctx.invoke(fn, **kw) @cli.command() @click.option('--site-title', default=config.SITE_TITLE, prompt='Enter site title.') @click.option('--base_url', default=config.BASE_URL, prompt='Enter base URL.') @click.option('--port', default=config.PORT, prompt='Enter port number.') @click.option('--secret-key', default=config.SECRET_KEY if config.SECRET_KEY != "CHANGE_ME" else random_string(64), prompt='Enter secret key.') @click.option('--wiki-path', default=config.WIKI_PATH, prompt='Enter wiki data directory.', help='Wiki Directory (git repo)') @click.option('--allow-anon', default=config.ALLOW_ANON, is_flag=True, prompt='Allow anonymous edits?') @click.option('--registration-enabled', default=config.REGISTRATION_ENABLED, is_flag=True, prompt='Enable registration?') @click.option('--cache-type', default=config.CACHE_TYPE,