''' 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