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
861 B
27 lines
861 B
''' Resources (sub) package, used to connect URLs to views ''' |
|
|
|
|
|
class BaseChildResource: |
|
|
|
def __init__(self, name, parent, model=None): |
|
''' Create a child resource |
|
|
|
:param str name: the name of the resource |
|
:param parent: the parent resouce |
|
:param model: optional data model for the resource |
|
''' |
|
self.__name__ = name |
|
self.__parent__ = parent |
|
self.request = parent.request |
|
self.model = model |
|
|
|
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
|
|
|