|
|
|
''' Resources (sub) package, used to connect URLs to views '''
|
|
|
|
|
|
|
|
from pyramid.security import Allow, Everyone, DENY_ALL
|
|
|
|
from ordr.schemas.account import RegistrationSchema
|
|
|
|
|
|
|
|
from .helpers import BaseChildResource
|
|
|
|
|
|
|
|
|
|
|
|
class RegistrationResource(BaseChildResource):
|
|
|
|
''' The resource for new user registration
|
|
|
|
|
|
|
|
:param pyramid.request.Request request: the current request object
|
|
|
|
:param str name: the name of the resource
|
|
|
|
:param parent: the parent resouce
|
|
|
|
'''
|
|
|
|
|
|
|
|
nav_active = 'registration'
|
|
|
|
|
|
|
|
def __acl__(self):
|
|
|
|
''' access controll list for the resource '''
|
|
|
|
return [(Allow, Everyone, 'view'), DENY_ALL]
|
|
|
|
|
|
|
|
def get_registration_form(self, **override):
|
|
|
|
''' returns the registration form'''
|
|
|
|
settings = {
|
|
|
|
'buttons': ('Create account', 'Cancel'),
|
|
|
|
}
|
|
|
|
settings.update(override)
|
|
|
|
return self._prepare_form(RegistrationSchema, **settings)
|