def _get_form(self, resource, context): form = AutoForm._get_form(self, resource, context) name = self.get_new_resource_name(form) # Check the name if not name: raise FormError, messages.MSG_NAME_MISSING try: name = checkid(name) except UnicodeEncodeError: name = None if name is None: raise FormError, messages.MSG_BAD_NAME # Check the name is free root = context.root category = root.get_resource(form['category']) if category.get_resource(name, soft=True) is not None: raise FormError, messages.MSG_NAME_CLASH # Ok form['name'] = name return form
def get_value(self, resource, context, name, datatype): if context.user: if name == 'my_email': return context.user.get_property('email') elif name == 'my_name': return context.user.get_title() return AutoForm.get_value(self, resource, context, name, datatype)
def get_namespace(self, resource, context): namespace = AutoForm.get_namespace(self, resource, context) namespace['actions'] = self._get_action_namespace(resource, context) return namespace
def get_namespace(self, resource, context): namespace = AutoForm.get_namespace(self, resource, context) namespace['required_msg'] = (resource.get_property('introduction') + list(XMLParser('<br/><br/>')) + list(namespace['required_msg'])) return namespace