Index: /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/formmailer-formfolder.xsl
===================================================================
--- /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/formmailer-formfolder.xsl	(revision 328)
+++ /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/formmailer-formfolder.xsl	(revision 329)
@@ -8,5 +8,5 @@
     <xsl:for-each select="*">
         <!-- matched 'metadata' element and we copy it -->
-        <xsl:copy select=".">
+        <xsl:copy>
             <xsl:for-each select="*|text()">
                 <xsl:choose>
@@ -39,5 +39,5 @@
         <!-- change field's name attribute from 'body' to 'text' -->
         <xsl:when test="@name='form_pre'">
-            <xsl:copy select=".">
+            <xsl:copy>
                 <xsl:attribute name="name">formPrologue</xsl:attribute>
                 <xsl:value-of select="." />
@@ -46,5 +46,5 @@
         <!-- change field's name attribute from 'form_post' to 'text' -->
         <xsl:when test="@name='form_post'">
-            <xsl:copy select=".">
+            <xsl:copy>
                 <xsl:attribute name="name">formEpilogue</xsl:attribute>
                 <xsl:value-of select="." />
@@ -52,5 +52,5 @@
         </xsl:when>
         <xsl:when test="@name='sent_redirect'">
-            <xsl:copy select=".">
+            <xsl:copy>
                 <xsl:attribute name="name">thanksPageOverride</xsl:attribute>
                 <xsl:value-of select="." />
@@ -58,5 +58,5 @@
         </xsl:when>
         <xsl:when test="@name='cpyaction'">
-            <xsl:copy select=".">
+            <xsl:copy>
                 <xsl:attribute name="name">afterValidationOverride</xsl:attribute>
                 <xsl:value-of select="." />
@@ -71,5 +71,5 @@
 
 <xsl:template match="cmf:type">
-    <xsl:copy select=".">
+    <xsl:copy>
         <xsl:text>FormFolder</xsl:text>
     </xsl:copy>
Index: /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/formmaileradapter.xsl
===================================================================
--- /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/formmaileradapter.xsl	(revision 328)
+++ /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/formmaileradapter.xsl	(revision 329)
@@ -9,5 +9,5 @@
     <xsl:for-each select="*">
         <!-- matched 'metadata' element and we copy it -->
-        <xsl:copy select=".">
+        <xsl:copy>
             <xsl:for-each select="*|text()">
                 <xsl:choose>
@@ -55,5 +55,5 @@
         <!-- change field's name attribute from 'recipient_email' to 'recipientOverride' (TALESString) -->
         <xsl:when test="@name='recipient_email'">
-            <xsl:copy select=".">
+            <xsl:copy>
                 <xsl:attribute name="name">recipientOverride</xsl:attribute>
                 <xsl:value-of select="." />
@@ -62,5 +62,5 @@
         <!-- change field's name attribute from 'subject' to 'subjectOverride' (TALESString) -->
         <xsl:when test="@name='subject'">
-            <xsl:copy select=".">
+            <xsl:copy>
                 <xsl:attribute name="name">subjectOverride</xsl:attribute>
                 <xsl:value-of select="." />
@@ -69,5 +69,5 @@
 
         <xsl:when test="@name='body_type'">
-            <xsl:copy select=".">
+            <xsl:copy>
                 <xsl:attribute name="name">body_type</xsl:attribute>
                 <xsl:choose>
Index: /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/formthankspage.xsl
===================================================================
--- /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/formthankspage.xsl	(revision 328)
+++ /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/formthankspage.xsl	(revision 329)
@@ -8,5 +8,5 @@
     <xsl:for-each select="*">
         <!-- matched 'metadata' element and we copy it -->
-        <xsl:copy select=".">
+        <xsl:copy>
             <xsl:for-each select="*|text()">
                 <xsl:choose>
@@ -33,5 +33,5 @@
         </xsl:when>
         <xsl:when test="@name='sent_message'">
-            <xsl:copy select=".">
+            <xsl:copy>
                 <xsl:attribute name="name">thanksPrologue</xsl:attribute>
                 <xsl:value-of select="." />
Index: /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/import.cfg
===================================================================
--- /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/import.cfg	(revision 328)
+++ /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/import.cfg	(revision 329)
@@ -14,8 +14,4 @@
 include = quintagroup.transmogrifier:import.cfg
 
-[reader]
-context = directory
-path = /data/koval/buildouts/plone31/profiles/forms
-
 [substitution]
 blueprint = quintagroup.transmogrifier.substitution
Index: /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/importing.py
===================================================================
--- /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/importing.py	(revision 328)
+++ /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/importing.py	(revision 329)
@@ -17,13 +17,4 @@
 from quintagroup.transmogrifier.adapters.importing import ReferenceImporter
 from quintagroup.transmogrifier.xslt import XSLTSection
-
-def debug(obj, good=True):
-    type_name = obj.getPortalTypeName()
-    path = os.path.join(*obj.getPhysicalPath()[1:])
-    msg = 'type=%s, path=%s' % (type_name, path) 
-    if good:
-        logging.getLogger('pfm2pfg').info(msg)
-    else:
-        logging.getLogger('pfm2pfg').warning(msg)
 
 BOOL_FIELD_PROPS = ['enabled', 'required', 'hidden']
@@ -71,5 +62,6 @@
         self.context = context
         self.demarshaller = getComponent("atxml")
-        self.auto_added_fields = ['replyto', 'topic', 'comments']
+        self.auto_added_fgfields = ['replyto', 'topic', 'comments']
+        self.date_fields = {}
 
     def __call__(self, data):
@@ -77,5 +69,5 @@
         xml = data['data']
 
-        data['data'] = self.updateFormFolder(xml)
+        data['data'] = self.transformWithMinidom(xml)
 
         # update FormMailerAdapter and FormThanksPage objects
@@ -88,9 +80,15 @@
         return data
 
-    def updateFormFolder(self, xml):
+    def transformWithMinidom(self, xml):
         """ Do some extra transformations on xml document (that can be done by XSLT).
         """
         doc = minidom.parseString(xml)
         root = doc.documentElement
+
+        # get 'modification_date' and 'creation_date' for next usage when creating fields
+        for i in root.getElementsByTagName('xmp:CreateDate'):
+            self.date_fields['creation_date'] = i.firstChild.nodeValue.strip()
+        for i in root.getElementsByTagName('xmp:ModifyDate'):
+            self.date_fields['modification_date'] = i.firstChild.nodeValue.strip()
 
         # xxx: update button labels (those elements are now skiped by xslt)
@@ -136,21 +134,19 @@
     def updateMailer(self, xml):
         mailer = self.context['mailer']
-        transformed = self.transform(xml, 'FormMailerAdapter')
+        transformed = self.transformWithXSLT(xml, 'FormMailerAdapter')
         self.demarshaller.demarshall(mailer, transformed)
         mailer.indexObject()
-        debug(mailer)
         return transformed
 
     def updateResponsePage(self, xml):
         page = self.context['thank-you']
-        transformed = self.transform(xml, 'FormThanksPage')
+        transformed = self.transformWithXSLT(xml, 'FormThanksPage')
         self.demarshaller.demarshall(page, transformed)
         # override default value of description field
         page.getField('description').getMutator(page)('')
         page.indexObject()
-        debug(page)
         return transformed
 
-    def transform(self, xml, to):
+    def transformWithXSLT(self, xml, to):
         """ Apply XSLT transformations using XSLT transmogrifier section.
         """
@@ -172,8 +168,6 @@
         """ Walk trough xml tree and create fields in FormFolder.
         """
-        # get id of form folder for logging purposes
-        self.form_id = self.context.getId()
         # delete fields that were added on FormFolder creation
-        for oid in [i for i in self.auto_added_fields if i in self.context]:
+        for oid in [i for i in self.auto_added_fgfields if i in self.context]:
             self.context._delObject(oid)
 
@@ -206,12 +200,5 @@
             Use demarshalling adapter.
         """
-        # create path to field for logging
-        if context is self.context:
-            path = "%s/%s" % (self.form_id, field_id)
-        else:
-            path = "%s/%s/%s" % (self.form_id, context.getId(), field_id)
-
         if FIELD_MAP.get(type_name) is None:
-            debug(type_name, False)
             return
 
@@ -220,4 +207,7 @@
         else:
             type_name, options = FIELD_MAP[type_name], {}
+        # update options with 'creation_date' and 'modification_date', that are
+        # the same as in FormFolder (dates on fields must be the same)
+        options.update(self.date_fields)
 
         if field_id not in context.contentIds():
@@ -227,7 +217,5 @@
                 raise
             except:
-                debug('%s %s' % (type_name, field_id), False)
                 return
-            debug(field)
         else:
             field = context._getOb(field_id)
@@ -235,9 +223,8 @@
         try:
             IXMLDemarshaller(field).demarshall(field_node, **options)
-            debug(field)
         except ConflictError:
             raise
-        except:
-            debug("on updating %s %s" % (type_name, field_id), False)
+        except Exception, e:
+            return
 
     def createFieldset(self, title):
@@ -250,7 +237,5 @@
                 raise
             except:
-                debug('FieldsetFolder with id="%s"' % title, False)
                 return
-            debug(fieldset)
         else:
             fieldset = self.context._getOb(title)
@@ -266,9 +251,8 @@
     def __init__(self, context):
         self.context = context
-        self.date_fields = ['creation_date', 'modification_date']
 
     def demarshall(self, node, **kw):
         self.extractData(node)
-        # update data dictionary form extra arguments
+        # update data dictionary form keyword arguments
         for k, v in kw.items():
             self.data[k] = v
@@ -285,10 +269,4 @@
                 continue
             mutator(value)
-
-        # set creation and modification date equal to dates in form folder
-        form_folder = aq_parent(aq_inner(self.context))
-        for field in self.date_fields:
-            value = form_folder.getField(field).getAccessor(form_folder)()
-            self.context.getField(field).getMutator(self.context)(value)
 
         self.context.indexObject()
@@ -318,4 +296,10 @@
                 data[name] = str(value.text)
 
+        # get tales expressions
+        tales = tree.first.field.first.tales
+        for name in tales.getElementNames():
+            value = getattr(tales.first, name)
+            data["tales:"+name] = str(value.text)
+
         self.data = data
 
@@ -327,4 +311,15 @@
             self.data[new] = self.data.pop(old)
 
+    def entryIsDigit(self, key):
+        """ Formulator exports empty fields in xml as empty elements without
+            'type' attribute. That's is why we get in data dictionary for 
+            integer fields values that are empty strings. This method is 
+            used to check whether integer field has integer value.
+        """
+        if key in self.data and isinstance(self.data[key], int):
+            return True
+        else:
+            return False
+
 class StringFieldDemarshaller(BaseFieldDemarshaller):
     """ Demarshaller of StringField and other fields of this kind.
@@ -333,6 +328,8 @@
     def modifyData(self):
         self.renameEntry('default', 'fgDefault')
-        self.renameEntry('max_length', 'fgmaxlength')
-        self.renameEntry('display_width', 'fgsize')
+        if self.entryIsDigit('display_maxwidth'):
+            self.renameEntry('display_maxwidth', 'fgmaxlength')
+        if self.entryIsDigit('display_width'):
+            self.renameEntry('display_width', 'fgsize')
 
 class TextFieldDemarshaller(BaseFieldDemarshaller):
@@ -342,6 +339,8 @@
     def modifyData(self):
         self.renameEntry('default', 'fgDefault')
-        self.renameEntry('max_length', 'fgmaxlength')
-        self.renameEntry('height', 'fgRows')
+        if self.entryIsDigit('max_length'):
+            self.renameEntry('max_length', 'fgmaxlength')
+        if self.entryIsDigit('height'):
+            self.renameEntry('height', 'fgRows')
 
 class LabelFieldDemarshaller(BaseFieldDemarshaller):
@@ -352,12 +351,18 @@
         self.renameEntry('default', 'fgDefault')
 
-class IntegerFieldDemarshaller(StringFieldDemarshaller):
+class IntegerFieldDemarshaller(BaseFieldDemarshaller):
     """ Demarshaller of IntegerField.
     """
 
     def modifyData(self):
-        super(IntegerFieldDemarshaller, self).modifyData()
-        self.renameEntry('start', 'minval')
-        self.renameEntry('end', 'maxval')
+        self.renameEntry('default', 'fgDefault')
+        if self.entryIsDigit('display_maxwidth'):
+            self.renameEntry('display_maxwidth', 'fgmaxlength')
+        if self.entryIsDigit('display_width'):
+            self.renameEntry('display_width', 'fgsize')
+        if self.entryIsDigit('start'):
+            self.renameEntry('start', 'minval')
+        if self.entryIsDigit('end'):
+            self.renameEntry('end', 'maxval')
 
 class DateTimeFieldDemarshaller(BaseFieldDemarshaller):
@@ -373,5 +378,4 @@
         # date_only is boolean flag
         self.data['fgShowHM'] = not bool(self.data['date_only'])
-        del self.data['date_only']
         if 'start_datetime' in self.data:
             self.data['start_datetime'] = self.data['start_datetime'].year()
@@ -387,5 +391,6 @@
     def modifyData(self):
         self.renameEntry('default', 'fgDefault')
-        self.renameEntry('height', 'fgRows')
+        if self.entryIsDigit('height'):
+            self.renameEntry('height', 'fgRows')
 
 class BooleanFieldDemarshaller(BaseFieldDemarshaller):
@@ -404,8 +409,13 @@
     def modifyData(self):
         self.renameEntry('default', 'fgDefault')
-        self.data['items'] = ['|'.join(i) for i in self.data['items']]
+        l = []
+        for i in self.data['items']:
+            i = list(i)
+            i.reverse()
+            l.append(i)
+        self.data['items'] = ['|'.join(i) for i in l]
         self.renameEntry('items', 'fgVocabulary')
 
-class MultiSelectFieldDemarshaller(LinesFieldDemarshaller):
+class MultiSelectFieldDemarshaller(SelectionFieldDemarshaller):
     """ Demarshaller of MultiSelectField.
     """
@@ -413,6 +423,6 @@
     def modifyData(self):
         super(MultiSelectFieldDemarshaller, self).modifyData()
-        self.data['items'] = ['|'.join(i) for i in self.data['items']]
-        self.renameEntry('items', 'fgVocabulary')
+        if self.entryIsDigit('size'):
+            self.renameEntry('size', 'fgRows')
 
 
Index: /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/tests/complex_form.xml
===================================================================
--- /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/tests/complex_form.xml	(revision 329)
+++ /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/tests/complex_form.xml	(revision 329)
@@ -0,0 +1,614 @@
+<?xml version="1.0" encoding="utf-8"?>
+<metadata xmlns="http://plone.org/ns/archetypes/" xmlns:cmf="http://cmf.zope.org/namespaces/default/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xmp="adobe:ns:meta">
+    <dc:title>
+        Publish new content management product or module
+    </dc:title>
+    <dc:creator>
+        admin
+    </dc:creator>
+    <xmp:CreateDate>
+        2007-05-15T08:41:51Z
+    </xmp:CreateDate>
+    <xmp:ModifyDate>
+        2007-12-04T09:25:47Z
+    </xmp:ModifyDate>
+    <field name="id">
+        complex-form
+    </field>
+    <field name="allowDiscussion">
+        None
+    </field>
+    <field name="effectiveDate">
+        2007/12/04 03:25:47.294 US/Central
+    </field>
+    <field name="recipient_email">
+        string:test@mail.com
+    </field>
+    <field name="body_pt">
+        &lt;tal:block i18n:domain=&quot;pfm&quot;
+           tal:define=&quot;form here/form;
+                       groups form/get_groups;&quot;&gt;
+&lt;html&gt;
+&lt;body style=&quot;font-family:verdana,sans-serif;&quot;&gt;
+&lt;p tal:condition=&quot;here/getBodyPre&quot; tal:content=&quot;here/getBodyPre&quot; /&gt;
+&lt;p tal:condition=&quot;options/prepend&quot; tal:content=&quot;options/prepend&quot; /&gt;
+
+&lt;tal:block tal:repeat=&quot;group groups&quot;&gt;
+  &lt;h1 tal:condition=&quot;python:group!='Default'&quot; tal:content=&quot;group&quot; /&gt;
+  &lt;table style=&quot;font-family:verdana,sans-serif;&quot;&gt;
+    &lt;tbody valign=&quot;top&quot;&gt;
+      &lt;tal:block tal:repeat=&quot;field python:form.get_fields_in_group(group)&quot;&gt;
+        &lt;tr&gt;
+          &lt;th i18n:translate=&quot;&quot; style=&quot;text-align:right; white-space: nowrap; border-bottom: 1px solid #cccccc;&quot; tal:content=&quot;field/title&quot; /&gt;
+          &lt;td&gt;
+            &lt;div tal:repeat=&quot;line field/mailsplitter&quot;&gt;
+              &lt;span tal:content=&quot;line&quot;/&gt;
+            &lt;/div&gt;
+          &lt;/td&gt;
+        &lt;/tr&gt;
+      &lt;/tal:block&gt;
+    &lt;/tbody&gt;
+  &lt;/table&gt;
+&lt;/tal:block&gt;
+
+&lt;p tal:condition=&quot;options/append&quot; tal:content=&quot;options/append&quot; /&gt;
+&lt;p tal:condition=&quot;here/getBodyPost&quot; tal:content=&quot;here/getBodyPost&quot; /&gt;
+&lt;pre tal:content=&quot;here/getFooter&quot; /&gt;
+&lt;/body&gt;
+&lt;/html&gt;
+&lt;/tal:block&gt;
+    </field>
+    <field name="body_type">
+        text/html
+    </field>
+    <field name="form_pre">
+        
+&lt;p&gt;form prologue&lt;/p&gt;
+
+    </field>
+    <field name="form_post">
+        
+&lt;p&gt;form epilogue&lt;/p&gt;
+
+    </field>
+    <field name="form_buttons">
+        Submit|submit|submit|context
+    </field>
+    <field name="form_buttons">
+        Reset|reset|reset|standalone
+    </field>
+    <field name="sent_title">
+        The form was send to editor.
+    </field>
+    <field name="sent_message">
+        
+&lt;p&gt;Thank you for new content. Our editor will review your request.&lt;br /&gt;&lt;/p&gt;
+
+    </field>
+    <uid>
+        738f9995ffd82394ff8a3fb75450c354
+    </uid>
+    <cmf:type>
+        PloneFormMailer
+    </cmf:type>
+    <cmf:workflow_history>
+        <cmf:workflow id="PloneFormMailer_workflow">
+            <cmf:history>
+                <cmf:var id="action" type="None" value="None"/>
+                <cmf:var id="actor" type="str" value="admin"/>
+                <cmf:var id="comments" type="str" value=""/>
+                <cmf:var id="review_state" type="str" value="members only send"/>
+                <cmf:var id="time" type="date" value="2007-05-15 03:41:51"/>
+            </cmf:history>
+            <cmf:history>
+                <cmf:var id="action" type="str" value="enable anonymous send"/>
+                <cmf:var id="actor" type="str" value="admin"/>
+                <cmf:var id="comments" type="str" value=""/>
+                <cmf:var id="review_state" type="str" value="anoymous send"/>
+                <cmf:var id="time" type="date" value="2007-12-04 03:25:47"/>
+            </cmf:history>
+        </cmf:workflow>
+    </cmf:workflow_history>
+    <cmf:security>
+        <cmf:local_role role="Owner" user_id="admin"/>
+    </cmf:security>
+    <field name="recipient_name">
+        ContentManagementSoftware.Info
+    </field>
+    <field name="subject">
+        string:Update Software
+    </field>
+
+<form>
+  <title>PFM Formulator</title>
+  <row_length>4</row_length>
+  <name>form</name>
+  <action/>
+  <method>POST</method>
+  <enctype/>
+  <encoding>UTF-8</encoding>
+  <stored_encoding>ISO-8859-1</stored_encoding>
+  <unicode_mode>false</unicode_mode>
+  <i18n_domain/>
+  <groups>
+    <group>
+      <title>Default</title>
+      <fields>
+          <field><id>field1</id> <type>StringField</type>
+              <values>
+                  <alternate_name></alternate_name>
+                  <css_class></css_class>
+                  <default></default>
+                  <description>field description</description>
+                  <display_maxwidth></display_maxwidth>
+                  <display_width type="int">20</display_width>
+                  <enabled type="int">1</enabled>
+                  <external_validator></external_validator>
+                  <extra></extra>
+                  <hidden type="int">0</hidden>
+                  <max_length></max_length>
+                  <required type="int">1</required>
+                  <title>String field</title>
+                  <truncate type="int">0</truncate>
+                  <unicode type="int">0</unicode>
+                  <whitespace_preserve type="int">0</whitespace_preserve>
+              </values>
+              <tales>
+              </tales>
+              <messages>
+                  <message name="external_validator_failed">The input failed the external validator.</message>
+                  <message name="required_not_found">Input is required but no input given.</message>
+                  <message name="too_long">Too much input was given.</message>
+              </messages>
+          </field>
+          <field><id>field2</id> <type>EmailField</type>
+              <values>
+                  <alternate_name></alternate_name>
+                  <css_class></css_class>
+                  <default>test@mail.com</default>
+                  <description></description>
+                  <display_maxwidth></display_maxwidth>
+                  <display_width type="int">20</display_width>
+                  <enabled type="int">1</enabled>
+                  <external_validator></external_validator>
+                  <extra></extra>
+                  <hidden type="int">0</hidden>
+                  <max_length></max_length>
+                  <required type="int">1</required>
+                  <title>Email field</title>
+                  <truncate type="int">0</truncate>
+                  <unicode type="int">0</unicode>
+                  <whitespace_preserve type="int">0</whitespace_preserve>
+              </values>
+              <tales>
+              </tales>
+              <messages>
+                  <message name="external_validator_failed">The input failed the external validator.</message>
+                  <message name="required_not_found">Input is required but no input given.</message>
+                  <message name="too_long">Too much input was given.</message>
+                  <message name="not_email">You did not enter an email address.</message>
+              </messages>
+          </field>
+          <field><id>field3</id> <type>LinkField</type>
+              <values>
+                  <alternate_name></alternate_name>
+                  <check_link type="int">0</check_link>
+                  <check_timeout type="float">7.0</check_timeout>
+                  <check_timeout>7.0</check_timeout>
+                  <css_class></css_class>
+                  <default></default>
+                  <description></description>
+                  <display_maxwidth type="int">15</display_maxwidth>
+                  <display_width type="int">20</display_width>
+                  <enabled type="int">1</enabled>
+                  <external_validator></external_validator>
+                  <extra></extra>
+                  <hidden type="int">0</hidden>
+                  <link_type>external</link_type>
+                  <max_length></max_length>
+                  <required type="int">0</required>
+                  <title>Link field</title>
+                  <truncate type="int">0</truncate>
+                  <unicode type="int">0</unicode>
+                  <whitespace_preserve type="int">0</whitespace_preserve>
+              </values>
+              <tales>
+              </tales>
+              <messages>
+                  <message name="external_validator_failed">The input failed the external validator.</message>
+                  <message name="required_not_found">Input is required but no input given.</message>
+                  <message name="too_long">Too much input was given.</message>
+                  <message name="not_link">The specified link is broken.</message>
+              </messages>
+          </field>
+
+          <field><id>field4</id> <type>PatternField</type>
+              <values>
+                  <alternate_name></alternate_name>
+                  <css_class></css_class>
+                  <default></default>
+                  <description></description>
+                  <display_maxwidth></display_maxwidth>
+                  <display_width type="int">20</display_width>
+                  <enabled type="int">1</enabled>
+                  <external_validator></external_validator>
+                  <extra></extra>
+                  <hidden type="int">1</hidden>
+                  <max_length></max_length>
+                  <pattern>*</pattern>
+                  <required type="int">1</required>
+                  <title>Pattern field</title>
+                  <truncate type="int">0</truncate>
+                  <unicode type="int">0</unicode>
+                  <whitespace_preserve type="int">0</whitespace_preserve>
+              </values>
+              <tales>
+              </tales>
+              <messages>
+                  <message name="external_validator_failed">The input failed the external validator.</message>
+                  <message name="required_not_found">Input is required but no input given.</message>
+                  <message name="too_long">Too much input was given.</message>
+                  <message name="pattern_not_matched">The entered value did not match the pattern.</message>
+              </messages>
+          </field>
+          <field><id>field5</id> <type>TextAreaField</type>
+              <values>
+                  <alternate_name></alternate_name>
+                  <css_class></css_class>
+                  <default></default>
+                  <description></description>
+                  <enabled type="int">1</enabled>
+                  <external_validator></external_validator>
+                  <extra></extra>
+                  <height type="int">5</height>
+                  <hidden type="int">0</hidden>
+                  <max_length type="int">1000</max_length>
+                  <max_linelength></max_linelength>
+                  <max_lines></max_lines>
+                  <required type="int">1</required>
+                  <title>Text area field</title>
+                  <unicode type="int">0</unicode>
+                  <whitespace_preserve type="int">0</whitespace_preserve>
+                  <width type="int">40</width>
+              </values>
+              <tales>
+              </tales>
+              <messages>
+                  <message name="external_validator_failed">The input failed the external validator.</message>
+                  <message name="required_not_found">Input is required but no input given.</message>
+                  <message name="too_many_lines">You entered too many lines.</message>
+                  <message name="line_too_long">A line was too long.</message>
+                  <message name="too_long">You entered too many characters.</message>
+              </messages>
+          </field>
+          <field><id>field6</id> <type>RawTextAreaField</type>
+              <values>
+                  <alternate_name></alternate_name>
+                  <css_class></css_class>
+                  <default></default>
+                  <description></description>
+                  <enabled type="int">1</enabled>
+                  <external_validator></external_validator>
+                  <extra></extra>
+                  <height type="int">5</height>
+                  <hidden type="int">0</hidden>
+                  <max_length></max_length>
+                  <required type="int">1</required>
+                  <title>Raw text area field</title>
+                  <truncate type="int">0</truncate>
+                  <unicode type="int">0</unicode>
+                  <whitespace_preserve type="int">0</whitespace_preserve>
+                  <width type="int">40</width>
+              </values>
+              <tales>
+              </tales>
+              <messages>
+                  <message name="external_validator_failed">The input failed the external validator.</message>
+                  <message name="required_not_found">Input is required but no input given.</message>
+                  <message name="too_long">Too much input was given.</message>
+              </messages>
+          </field>
+          <field><id>field7</id> <type>PasswordField</type>
+              <values>
+                  <alternate_name></alternate_name>
+                  <css_class></css_class>
+                  <default></default>
+                  <description></description>
+                  <display_maxwidth></display_maxwidth>
+                  <display_width type="int">20</display_width>
+                  <enabled type="int">1</enabled>
+                  <external_validator></external_validator>
+                  <extra></extra>
+                  <hidden type="int">0</hidden>
+                  <max_length></max_length>
+                  <required type="int">1</required>
+                  <title>Password field</title>
+                  <truncate type="int">0</truncate>
+                  <unicode type="int">0</unicode>
+                  <whitespace_preserve type="int">0</whitespace_preserve>
+              </values>
+              <tales>
+              </tales>
+              <messages>
+                  <message name="external_validator_failed">The input failed the external validator.</message>
+                  <message name="required_not_found">Input is required but no input given.</message>
+                  <message name="too_long">Too much input was given.</message>
+              </messages>
+           </field>
+           <field><id>field8</id> <type>LabelField</type>
+               <values>
+                   <css_class></css_class>
+                   <default>label text</default>
+                   <description></description>
+                   <enabled type="int">1</enabled>
+                   <external_validator></external_validator>
+                   <extra></extra>
+                   <hidden type="int">0</hidden>
+                   <title>Label field</title>
+               </values>
+               <tales>
+               </tales>
+               <messages>
+               </messages>
+            </field>
+            <field><id>field9</id> <type>IntegerField</type>
+                <values>
+                    <alternate_name></alternate_name>
+                    <css_class></css_class>
+                    <default>55</default>
+                    <description></description>
+                    <display_maxwidth type="int">40</display_maxwidth>
+                    <display_width type="int">20</display_width>
+                    <enabled type="int">1</enabled>
+                    <end type="int">1000</end>
+                    <external_validator></external_validator>
+                    <extra></extra>
+                    <hidden type="int">0</hidden>
+                    <required type="int">1</required>
+                    <start type="int">10</start>
+                    <title>Integer field</title>
+                    <whitespace_preserve type="int">0</whitespace_preserve>
+                </values>
+                <tales>
+                </tales>
+                <messages>
+                    <message name="external_validator_failed">The input failed the external validator.</message>
+                    <message name="required_not_found">Input is required but no input given.</message>
+                    <message name="not_integer">You did not enter an integer.</message>
+                    <message name="integer_out_of_range">The integer you entered was out of range.</message>
+                </messages>
+            </field>
+            <field><id>field10</id> <type>FloatField</type>
+                <values>
+                    <alternate_name></alternate_name>
+                    <css_class></css_class>
+                    <default></default>
+                    <description></description>
+                    <display_maxwidth type="int">10</display_maxwidth>
+                    <display_width type="int">20</display_width>
+                    <enabled type="int">1</enabled>
+                    <external_validator></external_validator>
+                    <extra></extra>
+                    <hidden type="int">0</hidden>
+                    <required type="int">1</required>
+                    <title>Float field</title>
+                    <whitespace_preserve type="int">0</whitespace_preserve>
+                </values>
+                <tales>
+                </tales>
+                <messages>
+                    <message name="external_validator_failed">The input failed the external validator.</message>
+                    <message name="required_not_found">Input is required but no input given.</message>
+                    <message name="not_float">You did not enter a floating point number.</message>
+                </messages>
+            </field>
+            <field><id>field11</id> <type>DateTimeField</type>
+                <values>
+                    <allow_empty_time type="int">0</allow_empty_time>
+                    <alternate_name></alternate_name>
+                    <ampm_time_style type="int">0</ampm_time_style>
+                    <css_class></css_class>
+                    <date_only type="int">0</date_only>
+                    <date_separator>/</date_separator>
+                    <default type="datetime">2008/10/10 10:10:00 GMT+3</default>
+                    <default_now type="int">0</default_now>
+                    <description></description>
+                    <enabled type="int">1</enabled>
+                    <end_datetime type="datetime">2010/12/31 23:59:00 GMT+2</end_datetime>
+                    <external_validator></external_validator>
+                    <hidden type="int">0</hidden>
+                    <hide_day type="int">0</hide_day>
+                    <input_order>ymd</input_order>
+                    <input_style>text</input_style>
+                    <required type="int">1</required>
+                    <start_datetime type="datetime">2006/01/01</start_datetime>
+                    <time_separator>:</time_separator>
+                    <title>Date time field</title>
+                </values>
+                <tales>
+                </tales>
+                <messages>
+                    <message name="external_validator_failed">The input failed the external validator.</message>
+                    <message name="required_not_found">Input is required but no input given.</message>
+                    <message name="not_datetime">You did not enter a valid date and time.</message>
+                    <message name="datetime_out_of_range">The date and time you entered were out of range.</message>
+                </messages>
+            </field>
+            <field><id>field12</id> <type>FileField</type>
+                <values>
+                    <alternate_name></alternate_name>
+                    <css_class></css_class>
+                    <default></default>
+                    <description></description>
+                    <display_maxwidth></display_maxwidth>
+                    <display_width type="int">20</display_width>
+                    <enabled type="int">1</enabled>
+                    <external_validator></external_validator>
+                    <extra></extra>
+                    <hidden type="int">0</hidden>
+                    <title>File field</title>
+                </values>
+                <tales>
+                </tales>
+                <messages>
+                    <message name="external_validator_failed">The input failed the external validator.</message>
+                </messages>
+            </field>
+            <field><id>field13</id> <type>LinesField</type>
+                <values>
+                    <alternate_name></alternate_name>
+                    <css_class></css_class>
+                    <default type="list">['first', 'second', 'third']</default>
+                    <description></description>
+                    <enabled type="int">1</enabled>
+                    <external_validator></external_validator>
+                    <extra></extra>
+                    <height type="int">5</height>
+                    <hidden type="int">0</hidden>
+                    <max_length></max_length>
+                    <max_linelength></max_linelength>
+                    <max_lines></max_lines>
+                    <required type="int">1</required>
+                    <title>Lines field</title>
+                    <unicode type="int">0</unicode>
+                    <view_separator>&lt;br /&gt;</view_separator>
+                    <whitespace_preserve type="int">0</whitespace_preserve>
+                    <width type="int">40</width>
+                </values>
+                <tales>
+                </tales>
+                <messages>
+                    <message name="external_validator_failed">The input failed the external validator.</message>
+                    <message name="required_not_found">Input is required but no input given.</message>
+                    <message name="too_many_lines">You entered too many lines.</message>
+                    <message name="line_too_long">A line was too long.</message>
+                    <message name="too_long">You entered too many characters.</message>
+                </messages>
+            </field>
+            <field><id>field14</id> <type>CheckBoxField</type>
+                <values>
+                    <alternate_name></alternate_name>
+                    <css_class></css_class>
+                    <default type="int">1</default>
+                    <description></description>
+                    <enabled type="int">1</enabled>
+                    <external_validator></external_validator>
+                    <extra></extra>
+                    <hidden type="int">0</hidden>
+                    <title>Checkbox field</title>
+                </values>
+                <tales>
+                </tales>
+                <messages>
+                    <message name="external_validator_failed">The input failed the external validator.</message>
+                </messages>
+            </field>
+            <field><id>field15</id> <type>ListField</type>
+                <values>
+                    <alternate_name></alternate_name>
+                    <css_class></css_class>
+                    <default>first</default>
+                    <description></description>
+                    <enabled type="int">1</enabled>
+                    <external_validator></external_validator>
+                    <extra></extra>
+                    <extra_item></extra_item>
+                    <first_item type="int">0</first_item>
+                    <hidden type="int">0</hidden>
+                    <items type="list">[('First', 'first'), ('Second', 'second'), ('Third', 'third')]</items>
+                    <required type="int">1</required>
+                    <size type="int">5</size>
+                    <title>List field</title>
+                    <unicode type="int">0</unicode>
+                    <whitespace_preserve type="int">0</whitespace_preserve>
+                </values>
+                <tales>
+                </tales>
+                <messages>
+                    <message name="external_validator_failed">The input failed the external validator.</message>
+                    <message name="required_not_found">Input is required but no input given.</message>
+                    <message name="unknown_selection">You selected an item that was not in the list.</message>
+                </messages>
+            </field>
+            <field><id>field16</id> <type>RadioField</type>
+                <values>
+                    <alternate_name></alternate_name>
+                    <css_class></css_class>
+                    <default>first</default>
+                    <description></description>
+                    <enabled type="int">1</enabled>
+                    <external_validator></external_validator>
+                    <extra_item></extra_item>
+                    <first_item type="int">0</first_item>
+                    <hidden type="int">0</hidden>
+                    <items type="list">[('First', 'first'), ('Second', 'second'), ('Third', 'third')]</items>
+                    <orientation>vertical</orientation>
+                    <required type="int">1</required>
+                    <title>Radio field</title>
+                    <unicode type="int">0</unicode>
+                    <whitespace_preserve type="int">0</whitespace_preserve>
+                </values>
+                <tales>
+                </tales>
+                <messages>
+                    <message name="external_validator_failed">The input failed the external validator.</message>
+                    <message name="required_not_found">Input is required but no input given.</message>
+                    <message name="unknown_selection">You selected an item that was not in the list.</message>
+                </messages>
+            </field>
+            <field><id>field17</id> <type>MultiListField</type>
+                <values>
+                    <alternate_name></alternate_name>
+                    <css_class></css_class>
+                    <default type="list">['first', 'third']</default>
+                    <description></description>
+                    <enabled type="int">1</enabled>
+                    <external_validator></external_validator>
+                    <extra></extra>
+                    <extra_item></extra_item>
+                    <hidden type="int">0</hidden>
+                    <items type="list">[('First', 'first'), ('Second', 'second'), ('Third', 'third')]</items>
+                    <required type="int">1</required>
+                    <size type="int">5</size>
+                    <title>Multi list field</title>
+                    <unicode type="int">0</unicode>
+                    <view_separator>&lt;br /&gt;</view_separator>
+                </values>
+                <tales>
+                </tales>
+                <messages>
+                    <message name="external_validator_failed">The input failed the external validator.</message>
+                    <message name="required_not_found">Input is required but no input given.</message>
+                    <message name="unknown_selection">You selected an item that was not in the list.</message>
+                </messages>
+            </field>
+            <field><id>field18</id> <type>MultiCheckBoxField</type>
+                <values>
+                    <alternate_name></alternate_name>
+                    <css_class></css_class>
+                    <default type="list">['first', 'third']</default>
+                    <description></description>
+                    <enabled type="int">1</enabled>
+                    <external_validator></external_validator>
+                    <extra_item></extra_item>
+                    <hidden type="int">0</hidden>
+                    <items type="list">[('First', 'first'), ('Second', 'second'), ('Third', 'third')]</items>
+                    <orientation>vertical</orientation>
+                    <required type="int">1</required>
+                    <title>Multi checkbox field</title>
+                    <unicode type="int">0</unicode>
+                    <view_separator>&lt;br /&gt;</view_separator>
+                </values>
+                <tales>
+                </tales>
+                <messages>
+                    <message name="external_validator_failed">The input failed the external validator.</message>
+                    <message name="required_not_found">Input is required but no input given.</message>
+                    <message name="unknown_selection">You selected an item that was not in the list.</message>
+                </messages>
+            </field>
+      </fields>
+    </group>
+  </groups>
+</form>
+</metadata>
Index: /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/tests/fieldset_form.xml
===================================================================
--- /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/tests/fieldset_form.xml	(revision 329)
+++ /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/tests/fieldset_form.xml	(revision 329)
@@ -0,0 +1,274 @@
+<?xml version="1.0" encoding="utf-8"?>
+<metadata xmlns="http://plone.org/ns/archetypes/" xmlns:cmf="http://cmf.zope.org/namespaces/default/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xmp="adobe:ns:meta">
+    <dc:title>
+        Form with fieldsets
+    </dc:title>
+    <xmp:CreateDate>
+        2007-05-15T08:41:51Z
+    </xmp:CreateDate>
+    <xmp:ModifyDate>
+        2007-12-04T09:25:47Z
+    </xmp:ModifyDate>
+    <field name="id">
+        fieldset-form
+    </field>
+    <field name="allowDiscussion">
+        None
+    </field>
+    <field name="effectiveDate">
+        2007/12/04 03:25:47.294 US/Central
+    </field>
+    <field name="recipient_email">
+        string:test@mail.com
+    </field>
+    <field name="body_pt">
+        &lt;tal:block i18n:domain=&quot;pfm&quot;
+        tal:define=&quot;form here/form;
+        groups form/get_groups;&quot;&gt;
+        &lt;html&gt;
+        &lt;body style=&quot;font-family:verdana,sans-serif;&quot;&gt;
+        &lt;p tal:condition=&quot;here/getBodyPre&quot; tal:content=&quot;here/getBodyPre&quot; /&gt;
+        &lt;p tal:condition=&quot;options/prepend&quot; tal:content=&quot;options/prepend&quot; /&gt;
+        
+        &lt;tal:block tal:repeat=&quot;group groups&quot;&gt;
+        &lt;h1 tal:condition=&quot;python:group!='Default'&quot; tal:content=&quot;group&quot; /&gt;
+        &lt;table style=&quot;font-family:verdana,sans-serif;&quot;&gt;
+        &lt;tbody valign=&quot;top&quot;&gt;
+        &lt;tal:block tal:repeat=&quot;field python:form.get_fields_in_group(group)&quot;&gt;
+        &lt;tr&gt;
+        &lt;th i18n:translate=&quot;&quot; style=&quot;text-align:right; white-space: nowrap; border-bottom: 1px solid #cccccc;&quot; tal:content=&quot;field/title&quot; /&gt;
+        &lt;td&gt;
+        &lt;div tal:repeat=&quot;line field/mailsplitter&quot;&gt;
+        &lt;span tal:content=&quot;line&quot;/&gt;
+        &lt;/div&gt;
+        &lt;/td&gt;
+        &lt;/tr&gt;
+        &lt;/tal:block&gt;
+        &lt;/tbody&gt;
+        &lt;/table&gt;
+        &lt;/tal:block&gt;
+        
+        &lt;p tal:condition=&quot;options/append&quot; tal:content=&quot;options/append&quot; /&gt;
+        &lt;p tal:condition=&quot;here/getBodyPost&quot; tal:content=&quot;here/getBodyPost&quot; /&gt;
+        &lt;pre tal:content=&quot;here/getFooter&quot; /&gt;
+        &lt;/body&gt;
+        &lt;/html&gt;
+        &lt;/tal:block&gt;
+    </field>
+    <field name="body_type">
+        text/html
+    </field>
+    <field name="form_pre">
+        
+        &lt;p&gt;form prologue&lt;/p&gt;
+        
+    </field>
+    <field name="form_post">
+        
+        &lt;p&gt;form epilogue&lt;/p&gt;
+        
+    </field>
+    <field name="form_buttons">
+        Submit|submit|submit|context
+    </field>
+    <field name="form_buttons">
+        Reset|reset|reset|standalone
+    </field>
+    <field name="sent_title">
+        The form was send to editor.
+    </field>
+    <field name="sent_message">
+        
+        &lt;p&gt;Thank you for new content. Our editor will review your request.&lt;br /&gt;&lt;/p&gt;
+        
+    </field>
+    <uid>
+        738f9995ffd82394ff8a3fb7c3545450
+    </uid>
+    <cmf:type>
+        PloneFormMailer
+    </cmf:type>
+    <cmf:workflow_history>
+        <cmf:workflow id="PloneFormMailer_workflow">
+            <cmf:history>
+                <cmf:var id="action" type="None" value="None"/>
+                <cmf:var id="actor" type="str" value="admin"/>
+                <cmf:var id="comments" type="str" value=""/>
+                <cmf:var id="review_state" type="str" value="members only send"/>
+                <cmf:var id="time" type="date" value="2007-05-15 03:41:51"/>
+            </cmf:history>
+            <cmf:history>
+                <cmf:var id="action" type="str" value="enable anonymous send"/>
+                <cmf:var id="actor" type="str" value="admin"/>
+                <cmf:var id="comments" type="str" value=""/>
+                <cmf:var id="review_state" type="str" value="anoymous send"/>
+                <cmf:var id="time" type="date" value="2007-12-04 03:25:47"/>
+            </cmf:history>
+        </cmf:workflow>
+    </cmf:workflow_history>
+    <cmf:security>
+        <cmf:local_role role="Owner" user_id="admin"/>
+    </cmf:security>
+    <field name="recipient_name">
+        ContentManagementSoftware.Info
+    </field>
+    <field name="subject">
+        string:Update Software
+    </field>
+<form>
+  <title>PFM Formulator</title>
+  <row_length>4</row_length>
+  <name>form</name>
+  <action></action>
+  <method>POST</method>
+  <enctype></enctype>
+  <encoding>UTF-8</encoding>
+  <stored_encoding>ISO-8859-1</stored_encoding>
+  <unicode_mode>false</unicode_mode>
+  <i18n_domain></i18n_domain>
+  <groups>
+    <group>
+      <title>Default</title>
+      <fields>
+
+      <field><id>checkbox</id> <type>CheckBoxField</type>
+        <values>
+          <alternate_name></alternate_name>
+          <css_class></css_class>
+          <default type="int">1</default>
+          <description>simple checkbox field</description>
+          <enabled type="int">1</enabled>
+          <external_validator></external_validator>
+          <extra></extra>
+          <hidden type="int">0</hidden>
+          <title>checkbox</title>
+        </values>
+        <tales>
+        </tales>
+        <messages>
+          <message name="external_validator_failed">The input failed the external validator.</message>
+        </messages>
+      </field>
+      <field><id>datetime</id> <type>DateTimeField</type>
+        <values>
+          <allow_empty_time type="int">0</allow_empty_time>
+          <alternate_name></alternate_name>
+          <ampm_time_style type="int">1</ampm_time_style>
+          <css_class></css_class>
+          <date_only type="int">0</date_only>
+          <date_separator>/</date_separator>
+          <default type="datetime">2005/12/01 13:25:00 GMT+2</default>
+          <default_now type="int">0</default_now>
+          <description>datetime field</description>
+          <enabled type="int">1</enabled>
+          <end_datetime type="datetime">2010/12/10 12:10:00 GMT+2</end_datetime>
+          <external_validator></external_validator>
+          <hidden type="int">0</hidden>
+          <hide_day type="int">0</hide_day>
+          <input_order>ymd</input_order>
+          <input_style>list</input_style>
+          <required type="int">0</required>
+          <start_datetime type="datetime">2005/10/10 12:10:00 GMT+3</start_datetime>
+          <time_separator>:</time_separator>
+          <title>datetime</title>
+        </values>
+        <tales>
+        </tales>
+        <messages>
+          <message name="external_validator_failed">The input failed the external validator.</message>
+          <message name="required_not_found">Input is required but no input given.</message>
+          <message name="not_datetime">You did not enter a valid date and time.</message>
+          <message name="datetime_out_of_range">The date and time you entered were out of range.</message>
+        </messages>
+      </field>
+      </fields>
+    </group>
+    <group>
+      <title>Other</title>
+      <fields>
+
+      <field><id>email</id> <type>EmailField</type>
+        <values>
+          <alternate_name></alternate_name>
+          <css_class></css_class>
+          <default></default>
+          <description>email field</description>
+          <display_maxwidth></display_maxwidth>
+          <display_width type="int">20</display_width>
+          <enabled type="int">1</enabled>
+          <external_validator></external_validator>
+          <extra></extra>
+          <hidden type="int">0</hidden>
+          <max_length></max_length>
+          <required type="int">0</required>
+          <title>email</title>
+          <truncate type="int">0</truncate>
+          <unicode type="int">0</unicode>
+          <whitespace_preserve type="int">0</whitespace_preserve>
+        </values>
+        <tales>
+        </tales>
+        <messages>
+          <message name="external_validator_failed">The input failed the external validator.</message>
+          <message name="required_not_found">Input is required but no input given.</message>
+          <message name="too_long">Too much input was given.</message>
+          <message name="not_email">You did not enter an email address.</message>
+        </messages>
+      </field>
+      <field><id>float</id> <type>FloatField</type>
+        <values>
+          <alternate_name></alternate_name>
+          <css_class></css_class>
+          <default>3.14</default>
+          <description>float field</description>
+          <display_maxwidth></display_maxwidth>
+          <display_width type="int">20</display_width>
+          <enabled type="int">1</enabled>
+          <external_validator></external_validator>
+          <extra></extra>
+          <hidden type="int">0</hidden>
+          <required type="int">0</required>
+          <title>float</title>
+          <whitespace_preserve type="int">0</whitespace_preserve>
+        </values>
+        <tales>
+        </tales>
+        <messages>
+          <message name="external_validator_failed">The input failed the external validator.</message>
+          <message name="required_not_found">Input is required but no input given.</message>
+          <message name="not_float">You did not enter a floating point number.</message>
+        </messages>
+      </field>
+      <field><id>string</id> <type>StringField</type>
+        <values>
+          <alternate_name></alternate_name>
+          <css_class></css_class>
+          <default>value</default>
+          <description>description</description>
+          <display_maxwidth></display_maxwidth>
+          <display_width type="int">20</display_width>
+          <enabled type="int">1</enabled>
+          <external_validator></external_validator>
+          <extra></extra>
+          <hidden type="int">0</hidden>
+          <max_length></max_length>
+          <required type="int">0</required>
+          <title>String field</title>
+          <truncate type="int">0</truncate>
+          <unicode type="int">1</unicode>
+          <whitespace_preserve type="int">0</whitespace_preserve>
+        </values>
+        <tales>
+          <default>string:Default</default>
+        </tales>
+        <messages>
+          <message name="external_validator_failed">The input failed the external validator.</message>
+          <message name="required_not_found">Input is required but no input given.</message>
+          <message name="too_long">Too much input was given.</message>
+        </messages>
+      </field>
+      </fields>
+    </group>
+  </groups>
+</form>
+</metadata>
Index: intagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/tests/post-software.xml
===================================================================
--- /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/tests/post-software.xml	(revision 328)
+++ 	(revision )
@@ -1,603 +1,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<metadata xmlns="http://plone.org/ns/archetypes/" xmlns:cmf="http://cmf.zope.org/namespaces/default/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xmp="adobe:ns:meta">
-    <dc:title>
-        Publish new content management product or module
-    </dc:title>
-    <dc:creator>
-        admin
-    </dc:creator>
-    <xmp:CreateDate>
-        2007-05-15T08:41:51Z
-    </xmp:CreateDate>
-    <xmp:ModifyDate>
-        2007-12-04T09:25:47Z
-    </xmp:ModifyDate>
-    <field name="id">
-        post-software
-    </field>
-    <field name="allowDiscussion">
-        None
-    </field>
-    <field name="effectiveDate">
-        2007/12/04 03:25:47.294 US/Central
-    </field>
-    <field name="recipient_email">
-        string:test@mail.com
-    </field>
-    <field name="body_pt">
-        &lt;tal:block i18n:domain=&quot;pfm&quot;
-           tal:define=&quot;form here/form;
-                       groups form/get_groups;&quot;&gt;
-&lt;html&gt;
-&lt;body style=&quot;font-family:verdana,sans-serif;&quot;&gt;
-&lt;p tal:condition=&quot;here/getBodyPre&quot; tal:content=&quot;here/getBodyPre&quot; /&gt;
-&lt;p tal:condition=&quot;options/prepend&quot; tal:content=&quot;options/prepend&quot; /&gt;
-
-&lt;tal:block tal:repeat=&quot;group groups&quot;&gt;
-  &lt;h1 tal:condition=&quot;python:group!='Default'&quot; tal:content=&quot;group&quot; /&gt;
-  &lt;table style=&quot;font-family:verdana,sans-serif;&quot;&gt;
-    &lt;tbody valign=&quot;top&quot;&gt;
-      &lt;tal:block tal:repeat=&quot;field python:form.get_fields_in_group(group)&quot;&gt;
-        &lt;tr&gt;
-          &lt;th i18n:translate=&quot;&quot; style=&quot;text-align:right; white-space: nowrap; border-bottom: 1px solid #cccccc;&quot; tal:content=&quot;field/title&quot; /&gt;
-          &lt;td&gt;
-            &lt;div tal:repeat=&quot;line field/mailsplitter&quot;&gt;
-              &lt;span tal:content=&quot;line&quot;/&gt;
-            &lt;/div&gt;
-          &lt;/td&gt;
-        &lt;/tr&gt;
-      &lt;/tal:block&gt;
-    &lt;/tbody&gt;
-  &lt;/table&gt;
-&lt;/tal:block&gt;
-
-&lt;p tal:condition=&quot;options/append&quot; tal:content=&quot;options/append&quot; /&gt;
-&lt;p tal:condition=&quot;here/getBodyPost&quot; tal:content=&quot;here/getBodyPost&quot; /&gt;
-&lt;pre tal:content=&quot;here/getFooter&quot; /&gt;
-&lt;/body&gt;
-&lt;/html&gt;
-&lt;/tal:block&gt;
-    </field>
-    <field name="body_type">
-        text/html
-    </field>
-    <field name="form_pre">
-        
-&lt;p&gt;form prologue&lt;/p&gt;
-
-    </field>
-    <field name="form_post">
-        
-&lt;p&gt;form epilogue&lt;/p&gt;
-
-    </field>
-    <field name="form_buttons">
-        Submit|submit|submit|context
-    </field>
-    <field name="form_buttons">
-        Reset|reset|reset|standalone
-    </field>
-    <field name="sent_title">
-        The form was send to editor.
-    </field>
-    <field name="sent_message">
-        
-&lt;p&gt;Thank you for new content. Our editor will review your request.&lt;br /&gt;&lt;/p&gt;
-
-    </field>
-    <uid>
-        738f9995ffd82394ff8a3fb75450c354
-    </uid>
-    <cmf:type>
-        PloneFormMailer
-    </cmf:type>
-    <cmf:workflow_history>
-        <cmf:workflow id="PloneFormMailer_workflow">
-            <cmf:history>
-                <cmf:var id="action" type="None" value="None"/>
-                <cmf:var id="actor" type="str" value="admin"/>
-                <cmf:var id="comments" type="str" value=""/>
-                <cmf:var id="review_state" type="str" value="members only send"/>
-                <cmf:var id="time" type="date" value="2007-05-15 03:41:51"/>
-            </cmf:history>
-            <cmf:history>
-                <cmf:var id="action" type="str" value="enable anonymous send"/>
-                <cmf:var id="actor" type="str" value="admin"/>
-                <cmf:var id="comments" type="str" value=""/>
-                <cmf:var id="review_state" type="str" value="anoymous send"/>
-                <cmf:var id="time" type="date" value="2007-12-04 03:25:47"/>
-            </cmf:history>
-        </cmf:workflow>
-    </cmf:workflow_history>
-    <cmf:security>
-        <cmf:local_role role="Owner" user_id="admin"/>
-    </cmf:security>
-    <field name="recipient_name">
-        ContentManagementSoftware.Info
-    </field>
-    <field name="subject">
-        string:Update Software
-    </field>
-
-<form>
-  <title>PFM Formulator</title>
-  <row_length>4</row_length>
-  <name>form</name>
-  <action/>
-  <method>POST</method>
-  <enctype/>
-  <encoding>UTF-8</encoding>
-  <stored_encoding>ISO-8859-1</stored_encoding>
-  <unicode_mode>false</unicode_mode>
-  <i18n_domain/>
-  <groups>
-    <group>
-      <title>Default</title>
-      <fields>
-
-      <field><id>fullname</id> <type>StringField</type>
-        <values>
-          <alternate_name/>
-          <css_class/>
-          <default/>
-          <description/>
-          <display_maxwidth/>
-          <display_width type="int">20</display_width>
-          <enabled type="int">1</enabled>
-          <external_validator/>
-          <extra/>
-          <hidden type="int">0</hidden>
-          <max_length/>
-          <required type="int">1</required>
-          <title>Your fullname</title>
-          <truncate type="int">0</truncate>
-          <unicode type="int">0</unicode>
-          <whitespace_preserve type="int">0</whitespace_preserve>
-        </values>
-        <tales>
-        </tales>
-        <messages>
-          <message name="external_validator_failed">The input failed the external validator.</message>
-          <message name="required_not_found">Input is required but no input given.</message>
-          <message name="too_long">Too much input was given.</message>
-        </messages>
-      </field>
-      <field><id>email</id> <type>EmailField</type>
-        <values>
-          <alternate_name/>
-          <css_class/>
-          <default/>
-          <description/>
-          <display_maxwidth/>
-          <display_width type="int">20</display_width>
-          <enabled type="int">1</enabled>
-          <external_validator/>
-          <extra/>
-          <hidden type="int">0</hidden>
-          <max_length/>
-          <required type="int">1</required>
-          <title>Your e-mail</title>
-          <truncate type="int">0</truncate>
-          <unicode type="int">0</unicode>
-          <whitespace_preserve type="int">0</whitespace_preserve>
-        </values>
-        <tales>
-        </tales>
-        <messages>
-          <message name="external_validator_failed">The input failed the external validator.</message>
-          <message name="required_not_found">Input is required but no input given.</message>
-          <message name="too_long">Too much input was given.</message>
-          <message name="not_email">You did not enter an email address.</message>
-        </messages>
-      </field>
-      <field><id>softwaretitle</id> <type>StringField</type>
-        <values>
-          <alternate_name/>
-          <css_class/>
-          <default/>
-          <description/>
-          <display_maxwidth/>
-          <display_width type="int">20</display_width>
-          <enabled type="int">1</enabled>
-          <external_validator/>
-          <extra/>
-          <hidden type="int">0</hidden>
-          <max_length/>
-          <required type="int">0</required>
-          <title>Title</title>
-          <truncate type="int">0</truncate>
-          <unicode type="int">0</unicode>
-          <whitespace_preserve type="int">0</whitespace_preserve>
-        </values>
-        <tales>
-        </tales>
-        <messages>
-          <message name="external_validator_failed">The input failed the external validator.</message>
-          <message name="required_not_found">Input is required but no input given.</message>
-          <message name="too_long">Too much input was given.</message>
-        </messages>
-      </field>
-      <field><id>softwaredescription</id> <type>TextAreaField</type>
-        <values>
-          <alternate_name/>
-          <css_class/>
-          <default/>
-          <description>Short information about product software</description>
-          <enabled type="int">1</enabled>
-          <external_validator/>
-          <extra/>
-          <height type="int">5</height>
-          <hidden type="int">0</hidden>
-          <max_length/>
-          <max_linelength/>
-          <max_lines/>
-          <required type="int">0</required>
-          <title>Description</title>
-          <unicode type="int">0</unicode>
-          <whitespace_preserve type="int">0</whitespace_preserve>
-          <width type="int">40</width>
-        </values>
-        <tales>
-        </tales>
-        <messages>
-          <message name="external_validator_failed">The input failed the external validator.</message>
-          <message name="required_not_found">Input is required but no input given.</message>
-          <message name="too_many_lines">You entered too many lines.</message>
-          <message name="line_too_long">A line was too long.</message>
-          <message name="too_long">You entered too many characters.</message>
-        </messages>
-      </field>
-      <field><id>softwaresummary</id> <type>TextAreaField</type>
-        <values>
-          <alternate_name/>
-          <css_class/>
-          <default/>
-          <description>Full information about product software.</description>
-          <enabled type="int">1</enabled>
-          <external_validator/>
-          <extra/>
-          <height type="int">15</height>
-          <hidden type="int">0</hidden>
-          <max_length/>
-          <max_linelength/>
-          <max_lines/>
-          <required type="int">0</required>
-          <title>Summary</title>
-          <unicode type="int">0</unicode>
-          <whitespace_preserve type="int">0</whitespace_preserve>
-          <width type="int">40</width>
-        </values>
-        <tales>
-        </tales>
-        <messages>
-          <message name="external_validator_failed">The input failed the external validator.</message>
-          <message name="required_not_found">Input is required but no input given.</message>
-          <message name="too_many_lines">You entered too many lines.</message>
-          <message name="line_too_long">A line was too long.</message>
-          <message name="too_long">You entered too many characters.</message>
-        </messages>
-      </field>
-      <field><id>version</id> <type>StringField</type>
-        <values>
-          <alternate_name/>
-          <css_class/>
-          <default/>
-          <description/>
-          <display_maxwidth/>
-          <display_width type="int">20</display_width>
-          <enabled type="int">1</enabled>
-          <external_validator/>
-          <extra/>
-          <hidden type="int">0</hidden>
-          <max_length/>
-          <required type="int">0</required>
-          <title>Product version</title>
-          <truncate type="int">0</truncate>
-          <unicode type="int">0</unicode>
-          <whitespace_preserve type="int">0</whitespace_preserve>
-        </values>
-        <tales>
-        </tales>
-        <messages>
-          <message name="external_validator_failed">The input failed the external validator.</message>
-          <message name="required_not_found">Input is required but no input given.</message>
-          <message name="too_long">Too much input was given.</message>
-        </messages>
-      </field>
-      <field><id>devstage</id> <type>StringField</type>
-        <values>
-          <alternate_name/>
-          <css_class/>
-          <default/>
-          <description>Beta, stable, development, release candidat or other.</description>
-          <display_maxwidth/>
-          <display_width type="int">20</display_width>
-          <enabled type="int">1</enabled>
-          <external_validator/>
-          <extra/>
-          <hidden type="int">0</hidden>
-          <max_length/>
-          <required type="int">0</required>
-          <title>Development Stage</title>
-          <truncate type="int">0</truncate>
-          <unicode type="int">0</unicode>
-          <whitespace_preserve type="int">0</whitespace_preserve>
-        </values>
-        <tales>
-        </tales>
-        <messages>
-          <message name="external_validator_failed">The input failed the external validator.</message>
-          <message name="required_not_found">Input is required but no input given.</message>
-          <message name="too_long">Too much input was given.</message>
-        </messages>
-      </field>
-      <field><id>license</id> <type>StringField</type>
-        <values>
-          <alternate_name/>
-          <css_class/>
-          <default/>
-          <description>GPL, LGPL, BSD, freeware or other.</description>
-          <display_maxwidth/>
-          <display_width type="int">20</display_width>
-          <enabled type="int">1</enabled>
-          <external_validator/>
-          <extra/>
-          <hidden type="int">0</hidden>
-          <max_length/>
-          <required type="int">0</required>
-          <title>License</title>
-          <truncate type="int">0</truncate>
-          <unicode type="int">0</unicode>
-          <whitespace_preserve type="int">0</whitespace_preserve>
-        </values>
-        <tales>
-        </tales>
-        <messages>
-          <message name="external_validator_failed">The input failed the external validator.</message>
-          <message name="required_not_found">Input is required but no input given.</message>
-          <message name="too_long">Too much input was given.</message>
-        </messages>
-      </field>
-      <field><id>supportcms</id> <type>StringField</type>
-        <values>
-          <alternate_name/>
-          <css_class/>
-          <default/>
-          <description>CMS version, supported by the product</description>
-          <display_maxwidth/>
-          <display_width type="int">20</display_width>
-          <enabled type="int">1</enabled>
-          <external_validator/>
-          <extra/>
-          <hidden type="int">0</hidden>
-          <max_length/>
-          <required type="int">0</required>
-          <title>Support CMS version</title>
-          <truncate type="int">0</truncate>
-          <unicode type="int">0</unicode>
-          <whitespace_preserve type="int">0</whitespace_preserve>
-        </values>
-        <tales>
-        </tales>
-        <messages>
-          <message name="external_validator_failed">The input failed the external validator.</message>
-          <message name="required_not_found">Input is required but no input given.</message>
-          <message name="too_long">Too much input was given.</message>
-        </messages>
-      </field>
-      <field><id>developed</id> <type>StringField</type>
-        <values>
-          <alternate_name/>
-          <css_class/>
-          <default/>
-          <description>Who develop the product</description>
-          <display_maxwidth/>
-          <display_width type="int">20</display_width>
-          <enabled type="int">1</enabled>
-          <external_validator/>
-          <extra/>
-          <hidden type="int">0</hidden>
-          <max_length/>
-          <required type="int">0</required>
-          <title>Developed By</title>
-          <truncate type="int">0</truncate>
-          <unicode type="int">0</unicode>
-          <whitespace_preserve type="int">0</whitespace_preserve>
-        </values>
-        <tales>
-        </tales>
-        <messages>
-          <message name="external_validator_failed">The input failed the external validator.</message>
-          <message name="required_not_found">Input is required but no input given.</message>
-          <message name="too_long">Too much input was given.</message>
-        </messages>
-      </field>
-      <field><id>downloadurl</id> <type>LinkField</type>
-        <values>
-          <alternate_name/>
-          <check_link type="int">0</check_link>
-          <check_timeout type="float">7.0</check_timeout>
-          <check_timeout>7.0</check_timeout>
-          <css_class/>
-          <default/>
-          <description>URL for downloading product</description>
-          <display_maxwidth/>
-          <display_width type="int">20</display_width>
-          <enabled type="int">1</enabled>
-          <external_validator/>
-          <extra/>
-          <hidden type="int">0</hidden>
-          <link_type>external</link_type>
-          <max_length/>
-          <required type="int">0</required>
-          <title>DownloadURL</title>
-          <truncate type="int">0</truncate>
-          <unicode type="int">0</unicode>
-          <whitespace_preserve type="int">0</whitespace_preserve>
-        </values>
-        <tales>
-        </tales>
-        <messages>
-          <message name="external_validator_failed">The input failed the external validator.</message>
-          <message name="required_not_found">Input is required but no input given.</message>
-          <message name="too_long">Too much input was given.</message>
-          <message name="not_link">The specified link is broken.</message>
-        </messages>
-      </field>
-      <field><id>softwareurl</id> <type>LinkField</type>
-        <values>
-          <alternate_name/>
-          <check_link type="int">0</check_link>
-          <check_timeout type="float">7.0</check_timeout>
-          <check_timeout>7.0</check_timeout>
-          <css_class/>
-          <default/>
-          <description/>
-          <display_maxwidth/>
-          <display_width type="int">20</display_width>
-          <enabled type="int">1</enabled>
-          <external_validator/>
-          <extra/>
-          <hidden type="int">0</hidden>
-          <link_type>external</link_type>
-          <max_length/>
-          <required type="int">0</required>
-          <title>Software URL</title>
-          <truncate type="int">0</truncate>
-          <unicode type="int">0</unicode>
-          <whitespace_preserve type="int">0</whitespace_preserve>
-        </values>
-        <tales>
-        </tales>
-        <messages>
-          <message name="external_validator_failed">The input failed the external validator.</message>
-          <message name="required_not_found">Input is required but no input given.</message>
-          <message name="too_long">Too much input was given.</message>
-          <message name="not_link">The specified link is broken.</message>
-        </messages>
-      </field>
-      <field><id>demourl</id> <type>LinkField</type>
-        <values>
-          <alternate_name/>
-          <check_link type="int">0</check_link>
-          <check_timeout type="float">7.0</check_timeout>
-          <check_timeout>7.0</check_timeout>
-          <css_class/>
-          <default/>
-          <description>URL with software product demo</description>
-          <display_maxwidth/>
-          <display_width type="int">20</display_width>
-          <enabled type="int">1</enabled>
-          <external_validator/>
-          <extra/>
-          <hidden type="int">0</hidden>
-          <link_type>external</link_type>
-          <max_length/>
-          <required type="int">0</required>
-          <title>Demo URL</title>
-          <truncate type="int">0</truncate>
-          <unicode type="int">0</unicode>
-          <whitespace_preserve type="int">0</whitespace_preserve>
-        </values>
-        <tales>
-        </tales>
-        <messages>
-          <message name="external_validator_failed">The input failed the external validator.</message>
-          <message name="required_not_found">Input is required but no input given.</message>
-          <message name="too_long">Too much input was given.</message>
-          <message name="not_link">The specified link is broken.</message>
-        </messages>
-      </field>
-      <field><id>cms</id> <type>LinkField</type>
-        <values>
-          <alternate_name/>
-          <check_link type="int">0</check_link>
-          <check_timeout type="float">7.0</check_timeout>
-          <check_timeout>7.0</check_timeout>
-          <css_class/>
-          <default/>
-          <description>Control management systems supported by the product</description>
-          <display_maxwidth/>
-          <display_width type="int">20</display_width>
-          <enabled type="int">1</enabled>
-          <external_validator/>
-          <extra/>
-          <hidden type="int">0</hidden>
-          <link_type>external</link_type>
-          <max_length/>
-          <required type="int">0</required>
-          <title>CMS</title>
-          <truncate type="int">0</truncate>
-          <unicode type="int">0</unicode>
-          <whitespace_preserve type="int">0</whitespace_preserve>
-        </values>
-        <tales>
-        </tales>
-        <messages>
-          <message name="external_validator_failed">The input failed the external validator.</message>
-          <message name="required_not_found">Input is required but no input given.</message>
-          <message name="too_long">Too much input was given.</message>
-          <message name="not_link">The specified link is broken.</message>
-        </messages>
-      </field>
-      <field><id>softwaredate</id> <type>DateTimeField</type>
-        <values>
-          <allow_empty_time type="int">1</allow_empty_time>
-          <alternate_name/>
-          <ampm_time_style type="int">0</ampm_time_style>
-          <css_class/>
-          <date_only type="int">0</date_only>
-          <date_separator>/</date_separator>
-          <default_now type="int">0</default_now>
-          <description>The date of product release</description>
-          <enabled type="int">1</enabled>
-          <external_validator/>
-          <hidden type="int">0</hidden>
-          <hide_day type="int">0</hide_day>
-          <input_order>ymd</input_order>
-          <input_style>list</input_style>
-          <required type="int">0</required>
-          <time_separator>:</time_separator>
-          <title>Release Date</title>
-        </values>
-        <tales>
-        </tales>
-        <messages>
-          <message name="external_validator_failed">The input failed the external validator.</message>
-          <message name="required_not_found">Input is required but no input given.</message>
-          <message name="not_datetime">You did not enter a valid date and time.</message>
-          <message name="datetime_out_of_range">The date and time you entered were out of range.</message>
-        </messages>
-      </field>
-      <field><id>platforms</id> <type>StringField</type>
-        <values>
-          <alternate_name/>
-          <css_class/>
-          <default/>
-          <description>Choose OS platform, supported with the product</description>
-          <display_maxwidth/>
-          <display_width type="int">20</display_width>
-          <enabled type="int">1</enabled>
-          <external_validator/>
-          <extra/>
-          <hidden type="int">0</hidden>
-          <max_length/>
-          <required type="int">0</required>
-          <title>Platforms</title>
-          <truncate type="int">0</truncate>
-          <unicode type="int">0</unicode>
-          <whitespace_preserve type="int">0</whitespace_preserve>
-        </values>
-        <tales>
-        </tales>
-        <messages>
-          <message name="external_validator_failed">The input failed the external validator.</message>
-          <message name="required_not_found">Input is required but no input given.</message>
-          <message name="too_long">Too much input was given.</message>
-        </messages>
-      </field>
-      </fields>
-    </group>
-  </groups>
-</form>
-</metadata>
Index: /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/tests/test_import.cfg
===================================================================
--- /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/tests/test_import.cfg	(revision 328)
+++ /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/tests/test_import.cfg	(revision 329)
@@ -8,7 +8,4 @@
     demarshaller
     referencesimporter
-    propertiesimporter
-    commentsimporter
-    IMPORTING
 include = quintagroup.transmogrifier:import.cfg
 
Index: /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/tests/test_import.py
===================================================================
--- /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/tests/test_import.py	(revision 328)
+++ /quintagroup.transmogrifier.pfm2pfg/trunk/quintagroup/transmogrifier/pfm2pfg/tests/test_import.py	(revision 329)
@@ -3,4 +3,5 @@
 
 from zope.interface import classProvides, implements
+import transaction
 
 from Products.Five import zcml
@@ -24,9 +25,9 @@
             yield item
 
-        fname = os.path.join(os.path.dirname(__file__), 'post-software.xml')
+        fname = os.path.join(os.path.dirname(__file__), 'complex_form.xml')
         xml = file(fname).read()
         item = dict(
             _type='PloneFormMailer',
-            _path='post-software',
+            _path='complex-form',
             _files=dict(
                 marshall=dict(
@@ -38,4 +39,18 @@
         yield item
 
+        fname = os.path.join(os.path.dirname(__file__), 'fieldset_form.xml')
+        xml = file(fname).read()
+        item = dict(
+            _type='PloneFormMailer',
+            _path='fieldset-form',
+            _files=dict(
+                marshall=dict(
+                    name='.marshall.xml',
+                    data=xml
+                )
+            )
+        )
+        yield item
+
 ztc.installProduct('PloneFormGen')
 
@@ -57,11 +72,15 @@
 
     def afterSetUp(self):
-        # run transmogrifier pipeline
-        transmogrifier = ITransmogrifier(self.portal)
-        transmogrifier('test_import')
+        if 'complex-form' not in self.portal:
+            # run transmogrifier pipeline
+            transmogrifier = ITransmogrifier(self.portal)
+            transmogrifier('test_import')
+
+    def beforeTearDown(self):
+        transaction.commit()
 
     def test_form_folder(self):
-        self.failUnless('post-software' in self.portal)
-        form = self.portal['post-software']
+        self.failUnless('complex-form' in self.portal)
+        form = self.portal['complex-form']
 
         self.assertEqual(form['title'], 'Publish new content management product or module')
@@ -72,8 +91,7 @@
 
     def test_mailer(self):
-        form = self.portal['post-software']
+        form = self.portal['complex-form']
         self.failUnless('mailer' in form)
         mailer = form['mailer']
-        #import pdb; pdb.set_trace()
 
         self.assertEqual(mailer['subjectOverride'], 'string:Update Software')
@@ -85,5 +103,5 @@
 
     def test_thanks_page(self):
-        form = self.portal['post-software']
+        form = self.portal['complex-form']
         self.failUnless('thank-you' in form)
         page = form['thank-you']
@@ -96,16 +114,299 @@
         self.assertEqual(page.modified(), form.modified())
 
-    def test_fields(self):
-        form = self.portal['post-software']
-        fields = ['fullname', 'email', 'softwaretitle', 'softwaredescription',
-            'softwaresummary', 'version', 'devstage', 'license', 'supportcms',
-            'developed', 'downloadurl', 'softwareurl', 'demourl', 'cms',
-            'softwaredate', 'platforms']
-        for i in fields:
-            self.failUnless(i in form)
-
-    #def test_able_to_add_document(self):
-        #new_id = self.folder.invokeFactory('Document', 'my-page')
-        #self.assertEquals('my-page', new_id)
+    def test_string_field(self):
+        form = self.portal['complex-form']
+        self.failIf('field1' not in form)
+        field = form['field1']
+
+        self.assertEqual(field.getPortalTypeName(), 'FormStringField')
+        self.assertEqual(field['title'], 'String field')
+        self.assertEqual(field.Description(), 'field description')
+        self.assertEqual(field['required'], True)
+        self.assertEqual(field['hidden'], False)
+        self.assertEqual(field['fgDefault'], '')
+        self.assertEqual(field['fgmaxlength'], 255)
+        self.assertEqual(field['fgsize'], 20)
+
+        self.assertEqual(field.created(), form.created())
+        self.assertEqual(field.modified(), form.modified())
+
+    def test_email_field(self):
+        form = self.portal['complex-form']
+        self.failIf('field2' not in form)
+        field = form['field2']
+
+        self.assertEqual(field.getPortalTypeName(), 'FormStringField')
+        self.assertEqual(field['title'], 'Email field')
+        self.assertEqual(field.Description(), '')
+        self.assertEqual(field['required'], True)
+        self.assertEqual(field['hidden'], False)
+        self.assertEqual(field['fgDefault'], 'test@mail.com')
+        self.assertEqual(field['fgmaxlength'], 255)
+        self.assertEqual(field['fgsize'], 20)
+        self.assertEqual(field['fgStringValidator'], 'isEmail')
+
+        self.assertEqual(field.created(), form.created())
+        self.assertEqual(field.modified(), form.modified())
+
+    def test_link_field(self):
+        form = self.portal['complex-form']
+        self.failIf('field3' not in form)
+        field = form['field3']
+
+        self.assertEqual(field.getPortalTypeName(), 'FormStringField')
+        self.assertEqual(field['title'], 'Link field')
+        self.assertEqual(field.Description(), '')
+        self.assertEqual(field['required'], False)
+        self.assertEqual(field['hidden'], False)
+        self.assertEqual(field['fgDefault'], '')
+        self.assertEqual(field['fgmaxlength'], 15)
+        self.assertEqual(field['fgsize'], 20)
+        self.assertEqual(field['fgStringValidator'], 'isURL')
+
+        self.assertEqual(field.created(), form.created())
+        self.assertEqual(field.modified(), form.modified())
+
+    def test_pattern_field(self):
+        form = self.portal['complex-form']
+        self.failIf('field4' not in form)
+        field = form['field4']
+
+        self.assertEqual(field.getPortalTypeName(), 'FormStringField')
+        self.assertEqual(field['title'], 'Pattern field')
+        self.assertEqual(field.Description(), '')
+        self.assertEqual(field['required'], True)
+        self.assertEqual(field['hidden'], True)
+        self.assertEqual(field['fgDefault'], '')
+        self.assertEqual(field['fgmaxlength'], 255)
+        self.assertEqual(field['fgsize'], 20)
+
+        self.assertEqual(field.created(), form.created())
+        self.assertEqual(field.modified(), form.modified())
+
+    def test_textarea_field(self):
+        form = self.portal['complex-form']
+        self.failIf('field5' not in form)
+        field = form['field5']
+
+        self.assertEqual(field.getPortalTypeName(), 'FormTextField')
+        self.assertEqual(field['title'], 'Text area field')
+        self.assertEqual(field.Description(), '')
+        self.assertEqual(field['required'], True)
+        self.assertEqual(field['hidden'], False)
+        self.assertEqual(field.getFgDefault(), '')
+        self.assertEqual(field['fgmaxlength'], 1000)
+        self.assertEqual(field['fgRows'], 5)
+
+        self.assertEqual(field.created(), form.created())
+        self.assertEqual(field.modified(), form.modified())
+
+    def test_rawtextarea_field(self):
+        form = self.portal['complex-form']
+        self.failIf('field6' not in form)
+        field = form['field6']
+
+        self.assertEqual(field.getPortalTypeName(), 'FormTextField')
+        self.assertEqual(field['title'], 'Raw text area field')
+        self.assertEqual(field.Description(), '')
+        self.assertEqual(field['required'], True)
+        self.assertEqual(field['hidden'], False)
+        self.assertEqual(field.getFgDefault(), '')
+        self.assertEqual(field['fgmaxlength'], '0')
+        self.assertEqual(field['fgRows'], 5)
+
+        self.assertEqual(field.created(), form.created())
+        self.assertEqual(field.modified(), form.modified())
+
+    def test_password_field(self):
+        form = self.portal['complex-form']
+        self.failIf('field7' not in form)
+        field = form['field7']
+
+        self.assertEqual(field.getPortalTypeName(), 'FormPasswordField')
+        self.assertEqual(field['title'], 'Password field')
+        self.assertEqual(field.Description(), '')
+        self.assertEqual(field['required'], True)
+        self.assertEqual(field['fgDefault'], '')
+        self.assertEqual(field['fgmaxlength'], 255)
+        self.assertEqual(field['fgsize'], 20)
+
+        self.assertEqual(field.created(), form.created())
+        self.assertEqual(field.modified(), form.modified())
+
+    def test_label_field(self):
+        form = self.portal['complex-form']
+        self.failIf('field8' not in form)
+        field = form['field8']
+
+        self.assertEqual(field.getPortalTypeName(), 'FormRichLabelField')
+        self.assertEqual(field['title'], 'Label field')
+        self.assertEqual(field.Description(), '')
+        self.assertEqual(field['fgDefault'], 'label text')
+
+        self.assertEqual(field.created(), form.created())
+        self.assertEqual(field.modified(), form.modified())
+
+    def test_integer_field(self):
+        form = self.portal['complex-form']
+        self.failIf('field9' not in form)
+        field = form['field9']
+
+        self.assertEqual(field.getPortalTypeName(), 'FormIntegerField')
+        self.assertEqual(field['title'], 'Integer field')
+        self.assertEqual(field.Description(), '')
+        self.assertEqual(field['required'], True)
+        self.assertEqual(field['fgDefault'], '55')
+        self.assertEqual(field['fgmaxlength'], 40)
+        self.assertEqual(field['fgsize'], 20)
+        self.assertEqual(field['minval'], 10)
+        self.assertEqual(field['maxval'], 1000)
+
+        self.assertEqual(field.created(), form.created())
+        self.assertEqual(field.modified(), form.modified())
+
+    def test_float_field(self):
+        form = self.portal['complex-form']
+        self.failIf('field10' not in form)
+        field = form['field10']
+
+        self.assertEqual(field.getPortalTypeName(), 'FormFixedPointField')
+        self.assertEqual(field['title'], 'Float field')
+        self.assertEqual(field.Description(), '')
+        self.assertEqual(field['required'], True)
+        self.assertEqual(field['fgDefault'], '')
+        self.assertEqual(field['fgmaxlength'], 10)
+        self.assertEqual(field['fgsize'], 20)
+
+        self.assertEqual(field.created(), form.created())
+        self.assertEqual(field.modified(), form.modified())
+
+    def test_datetime_field(self):
+        form = self.portal['complex-form']
+        self.failIf('field11' not in form)
+        field = form['field11']
+
+        self.assertEqual(field.getPortalTypeName(), 'FormDateField')
+        self.assertEqual(field['title'], 'Date time field')
+        self.assertEqual(field.Description(), '')
+        self.assertEqual(field['required'], True)
+        self.assertEqual(field['fgDefault'], '2008/10/10 10:10:00 GMT+3')
+        self.assertEqual(field['fgStartingYear'], 2006)
+        self.assertEqual(field['fgEndingYear'], 2010)
+
+        self.assertEqual(field.created(), form.created())
+        self.assertEqual(field.modified(), form.modified())
+
+    def test_file_field(self):
+        form = self.portal['complex-form']
+        self.failIf('field12' not in form)
+        field = form['field12']
+
+        self.assertEqual(field.getPortalTypeName(), 'FormFileField')
+        self.assertEqual(field['title'], 'File field')
+        self.assertEqual(field.Description(), '')
+
+        self.assertEqual(field.created(), form.created())
+        self.assertEqual(field.modified(), form.modified())
+
+    def test_lines_field(self):
+        form = self.portal['complex-form']
+        self.failIf('field13' not in form)
+        field = form['field13']
+
+        self.assertEqual(field.getPortalTypeName(), 'FormLinesField')
+        self.assertEqual(field['title'], 'Lines field')
+        self.assertEqual(field.Description(), '')
+        self.assertEqual(field['required'], True)
+        self.assertEqual(field['fgDefault'], ('first', 'second', 'third'))
+        self.assertEqual(field['fgRows'], 5)
+
+        self.assertEqual(field.created(), form.created())
+        self.assertEqual(field.modified(), form.modified())
+
+    def test_checkbox_field(self):
+        form = self.portal['complex-form']
+        self.failIf('field14' not in form)
+        field = form['field14']
+
+        self.assertEqual(field.getPortalTypeName(), 'FormBooleanField')
+        self.assertEqual(field['title'], 'Checkbox field')
+        self.assertEqual(field.Description(), '')
+        self.assertEqual(field['fgDefault'], True)
+
+        self.assertEqual(field.created(), form.created())
+        self.assertEqual(field.modified(), form.modified())
+
+    def test_list_field(self):
+        form = self.portal['complex-form']
+        self.failIf('field15' not in form)
+        field = form['field15']
+
+        self.assertEqual(field.getPortalTypeName(), 'FormSelectionField')
+        self.assertEqual(field['title'], 'List field')
+        self.assertEqual(field.Description(), '')
+        self.assertEqual(field['fgDefault'], 'first')
+        self.assertEqual(field['fgVocabulary'], ('first|First', 'second|Second', 'third|Third'))
+        self.assertEqual(field['fgFormat'], 'select')
+
+        self.assertEqual(field.created(), form.created())
+        self.assertEqual(field.modified(), form.modified())
+
+    def test_radio_field(self):
+        form = self.portal['complex-form']
+        self.failIf('field16' not in form)
+        field = form['field16']
+
+        self.assertEqual(field.getPortalTypeName(), 'FormSelectionField')
+        self.assertEqual(field['title'], 'Radio field')
+        self.assertEqual(field.Description(), '')
+        self.assertEqual(field['fgDefault'], 'first')
+        self.assertEqual(field['fgVocabulary'], ('first|First', 'second|Second', 'third|Third'))
+        self.assertEqual(field['fgFormat'], 'radio')
+
+        self.assertEqual(field.created(), form.created())
+        self.assertEqual(field.modified(), form.modified())
+
+    def test_multilist_field(self):
+        form = self.portal['complex-form']
+        self.failIf('field17' not in form)
+        field = form['field17']
+
+        self.assertEqual(field.getPortalTypeName(), 'FormMultiSelectionField')
+        self.assertEqual(field['title'], 'Multi list field')
+        self.assertEqual(field.Description(), '')
+        self.assertEqual(field['required'], True)
+        self.assertEqual(field['fgDefault'], ('first', 'third'))
+        self.assertEqual(field['fgVocabulary'], ('first|First', 'second|Second', 'third|Third'))
+        self.assertEqual(field['fgFormat'], 'select')
+        self.assertEqual(field['fgRows'], 5)
+
+        self.assertEqual(field.created(), form.created())
+        self.assertEqual(field.modified(), form.modified())
+
+    def test_multicheckbox_field(self):
+        form = self.portal['complex-form']
+        self.failIf('field18' not in form)
+        field = form['field18']
+
+        self.assertEqual(field.getPortalTypeName(), 'FormMultiSelectionField')
+        self.assertEqual(field['title'], 'Multi checkbox field')
+        self.assertEqual(field.Description(), '')
+        self.assertEqual(field['required'], True)
+        self.assertEqual(field['fgDefault'], ('first', 'third'))
+        self.assertEqual(field['fgVocabulary'], ('first|First', 'second|Second', 'third|Third'))
+        self.assertEqual(field['fgFormat'], 'checkbox')
+
+        self.assertEqual(field.created(), form.created())
+        self.assertEqual(field.modified(), form.modified())
+
+    def test_fieldset(self):
+        self.failIf('fieldset-form' not in self.portal)
+        form = self.portal['fieldset-form']
+        self.assertEqual(form.objectIds(), ['mailer', 'thank-you', 'checkbox', 'datetime', 'Other'])
+
+        fieldset = form['Other']
+        self.assertEqual(fieldset['title'], 'Other')
+        self.assertEqual(fieldset.objectIds(), ['email', 'float', 'string'])
+
 
 def test_suite():
