[Zope] Changing Properties (Was: More product writing problems)

Tille, Andreas TilleA@rki.de
Thu, 6 Dec 2001 13:33:35 +0100 (CET)


Hello,

while now syntactically correct I was not able to solve my logical
problem, which is: Stripping a set of keywords of type 'lines' from
whitespace and removing blank lines.

The properties.dtml method calls 'manage_editProperties:method'.
So I searched
   $(ZOPE_HOME)/lib/python/OFS/PropertyManager.py
for this method.  This calls 'self._updateProperty(name, value)'
and so I've thought it would be sane to override this method with my
own.  I just copyed the method _updateProperty from and tried

def _updateProperty(self, id, value):
    # Update the value of an existing property. If value
#    Code was stolen from: /usr/lib/zope/lib/python/OFS/PropertyManager.py
    # is a string, an attempt will be made to convert
    # the value to the type of the existing property.
    self._wrapperCheck(value)
    if not self.hasProperty(id):
        raise 'Bad Request', 'The property %s does not exist' % id
    if type(value)==type(''):
        proptype=self.getPropertyType(id) or 'string'
        if type_converters.has_key(proptype):
            value=type_converters[proptype](value)
    if id == 'keywords' :                        # +
        save_keywords=self.keywords              # +
        self.keywords=[]                         # +
        for keyword in save_keywords:            # +
            keyword=keyword.strip()              # +
            if keyword != '' :                   # +
               self.keywords.append(keyword)     # +
    else:
        self._setPropValue(id, value)

Unfortunately I see no effect for my changed keyword values.  Did I
something wrong?  Any suggestion how to debug this code?

Kind regards

        Andreas.