def app(): app = App(__name__) app.pipeline = [Pipe1(), Pipe2(), Pipe3()] @app.route() def ok(): return "ok" @app.route() def http_error(): abort(422) @app.route() def error(): raise Exception @app.route(pipeline=[Pipe4()]) def pipe4(): return "4" mod = app.module(__name__, 'mod', url_prefix='mod') mod.pipeline = [Pipe5()] @mod.route() def pipe5(): return "5" @mod.route(pipeline=[Pipe6()]) def pipe6(): return "6" return app
def app(): rv = App(__name__) rv.config.mailer.sender = '*****@*****.**' rv.config.auth.single_template = True rv.config.auth.hmac_key = "foobar" rv.pipeline = [SessionCookieManager('foobar')] return rv
def db(): app = App(__name__) db = DAL(app, config=sdict(uri='sqlite://dal.db')) db.define_models([ Stuff, Person, Thing, Feature, Price, Doctor, Patient, Appointment, House, Mouse, NeedSplit, Zoo, Animal, Elephant ]) return db
def db(): app = App(__name__) db = DAL(app, config=sdict(uri='sqlite://validators.db')) db.define_models([ A, AA, AAA, B, Consist, Len, Inside, Num, Eq, Match, Anyone, Proc, Person, Thing, Allowed, Mixed ]) return db
def db(): app = App(__name__) db = Database(app, config=sdict(uri='sqlite:memory', auto_migrate=True, auto_connect=True)) db.define_models(Register) return db
def db(): app = App(__name__) db = Database(app, config=sdict(uri='sqlite://dal.db')) db.define_models([ Stuff, Person, Thing, Feature, Price, Doctor, Patient, Appointment, User, Organization, Membership, House, Mouse, NeedSplit, Zoo, Animal, Elephant, Dog, Subscription ]) return db
def db(): app = App(__name__) db = Database(app, config=sdict(uri='sqlite://validators.db', auto_connect=True, auto_migrate=True)) db.define_models([ A, AA, AAA, B, Consist, Len, Inside, Num, Eq, Match, Anyone, Proc, Person, Thing, Allowed, Mixed ]) return db
def test_user_no_assign_level(): app = App(__name__) app.config.logging.pytest = sdict() result = _call_create_logger(app) assert result.handlers[-1].level == logging.WARNING
def db(): app = App(__name__) db = DAL(app) db.define_models([TModel]) return db
def app(): app = App(__name__) return app
def app(): app = App(__name__) app.config.templates_escape = 'all' app.config.templates_prettify = True return app
def app(): app = App(__name__) app.languages = ['en', 'it'] app.language_default = 'en' app.language_force_on_url = True return app
from weppy import App, DAL from weppy.sessions import SessionCookieManager from weppy.tools import Auth app = App(__name__, template_folder="./views") # Config app.config.url_default_namespace = "main" app.config.templates_auto_reload = True app.config.db.adapter = "sqlite" app.config.db.host = "127.0.0.1" # Language settings app.languages = ['en'] app.language_default = 'en' app.language_force_on_url = True app.language_write = True # init database and auth from <%= appName %>.models.user import User # init auth before passing db models due to dependencies # on auth tables in the other models db = DAL(app) auth = Auth( app, db, usermodel=User ) # adding sessions and authorization handlers from <%= appName %>.utils import get_cryptogen_string app.route.common_handlers = [
def app(): rv = App(__name__) rv.config.db.uri = 'sqlite:memory' return rv
# -*- coding: utf-8 -*- from weppy import App, session, now, url, redirect, abort from weppy.orm import Database, Model, Field, belongs_to, has_many from weppy.tools import requires from weppy.tools.auth import Auth, AuthUser from weppy.sessions import SessionCookieManager app = App(__name__) app.config.auth.single_template = True app.config.auth.registration_validation = False app.config.auth.hmac_key = "MassiveDynamicRules" #: define models class User(AuthUser): # will create "auth_user" table and groups/permissions ones has_many('posts', 'comments') class Post(Model): belongs_to('user') has_many('comments') title = Field() text = Field('text') date = Field('datetime') default_values = {'user': lambda: session.auth.user.id, 'date': now} validation = {'title': {'presence': True}, 'text': {'presence': True}} fields_rw = {'user': False, 'date': False}
def test_user_assign_valid_level(): app = App(__name__) app.config.logging.pytest = sdict(level='info') result = _call_create_logger(app) assert result.handlers[-1].level == logging.INFO
def app(): app = App(__name__) app.language_write = True delattr(Tinstance, '_t') return app
def initialize_database(): app = App('app') app.config_from_yaml('db.yml', 'db') db = Database(app) db.define_models(SpectrumAnalyzer, FieldProbe, Scan, ScanResult) return db
def app(): rv = App(__name__) rv.config.mailer.sender = '*****@*****.**' return rv
def app(): app = App(__name__) app.config.templates_escape = 'all' return app
def db(): app = App(__name__) db = Database(app, config=sdict(uri='sqlite:memory')) auth = Auth(app, db, usermodel=User) db.define_models(Thing) return db