[Zope] python products and properties

bdorn@vup.at bdorn@mopa.at
Wed, 6 Jun 2001 18:20:53 +0200


i had the same problem

i passed a new value to the _property dict like this:

{'id':'title', 'label':'Titel', 'initvalue':'TODO: Titel', 'type': 'string',
'mode': 'w',},

and then wrote a function which has to be called in manage_editProperties,
so you have to óverride it:


def _initClassAttribute(self,id,value):
        """ if id exists leave it """
        if(not (self.__dict__.has_key(id))):
            #self.__dict__[id] = value
            setattr(self,id,value)

def _initProperties(self):
        """ defines class attributes for the properties
            so no errror is raised, this is has to be called from
manage_editProperties
        """

        for prop in self._propertyMap():
            name=prop['id']
            value=prop['initvalue']
            self._initClassAttribute(name,value)

this helped in my situation

cu bernd


----- Original Message -----
From: "Oliver Bleutgen" <myzope@gmx.net>
To: <zope@zope.org>
Sent: Wednesday, June 06, 2001 5:53 PM
Subject: [Zope] python products and properties


> Hi,
>
>
> is there a way to handle properties
> in python products in order to get
> similar funtionality in as propertysheets in
> python?
>
> I'm developing a product right now and it may
> be that I have to add some properties later
> (while in production).
> Right now I have to manually assign a newly added
> property to already existing instances, because
> adding the property in the _properties class
> attribute breaks the properties management tab of
> these instances.
> Am I missing something? What do others do?
>
>
>
> Oh yeah, and I even have a great proof that I tried
> to find an answer in the archieves, check out
> this nice page:
>
> http://www.y-tex.com/PYthon.html
>
> It totally sold me on python products, I really didn't
> know that they are *that* potent.
>
>
> cheers,
> oliver
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>