Esempio n. 1
0
from aerest.api import Api
from models import Product
from webapp2_extras.routes import PathPrefixRoute
import webapp2



v1_api = Api(api_name='v1')
v1_api.register(Product)


routes = [
    PathPrefixRoute(r'/api/v1', v1_api.get_routes()),
    ]

application = webapp2.WSGIApplication(routes)
Esempio n. 2
0
from aerest.api import Api
from aeaccount.resources import UserProfileResource
import os
import webapp2
from webapp2_extras.routes import PathPrefixRoute
from webapp2_extras.routes import RedirectRoute

api_v1 = Api()
api_v1.register(UserProfileResource)

routes = [
    PathPrefixRoute(r'/account/api/v1', api_v1.get_routes()),
    RedirectRoute(r'/account', redirect_to='/account/'),
    webapp2.Route(r'/account/', handler='aeaccount.handlers.AccountHandler:overview', name='account-overview'),
    webapp2.Route(r'/account/email', handler='aeaccount.handlers.EmailHandler', name='account-email-list'),
    webapp2.Route(r'/account/connected', handler='aeaccount.handlers.AccountHandler:connected', name='account-recovery'),
    webapp2.Route(r'/account/overview', handler='aeaccount.handlers.AccountHandler:overview', name='account-settings'),
    webapp2.Route(r'/account/password', handler='aeaccount.handlers.PasswordHandler', name='account-password'),
    webapp2.Route(r'/account/profile', handler='aeaccount.handlers.ProfileHandler', name='account-profile'),

    # Account Recovery
    webapp2.Route(r'/account/recovery', handler='aeaccount.handlers.RecoveryHandler', name='account-recovery'),
    webapp2.Route(r'/account/recovery/<token>', handler='aeaccount.handlers.RecoveryCompleteHandler', name='account-recovery-verify'),

    # Tasks
    webapp2.Route(r'/account/tasks/password-recovery-email', handler='aeaccount.handlers.EmailTaskHandler:password_recovery', name='account-task-password-recovery'),
    ]

template_path = os.path.join(os.path.dirname(__file__), 'templates')

config = {
Esempio n. 3
0
import webapp2
import os
from aerest.api import Api
from aeadmin.resources import ConfigResource
from webapp2_extras.routes import PathPrefixRoute
from webapp2_extras.routes import RedirectRoute

api_v1 = Api()
api_v1.register(ConfigResource)

routes = [
    PathPrefixRoute(r'/admin/api/v1', api_v1.get_routes()),
    RedirectRoute(r'/admin', redirect_to='/admin/'),
    webapp2.Route(r'/admin/', handler='aeadmin.handlers.PageHandler:root', name='admin-root'),

    webapp2.Route(r'/_ah/admin/memcache/clear', handler='aeadmin.handlers.UtilHandler:memcache_clear', name='admin-memcache-clear'),

    ]

template_path = os.path.join(os.path.dirname(__file__), 'templates')

config = {
    'webapp2_extras.jinja2': {
        'template_path': ['templates', template_path],
        },
    }


application = webapp2.WSGIApplication(routes, config=config)
Esempio n. 4
0
    address = ndb.StringProperty()


class PersonResource(NDBResource):
    resource_model = Person
    resource_name = 'person'
    resource_name_plural = 'people'

class HouseResource(NDBResource):
    resource_model = House
    resource_name = 'address'
    resource_name_plural = 'addresses'


api_v1 = Api()
api_v1.register(PersonResource)
api_v1.register(HouseResource)

routes = [
    PathPrefixRoute(r'/api/v1', api_v1.get_routes()),
    ]

application = webapp2.WSGIApplication(routes)


class TestApi(BaseTestCase):

    def setUp(self):
        super(TestApi, self).setUp()

    def test_get_routes(self):