AW: [Zope3-dev] RFC: Adding name control

Roger ineichen dev at projekt01.ch
Mon Apr 5 18:51:34 EDT 2004


Jim Fulton wrote:

> I'd like to try to fix the way adding views and add views 
> collaborate to input object names:
> 
 
http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/AddingNameC
ontrol

Comments welcome!  I have someone interested in working on this, so work
will commence soon. :)


This has not directly to do with the proposal but 
if I could wish, it whould be nice to get a better way for 
generate add views with Objects in a schema.

Till now I think there is now generic way for to 
generate this views because we miss the information 
of which Implementation is used in the Object(Field).
We discused this a couple mails before.

I think the shortes way right now is define a own add view like:

class Person()
  implements(IPerson)

class SuperMother()
  implements(IPerson, IMother)


Schema:
---
class IFamily(IZope3SampleContent):
    """This interface represents a family.

    A family is used for to store father, mother and children which 
    are implementations of IPerson.
    """

    father = Object(title=u'Father',
        description=u'The father of the family',
        required = True,
        readonly = False,
        default = None,
        schema = IPerson
        )

    mother = Object(title=u'Mother',
        description=u'The mother of the family',
        required = True,
        readonly = False,
        default = None,
        schema = IPerson
        )
---



AddView:
---
father_w = CustomWidgetFactory(ObjectWidget, Person)
mother_w = CustomWidgetFactory(ObjectWidget, SuperMother)

class FamilyAddView(BrowserView):
    """View for viewing a family"""

    __used_for__ = IFamily

    father_widget = father_w
    mother_widget = mother_w
----

Please correct me if there is another way without to
write special views. And where just can declare
in a ZCML which implementation of IPerson should be used
for the field father or mother and not write adapter for factories.


Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


_______________________________________________
Zope3-dev mailing list
Zope3-dev at zope.org http://mail.zope.org/mailman/listinfo/zope3-dev




More information about the Zope3-dev mailing list