def afterSetUp(self): xml = """<model xmlns:lingua="http://namespaces.plone.org/supermodel/lingua" xmlns:users="http://namespaces.plone.org/supermodel/users" xmlns:form="http://namespaces.plone.org/supermodel/form" xmlns:i18n="http://xml.zope.org/namespaces/i18n" xmlns:security="http://namespaces.plone.org/supermodel/security" xmlns:marshal="http://namespaces.plone.org/supermodel/marshal" xmlns="http://namespaces.plone.org/supermodel/schema" i18n:domain="plone"> <schema name="member-fields"> <field name="id_number" type="zope.schema.TextLine" users:forms="In User Profile"> <description i18n:translate="help_idnumber"> The number of user's personal identifier . </description> <required>True</required> <title i18n:translate="">Identifier Number</title> </field> <field name="safe_level" type="zope.schema.Choice" users:forms="In User Profile"> <description/> <required>False</required> <title i18n:translate="">safe level</title> <values> <element>height</element> <element>mid</element> <element>low</element> </values> </field> </schema> </model> """ context = DummyImportContext(self.portal, purge=False) context._files = {'userschema.xml': xml} import_schema(context)
def setUp(self): super(TestSchema, self).setUp() xml = """<model xmlns:lingua="http://namespaces.plone.org/supermodel/lingua" xmlns:users="http://namespaces.plone.org/supermodel/users" xmlns:form="http://namespaces.plone.org/supermodel/form" xmlns:i18n="http://xml.zope.org/namespaces/i18n" xmlns:security="http://namespaces.plone.org/supermodel/security" xmlns:marshal="http://namespaces.plone.org/supermodel/marshal" xmlns="http://namespaces.plone.org/supermodel/schema" i18n:domain="plone"> <schema name="member-fields"> <field name="home_page" type="zope.schema.URI" users:forms="In User Profile"> <description i18n:translate="help_homepage"> The URL for your external home page, if you have one. </description> <required>False</required> <title i18n:translate="label_homepage">Home Page</title> </field> <field name="description" type="zope.schema.Text" users:forms="In User Profile"> <description i18n:translate="help_biography"> A short overview of who you are and what you do. Will be displayed on your author page, linked from the items you create. </description> <required>False</required> <title i18n:translate="label_biography">Biography</title> </field> <field name="location" type="zope.schema.TextLine" users:forms="In User Profile"> <description i18n:translate="help_location"> Your location - either city and country - or in a company setting, where your office is located. </description> <required>False</required> <title i18n:translate="label_biography">Location</title> </field> <field name="portrait" type="plone.namedfile.field.NamedBlobImage" users:forms="In User Profile"> <description i18n:translate="help_portrait"> To add or change the portrait: click the "Browse" button; select a picture of yourself. Recommended image size is 75 pixels wide by 100 pixels tall. </description> <required>False</required> <title i18n:translate="label_portrait">Portrait</title> </field> <field name="birthdate" type="zope.schema.Date" users:forms="In User Profile"> <description/> <required>False</required> <title>Birthdate</title> </field> <field name="another_date" type="zope.schema.Datetime" users:forms="In User Profile"> <description/> <required>False</required> <title>Another date</title> </field> <field name="age" type="zope.schema.Int" users:forms="In User Profile"> <description/> <required>False</required> <title>Age</title> </field> <field name="department" type="zope.schema.Choice" users:forms="In User Profile"> <description/> <required>False</required> <title>Department</title> <values> <element>Marketing</element> <element>Production</element> <element>HR</element> </values> </field> <field name="skills" type="zope.schema.Set" users:forms="In User Profile"> <description/> <required>False</required> <title>Skills</title> <value_type type="zope.schema.Choice"> <values> <element>Programming</element> <element>Management</element> </values> </value_type> </field> <field name="pi" type="zope.schema.Float" users:forms="In User Profile"> <description/> <required>False</required> <title>Pi</title> </field> <field name="vegetarian" type="zope.schema.Bool" users:forms="In User Profile"> <description/> <required>False</required> <title>Vegetarian</title> </field> </schema> </model> """ context = DummyImportContext(self.portal, purge=False) context._files = {'userschema.xml': xml} import_schema(context) transaction.commit() self.browser = Browser(self.layer['app']) self.request = self.layer['request']