You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
840 B
27 lines
840 B
7 years ago
|
''' Resources (sub) package, used to connect URLs to views '''
|
||
|
|
||
|
|
||
|
class BaseChildResource:
|
||
|
|
||
|
def __init__(self, request, name, parent):
|
||
|
''' Create a child resource
|
||
|
|
||
|
:param pyramid.request.Request request: the current request object
|
||
|
:param str name: the name of the resource
|
||
|
:param parent: the parent resouce
|
||
|
'''
|
||
|
self.request = request
|
||
|
self.__name__ = name
|
||
|
self.__parent__ = parent
|
||
|
|
||
|
def __acl__(self):
|
||
|
''' access controll list for the resource '''
|
||
|
raise NotImplementedError()
|
||
|
|
||
|
def _prepare_form(self, schema, prefill=None, **settings):
|
||
|
''' prepares a deform form for the resource'''
|
||
|
form = schema.as_form(self.request, **settings)
|
||
|
if prefill is not None:
|
||
|
form.set_appstruct(prefill)
|
||
|
return form
|