Plomino debug
=========================

    >>> from Products.Five.testbrowser import Browser
    >>> browser = Browser()
    
    >>> self.setRoles(['Manager'])
    >>> id=self.folder.invokeFactory('PlominoDatabase', id='mydb')
    >>> db=self.folder.mydb
    >>> db.at_post_create_script()
    >>> id=db.invokeFactory('PlominoForm', id='frm1', Title='Form 1')
    >>> id
    'frm1'
    >>> id=db.invokeFactory('PlominoForm', id='frm2', Title='Form 2')
    >>> id=db.invokeFactory('PlominoForm', id='frm3', Title='Search Form')
    >>> id=db.invokeFactory('PlominoView', id='view1', Title='View 1')
    >>> id
    'view1'
    >>> id=db.invokeFactory('PlominoView', id='view2', Title='View 2')
    >>> id=db.invokeFactory('PlominoAgent', id='agent1', Title='Agent 1')
    >>> self.folder.mydb.frm1 == self.folder.mydb.getForm('frm1')
    True
    >>> self.folder.mydb.view1 == self.folder.mydb.getView('view1')
    True
    >>> doc=self.folder.mydb.createDocument()
    >>> docid=doc.id
    >>> doc.setItem('Form', 'frm1')
    >>> doc.save()
    >>> doc.getPortalTypeName()=='PlominoDocument'
    True
    >>> db.getDocument(docid)==doc
    True
    >>> doc1=db.createDocument()
    >>> doc.setItem('Form', 'frm1')
    >>> doc.save()
    >>> doc2=db.createDocument()
    >>> doc2.setItem('Form', 'frm2')
    >>> doc2.save()
    >>> doc3=db.createDocument()
    >>> doc3.setItem('Form', 'frm1')
    >>> doc3.save()
    >>> db.frm1.setOnCreateDocument("""
    ... d=plominoDocument.yo
    ... if d=="bli":
    ...    plominoDocument.setItem("didi", "<b>dd</b>")
    ... else:
    ...    pass  
    ... """)
    >>> id=db.frm1.invokeFactory('PlominoField', id='field1', Title='field1', FieldType="TEXT", FieldMode="EDITABLE")
    >>> id=db.frm1.invokeFactory('PlominoField', id='field2', Title='field2', FieldType="TEXT", FieldMode="COMPUTED", Formula="'My favorite song is '+plominoDocument.field1")
    >>> db.frm1.setFormLayout("""<p>please enter a value for field1: <span class="plominoFieldClass">field1</span></p><p>Comment: <span class="plominoFieldClass">field2</span></p>""")
    >>> db.exportDesignAsXML()
    '<?xml version="1.0" ?><plominodatabase id="mydb"><design><element id="frm1" title="" type="PlominoForm"><id type="Products.Archetypes.Field.StringField">frm1</id><onCreateDocument type="Products.Archetypes.Field.TextField"><![CDATA[\nd=plominoDocument.yo\nif d=="bli":\n   plominoDocument.setItem("didi", "<b>dd</b>")\nelse:\n   pass  \n]]></onCreateDocument><onOpenDocument type="Products.Archetypes.Field.TextField"><![CDATA[]]></onOpenDocument><onSaveDocument type="Products.Archetypes.Field.TextField"><![CDATA[]]></onSaveDocument><FormLayout type="Products.Archetypes.Field.TextField"><![CDATA[<p>please enter a value for field1: <span class="plominoFieldClass">field1</span></p><p>Comment: <span class="plominoFieldClass">field2</span></p>]]></FormLayout><DocumentTitle type="Products.Archetypes.Field.TextField"><![CDATA[]]></DocumentTitle><ActionBarPosition type="Products.Archetypes.Field.StringField">TOP</ActionBarPosition><HideInMenu type="Products.Archetypes.Field.BooleanField">False</HideInMenu><isSearchForm type="Products.Archetypes.Field.BooleanField">False</isSearchForm><SearchView type="Products.Archetypes.Field.StringField"></SearchView><SearchFormula type="Products.Archetypes.Field.TextField"><![CDATA[]]></SearchFormula><Position type="Products.Archetypes.Field.IntegerField"/><elements><element id="field1" title="" type="PlominoField"><id type="Products.Archetypes.Field.StringField">field1</id><FieldType type="Products.Archetypes.Field.StringField">TEXT</FieldType><FieldMode type="Products.Archetypes.Field.StringField">EDITABLE</FieldMode><Formula type="Products.Archetypes.Field.TextField"><![CDATA[]]></Formula><SelectionList type="Products.Archetypes.Field.LinesField">()</SelectionList><SelectionListFormula type="Products.Archetypes.Field.TextField"><![CDATA[]]></SelectionListFormula><Mandatory type="Products.Archetypes.Field.BooleanField">False</Mandatory><ValidationFormula type="Products.Archetypes.Field.TextField"><![CDATA[]]></ValidationFormula><ToBeIndexed type="Products.Archetypes.Field.BooleanField">False</ToBeIndexed><SelectInView type="Products.Archetypes.Field.StringField"></SelectInView><DisplayModList type="Products.Archetypes.Field.StringField">&lt;br/&gt;</DisplayModList><OtherDisplayMod type="Products.Archetypes.Field.StringField"></OtherDisplayMod></element><element id="field2" title="" type="PlominoField"><id type="Products.Archetypes.Field.StringField">field2</id><FieldType type="Products.Archetypes.Field.StringField">TEXT</FieldType><FieldMode type="Products.Archetypes.Field.StringField">COMPUTED</FieldMode><Formula type="Products.Archetypes.Field.TextField"><![CDATA[\'My favorite song is \'+plominoDocument.field1]]></Formula><SelectionList type="Products.Archetypes.Field.LinesField">()</SelectionList><SelectionListFormula type="Products.Archetypes.Field.TextField"><![CDATA[]]></SelectionListFormula><Mandatory type="Products.Archetypes.Field.BooleanField">False</Mandatory><ValidationFormula type="Products.Archetypes.Field.TextField"><![CDATA[]]></ValidationFormula><ToBeIndexed type="Products.Archetypes.Field.BooleanField">False</ToBeIndexed><SelectInView type="Products.Archetypes.Field.StringField"></SelectInView><DisplayModList type="Products.Archetypes.Field.StringField">&lt;br/&gt;</DisplayModList><OtherDisplayMod type="Products.Archetypes.Field.StringField"></OtherDisplayMod></element></elements></element><element id="frm2" title="" type="PlominoForm"><id type="Products.Archetypes.Field.StringField">frm2</id><onCreateDocument type="Products.Archetypes.Field.TextField"><![CDATA[]]></onCreateDocument><onOpenDocument type="Products.Archetypes.Field.TextField"><![CDATA[]]></onOpenDocument><onSaveDocument type="Products.Archetypes.Field.TextField"><![CDATA[]]></onSaveDocument><FormLayout type="Products.Archetypes.Field.TextField"><![CDATA[]]></FormLayout><DocumentTitle type="Products.Archetypes.Field.TextField"><![CDATA[]]></DocumentTitle><ActionBarPosition type="Products.Archetypes.Field.StringField">TOP</ActionBarPosition><HideInMenu type="Products.Archetypes.Field.BooleanField">False</HideInMenu><isSearchForm type="Products.Archetypes.Field.BooleanField">False</isSearchForm><SearchView type="Products.Archetypes.Field.StringField"></SearchView><SearchFormula type="Products.Archetypes.Field.TextField"><![CDATA[]]></SearchFormula><Position type="Products.Archetypes.Field.IntegerField"/></element><element id="frm3" title="" type="PlominoForm"><id type="Products.Archetypes.Field.StringField">frm3</id><onCreateDocument type="Products.Archetypes.Field.TextField"><![CDATA[]]></onCreateDocument><onOpenDocument type="Products.Archetypes.Field.TextField"><![CDATA[]]></onOpenDocument><onSaveDocument type="Products.Archetypes.Field.TextField"><![CDATA[]]></onSaveDocument><FormLayout type="Products.Archetypes.Field.TextField"><![CDATA[]]></FormLayout><DocumentTitle type="Products.Archetypes.Field.TextField"><![CDATA[]]></DocumentTitle><ActionBarPosition type="Products.Archetypes.Field.StringField">TOP</ActionBarPosition><HideInMenu type="Products.Archetypes.Field.BooleanField">False</HideInMenu><isSearchForm type="Products.Archetypes.Field.BooleanField">False</isSearchForm><SearchView type="Products.Archetypes.Field.StringField"></SearchView><SearchFormula type="Products.Archetypes.Field.TextField"><![CDATA[]]></SearchFormula><Position type="Products.Archetypes.Field.IntegerField"/></element><element id="view1" title="" type="PlominoView"><id type="Products.Archetypes.Field.StringField">view1</id><SelectionFormula type="Products.Archetypes.Field.TextField"><![CDATA[]]></SelectionFormula><SortColumn type="Products.Archetypes.Field.StringField"></SortColumn><Categorized type="Products.Archetypes.Field.BooleanField">False</Categorized><FormFormula type="Products.Archetypes.Field.TextField"><![CDATA[]]></FormFormula><ReverseSorting type="Products.Archetypes.Field.BooleanField">False</ReverseSorting><ActionBarPosition type="Products.Archetypes.Field.StringField">TOP</ActionBarPosition><HideInMenu type="Products.Archetypes.Field.BooleanField">False</HideInMenu><ViewTemplate type="Products.Archetypes.Field.StringField"></ViewTemplate><Position type="Products.Archetypes.Field.IntegerField"/></element><element id="view2" title="" type="PlominoView"><id type="Products.Archetypes.Field.StringField">view2</id><SelectionFormula type="Products.Archetypes.Field.TextField"><![CDATA[]]></SelectionFormula><SortColumn type="Products.Archetypes.Field.StringField"></SortColumn><Categorized type="Products.Archetypes.Field.BooleanField">False</Categorized><FormFormula type="Products.Archetypes.Field.TextField"><![CDATA[]]></FormFormula><ReverseSorting type="Products.Archetypes.Field.BooleanField">False</ReverseSorting><ActionBarPosition type="Products.Archetypes.Field.StringField">TOP</ActionBarPosition><HideInMenu type="Products.Archetypes.Field.BooleanField">False</HideInMenu><ViewTemplate type="Products.Archetypes.Field.StringField"></ViewTemplate><Position type="Products.Archetypes.Field.IntegerField"/></element><element id="agent1" title="" type="PlominoAgent"><id type="Products.Archetypes.Field.StringField">agent1</id><Content type="Products.Archetypes.Field.TextField"><![CDATA[]]></Content><Scheduled type="Products.Archetypes.Field.BooleanField">False</Scheduled><AgentUser type="Products.Archetypes.Field.StringField"></AgentUser><Cron type="Products.Archetypes.Field.StringField">* 1 * * *</Cron></element></design></plominodatabase>'
    >>> xml = '<?xml version="1.0" ?><plominodatabase id="mydb"><design><element id="frm1" title="" type="PlominoForm"><id type="Products.Archetypes.Field.StringField">frm1</id><onCreateDocument type="Products.Archetypes.Field.TextField"><![CDATA[\nd=plominoDocument.yo\nif d=="bli":\n   plominoDocument.setItem("didi", "<b>dd</b>")\nelse:\n   pass  \n]]></onCreateDocument><onOpenDocument type="Products.Archetypes.Field.TextField"><![CDATA[]]></onOpenDocument><onSaveDocument type="Products.Archetypes.Field.TextField"><![CDATA[]]></onSaveDocument><FormLayout type="Products.Archetypes.Field.TextField"><![CDATA[<p>please enter a value for field1: <span class="plominoFieldClass">field1</span></p><p>Comment: <span class="plominoFieldClass">field2</span></p>]]></FormLayout><DocumentTitle type="Products.Archetypes.Field.TextField"><![CDATA[]]></DocumentTitle><ActionBarPosition type="Products.Archetypes.Field.StringField">TOP</ActionBarPosition><HideInMenu type="Products.Archetypes.Field.BooleanField">False</HideInMenu><isSearchForm type="Products.Archetypes.Field.BooleanField">False</isSearchForm><SearchView type="Products.Archetypes.Field.StringField"></SearchView><SearchFormula type="Products.Archetypes.Field.TextField"><![CDATA[]]></SearchFormula><Position type="Products.Archetypes.Field.IntegerField"/><elements><element id="field1" title="" type="PlominoField"><id type="Products.Archetypes.Field.StringField">field1</id><FieldType type="Products.Archetypes.Field.StringField">TEXT</FieldType><FieldMode type="Products.Archetypes.Field.StringField">EDITABLE</FieldMode><Formula type="Products.Archetypes.Field.TextField"><![CDATA[]]></Formula><SelectionList type="Products.Archetypes.Field.LinesField">()</SelectionList><SelectionListFormula type="Products.Archetypes.Field.TextField"><![CDATA[]]></SelectionListFormula><Mandatory type="Products.Archetypes.Field.BooleanField">False</Mandatory><ValidationFormula type="Products.Archetypes.Field.TextField"><![CDATA[]]></ValidationFormula><ToBeIndexed type="Products.Archetypes.Field.BooleanField">False</ToBeIndexed><SelectInView type="Products.Archetypes.Field.StringField"></SelectInView><DisplayModList type="Products.Archetypes.Field.StringField">&lt;br/&gt;</DisplayModList><OtherDisplayMod type="Products.Archetypes.Field.StringField"></OtherDisplayMod></element><element id="field5" title="" type="PlominoField"><id type="Products.Archetypes.Field.StringField">field5</id><FieldType type="Products.Archetypes.Field.StringField">TEXT</FieldType><FieldMode type="Products.Archetypes.Field.StringField">EDITABLE</FieldMode><Formula type="Products.Archetypes.Field.TextField"><![CDATA[]]></Formula><SelectionList type="Products.Archetypes.Field.LinesField">()</SelectionList><SelectionListFormula type="Products.Archetypes.Field.TextField"><![CDATA[]]></SelectionListFormula><Mandatory type="Products.Archetypes.Field.BooleanField">False</Mandatory><ValidationFormula type="Products.Archetypes.Field.TextField"><![CDATA[]]></ValidationFormula><ToBeIndexed type="Products.Archetypes.Field.BooleanField">False</ToBeIndexed><SelectInView type="Products.Archetypes.Field.StringField"></SelectInView><DisplayModList type="Products.Archetypes.Field.StringField">&lt;br/&gt;</DisplayModList><OtherDisplayMod type="Products.Archetypes.Field.StringField"></OtherDisplayMod></element><element id="field2" title="" type="PlominoField"><id type="Products.Archetypes.Field.StringField">field2</id><FieldType type="Products.Archetypes.Field.StringField">TEXT</FieldType><FieldMode type="Products.Archetypes.Field.StringField">COMPUTED</FieldMode><Formula type="Products.Archetypes.Field.TextField"><![CDATA[\'My favorite song is \'+plominoDocument.field1]]></Formula><SelectionList type="Products.Archetypes.Field.LinesField">()</SelectionList><SelectionListFormula type="Products.Archetypes.Field.TextField"><![CDATA[]]></SelectionListFormula><Mandatory type="Products.Archetypes.Field.BooleanField">False</Mandatory><ValidationFormula type="Products.Archetypes.Field.TextField"><![CDATA[]]></ValidationFormula><ToBeIndexed type="Products.Archetypes.Field.BooleanField">False</ToBeIndexed><SelectInView type="Products.Archetypes.Field.StringField"></SelectInView><DisplayModList type="Products.Archetypes.Field.StringField">&lt;br/&gt;</DisplayModList><OtherDisplayMod type="Products.Archetypes.Field.StringField"></OtherDisplayMod></element></elements></element><element id="frm2" title="" type="PlominoForm"><id type="Products.Archetypes.Field.StringField">frm2</id><onCreateDocument type="Products.Archetypes.Field.TextField"><![CDATA[]]></onCreateDocument><onOpenDocument type="Products.Archetypes.Field.TextField"><![CDATA[]]></onOpenDocument><onSaveDocument type="Products.Archetypes.Field.TextField"><![CDATA[]]></onSaveDocument><FormLayout type="Products.Archetypes.Field.TextField"><![CDATA[]]></FormLayout><DocumentTitle type="Products.Archetypes.Field.TextField"><![CDATA[]]></DocumentTitle><ActionBarPosition type="Products.Archetypes.Field.StringField">TOP</ActionBarPosition><HideInMenu type="Products.Archetypes.Field.BooleanField">False</HideInMenu><isSearchForm type="Products.Archetypes.Field.BooleanField">False</isSearchForm><SearchView type="Products.Archetypes.Field.StringField"></SearchView><SearchFormula type="Products.Archetypes.Field.TextField"><![CDATA[]]></SearchFormula><Position type="Products.Archetypes.Field.IntegerField"/></element><element id="frm3" title="" type="PlominoForm"><id type="Products.Archetypes.Field.StringField">frm3</id><onCreateDocument type="Products.Archetypes.Field.TextField"><![CDATA[]]></onCreateDocument><onOpenDocument type="Products.Archetypes.Field.TextField"><![CDATA[]]></onOpenDocument><onSaveDocument type="Products.Archetypes.Field.TextField"><![CDATA[]]></onSaveDocument><FormLayout type="Products.Archetypes.Field.TextField"><![CDATA[]]></FormLayout><DocumentTitle type="Products.Archetypes.Field.TextField"><![CDATA[]]></DocumentTitle><ActionBarPosition type="Products.Archetypes.Field.StringField">TOP</ActionBarPosition><HideInMenu type="Products.Archetypes.Field.BooleanField">False</HideInMenu><isSearchForm type="Products.Archetypes.Field.BooleanField">False</isSearchForm><SearchView type="Products.Archetypes.Field.StringField"></SearchView><SearchFormula type="Products.Archetypes.Field.TextField"><![CDATA[]]></SearchFormula><Position type="Products.Archetypes.Field.IntegerField"/></element><element id="view1" title="" type="PlominoView"><id type="Products.Archetypes.Field.StringField">view1</id><SelectionFormula type="Products.Archetypes.Field.TextField"><![CDATA[]]></SelectionFormula><SortColumn type="Products.Archetypes.Field.StringField"></SortColumn><Categorized type="Products.Archetypes.Field.BooleanField">False</Categorized><FormFormula type="Products.Archetypes.Field.TextField"><![CDATA[]]></FormFormula><ReverseSorting type="Products.Archetypes.Field.BooleanField">False</ReverseSorting><ActionBarPosition type="Products.Archetypes.Field.StringField">TOP</ActionBarPosition><HideInMenu type="Products.Archetypes.Field.BooleanField">False</HideInMenu><ViewTemplate type="Products.Archetypes.Field.StringField"></ViewTemplate><Position type="Products.Archetypes.Field.IntegerField"/></element><element id="view2" title="" type="PlominoView"><id type="Products.Archetypes.Field.StringField">view2</id><SelectionFormula type="Products.Archetypes.Field.TextField"><![CDATA[]]></SelectionFormula><SortColumn type="Products.Archetypes.Field.StringField"></SortColumn><Categorized type="Products.Archetypes.Field.BooleanField">False</Categorized><FormFormula type="Products.Archetypes.Field.TextField"><![CDATA[]]></FormFormula><ReverseSorting type="Products.Archetypes.Field.BooleanField">False</ReverseSorting><ActionBarPosition type="Products.Archetypes.Field.StringField">TOP</ActionBarPosition><HideInMenu type="Products.Archetypes.Field.BooleanField">False</HideInMenu><ViewTemplate type="Products.Archetypes.Field.StringField"></ViewTemplate><Position type="Products.Archetypes.Field.IntegerField"/></element><element id="agent1" title="" type="PlominoAgent"><id type="Products.Archetypes.Field.StringField">agent1</id><Content type="Products.Archetypes.Field.TextField"><![CDATA[]]></Content><Scheduled type="Products.Archetypes.Field.BooleanField">False</Scheduled><AgentUser type="Products.Archetypes.Field.StringField"></AgentUser><Cron type="Products.Archetypes.Field.StringField">* 1 * * *</Cron></element></design></plominodatabase>'
    >>> db.importDesignFromXML(xml)
    >>> hasattr(db.frm1, 'field5')
    True
    >>> from Products.CMFPlomino.fields.interfaces import IStringField
    >>> s=IStringField(db.frm1.field1)
    >>> s.who()
    dsd