コード例 #1
0
ファイル: api.py プロジェクト: gi0baro/starter_weppy
from weppy import AppModule
from weppy.tools import ServiceHandler
from starter_weppy import app

api = AppModule(app, 'api', __name__, url_prefix='api')
api.common_handlers = [ServiceHandler('json')]


@api.route()
def version():
    json = {
        'version': 'v1'
    }
    return dict(status='OK', data=json)
コード例 #2
0
from weppy import AppModule
from weppy.tools import ServiceHandler
from starter_weppy import app

api = AppModule(app, 'api', __name__, url_prefix='api')
api.common_handlers = [ServiceHandler('json')]


@api.route()
def version():
    json = {'version': 'v1'}
    return dict(status='OK', data=json)
コード例 #3
0
from weppy import response, AppModule
from weppy.handlers import RequireHandler

from starter_weppy import app, db, auth
from ..controller_utils import not_auth

user = AppModule(app, 'user', __name__, template_folder="user")
user.common_handlers = [RequireHandler(auth.is_logged_in, not_auth)]


@user.route("/user/<str:userid>")
def profile(userid):
    user_row = db.User(id=userid)
    response.meta.title = "StarterWeppy | " + user_row.first_name + " " + \
                          user_row.last_name + " profile"
    return dict(user=user_row)
コード例 #4
0
from weppy import response, AppModule
from weppy.handlers import RequireHandler

from <%= appName %> import app, db
from ..controller_utils import is_admin, not_auth

admin = AppModule(app, 'admin', __name__, template_folder="admin")
admin.common_handlers = [RequireHandler(is_admin, not_auth)]


@admin.route()
def users():
    response.meta.title = "<%= appTitle %> | Users"
    users_rows = db(db.User.id > 0).select()
    return dict(users=users_rows)