Пример #1
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)
Пример #2
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)
from weppy import AppModule, request, url, redirect, asis
from weppy.tools import requires
from hfunding import app, db, auth, Campaign, Cost

campaigns = AppModule(app, 'campaigns', __name__, url_prefix='campaigns',
                      template_folder='campaigns')


@campaigns.expose('/')
def discover():
    campaigns = db(
        (db.Campaign.start <= request.now) & (db.Campaign.closed == False)
    ).select(
        orderby=~db.Campaign.start,
        limitby=(0, 20)
    )
    return dict(campaigns=campaigns, showing='discover')


@campaigns.expose(template="discover.haml")
def all():
    campaigns = db(db.Campaign.start <= request.now).select(
        orderby=~db.Campaign.start,
        limitby=(0, 20)
    )
    return dict(campaigns=campaigns, showing='all')


@campaigns.expose('/mine', template="mine.haml")
@requires(auth.is_logged_in, url('main.account', 'login'))
def owned():
Пример #4
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)
Пример #5
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)