[Zope3-Users] zcml for z3c.form

John john at saponara.net
Thu Jan 24 09:30:17 EST 2008


I'm converting from formlib to z3c.form.  What should my configure.zcml 
look like?

For formlib it is:

  <browser:page
    for="zope.app.container.interfaces.IAdding"
    name=".Person"
    class=".browser.PersonAddForm"
    permission="zope.ManageContent"
    />

I assume the 'for=' value should change, but to what?  Complete code is 
attached (with non-Person classes still using formlib).

Thanks,
John

-------------- next part --------------
A non-text attachment was scrubbed...
Name: browser.py
Type: text/x-python
Size: 1190 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20080124/bccfc991/browser.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: classes.py
Type: text/x-python
Size: 1501 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20080124/bccfc991/classes.py
-------------- next part --------------
<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:browser="http://namespaces.zope.org/browser"
	i18n_domain="limosvc"
	>
	
  <include package="zope.security" file="meta.zcml" />
  <include package="zope.app.zcmlfiles" file="meta.zcml" />

  <include package="zope.publisher" />
  <include package="zope.traversing" />
  <include package="zope.traversing.browser" />
  <include package="zope.app.zcmlfiles" />

  <!-- The following packages aren't needed from the beginning, but
       end up being used in most applications -->
  <include package="zope.i18n" file="meta.zcml" />
  <include package="zope.annotation" />
  <include package="zope.copypastemove" />
  <include package="zope.formlib" />
  <include package="zope.i18n.locales" />
  <include package="zope.app.authentication" />
  <include package="zope.app.session" />
  <include package="zope.app.intid" />
  <include package="zope.app.keyreference" />
  <include package="zope.app.catalog" />

  <!-- Add your own component registrations here -->

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

  <class class=".classes.Person">
    <!--implements
        interface="zope.annotation.interfaces.IAttributeAnnotatable"
        /-->
    <factory
        id="limosvc.classes.Person"
        description="a person" 
        />
    <require
        permission="zope.ManageContent"
        interface=".interfaces.IPerson"
        />
    <require
        permission="zope.ManageContent"
        set_schema=".interfaces.IPerson"
        />
  </class>
  
  <browser:addMenuItem
    class=".classes.Person"
    title="a person"
    permission="zope.ManageContent"
    description='add Person'
    view='.Person'
    />
  <browser:page
    for="zope.app.container.interfaces.IAdding"
    name=".Person"
    class=".browser.PersonAddForm"
    permission="zope.ManageContent"
    />
  <browser:page
    for=".interfaces.IPerson"
    name="edit.html"
    class=".browser.PersonEdit"
    permission="zope.ManageContent"
    template="edit.pt"
	menu="zmi_views" title="edit"
    />
  <utility
      provides="zope.schema.interfaces.IVocabularyFactory"
      component=".vocabulary.personsInParent"
      name="allPersons"
      />
  
  <interface
      interface=".interfaces.ICar"
      type="zope.app.content.interfaces.IContentType"
      />

  <class class=".classes.Car">
    <!--implements
        interface="zope.annotation.interfaces.IAttributeAnnotatable"
        /-->
    <factory
        id="limosvc.classes.Car"
        description="a car" 
        />
    <require
        permission="zope.ManageContent"
        interface=".interfaces.ICar"
        />
    <require
        permission="zope.ManageContent"
        set_schema=".interfaces.ICar"
        />
  </class>
  
  <browser:addMenuItem
      class=".classes.Car"
      title="a car"
      permission="zope.ManageContent"
      description='add Car'
      view='.Car'
  />
  <browser:page
    for="zope.app.container.interfaces.IAdding"
    name=".Car"
    class=".browser.CarAddForm"
    permission="zope.ManageContent"
    />
  <browser:page
      for=".interfaces.ICar"
      name="edit.html"
      class=".browser.CarEdit"
      permission="zope.ManageContent"
      template="edit.pt"
	  menu="zmi_views" title="edit"
      />
  <utility
      provides="zope.schema.interfaces.IVocabularyFactory"
      component=".vocabulary.carsInParent"
      name="allCars"
      />
  
  <interface
      interface=".interfaces.IDriver"
      type="zope.app.content.interfaces.IContentType"
      />

  <class class=".classes.Driver">
    <!--implements
        interface="zope.annotation.interfaces.IAttributeAnnotatable"
        /-->
    <factory
        id="limosvc.classes.Driver"
        description="a driver" 
        />
    <require
        permission="zope.ManageContent"
        interface=".interfaces.IDriver"
        />
    <require
        permission="zope.ManageContent"
        set_schema=".interfaces.IDriver"
        />
  </class>
  
  <browser:addMenuItem
      class=".classes.Driver"
      title="a driver"
      permission="zope.ManageContent"
      description='add Driver'
      view='.Driver'
  />
  <browser:page
    for="zope.app.container.interfaces.IAdding"
    name=".Driver"
    class=".browser.DriverAddForm"
    permission="zope.ManageContent"
    />
  <browser:page
      for=".interfaces.IDriver"
      name="edit.html"
      class=".browser.DriverEdit"
      permission="zope.ManageContent"
      template="edit.pt"
	  menu="zmi_views" title="edit"
      />
  <utility
      provides="zope.schema.interfaces.IVocabularyFactory"
      component=".vocabulary.driversInParent"
      name="allDrivers"
      />
  
  <interface
      interface=".interfaces.ILimosvc"
      type="zope.app.content.interfaces.IContentType"
      />
  
  <class class=".classes.Limosvc">
    <!--implements
        interface="zope.app.annotation.interfaces.IAttributeAnnotatable"
        /-->
    <implements
        interface="zope.app.container.interfaces.IContentContainer" 
        />
    <factory
        id="limosvc.classes.Limosvc"
        description="Limosvc" 
        />
    <require
        permission="zope.ManageContent"
        interface=".interfaces.ILimosvc"
        />
    <require
        permission="zope.ManageContent"
        set_schema=".interfaces.ILimosvc"
        />
  </class>
  
  <browser:addMenuItem
      class=".classes.Limosvc"
      title="Limosvc"
      permission="zope.ManageContent"
  />

  <browser:containerViews
      for="limosvc.interfaces.ILimosvc"
      index="zope.View"
      contents="zope.View"
      add="zope.ManageContent"
      />

  </configure>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope3-users/attachments/20080124/bccfc991/edit.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: interfaces.py
Type: text/x-python
Size: 1835 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20080124/bccfc991/interfaces.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vocabulary.py
Type: text/x-python
Size: 852 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20080124/bccfc991/vocabulary.py


More information about the Zope3-users mailing list