[Zope3-Users] missing_value for Text fields

Andreas Reuleaux reuleaux at web.de
Wed Jun 29 05:43:14 EDT 2005


missing_values for Text fields don't work for me (complete example
show below): The autogenerated add form is usable for me only

  * if I either make boom a TextLine instead of Text
    
      boom=TextLine(
        title=u'Boom',
        required=False,
        missing_value=u'')

  * or if I drop the missing_value param

      boom=Text(
        title=u'Boom',
        required=False)

However, the combination Text field with missing_value (as in the
example below) causes some garbage html (the rest of the form:
morestuff) to be put in the textarea field for boom when I try to add
a foo object.

Thanks in advance,
  Andreas


PS: originally I also posted a screenshot here, but
that made my message too big for this mailing list


package foo:

interfaces.py
--------------------
from zope.interface import Interface
from zope.schema import Text, TextLine

class IFoo(Interface):
    """some foo"""

    bar=TextLine(
        title=u'Bar',
        required=False,
        missing_value=u''
        )

    boom=Text(
        title=u'Boom',
        required=False,
        missing_value=u''
        )

    morestuff=TextLine(
        title=u'MoreStuff',
        required=False,
        missing_value=u''
        )
--------------------



foo.py
--------------------
from zope.interface import implements
from interfaces import IFoo

class Foo(object):
    """some foo"""

    implements(IFoo)

    bar=u''
    boom=u''
    morestuff=u''
--------------------


conigure.zcml
--------------------
<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:browser="http://namespaces.zope.org/browser"
    i18n_domain="foo"
    >

  <interface
      interface=".interfaces.IFoo"
      type="zope.app.content.interfaces.IContentType"
      />

  <content class=".foo.Foo">
    <factory
	id="foo.Foo"
	title="Create a new foo entry"
	description="This factory instantiates new foos"
	/>
    <require
	permission="zope.View"
	interface=".interfaces.IFoo"
	/>
    <require
	permission="zope.ManageContent"
	set_schema=".interfaces.IFoo"
	/>
  </content>

  
  <browser:addMenuItem
      title="Foo"
      class=".foo.Foo"
      permission="zope.ManageContent"
      view="AddFoo.html"
      />

  <browser:addform
      schema=".interfaces.IFoo"
      content_factory=".foo.Foo"
      label="Add Foo"
      name="AddFoo.html"
      permission="zope.ManageContent"
      >
  </browser:addform>

  
  <browser:editform
      schema=".interfaces.IFoo"
      label="Edit"
      name="edit.html"
      menu="zmi_views" title="Edit"
      permission="zope.ManageContent"
      />


</configure>
--------------------


More information about the Zope3-users mailing list