On Wed, 5 Dec 2001, Seb Bacon wrote:
- hack the propertymanager code How far is this different from the latest one?
- create custom property editing screens which post to a pythonscript, which strips the whitespace before storing it Hmm, seems me not as good as the other suggestion, but I might be wrong because of a lack of experience.
- deal with the whitespace issue inside your product - do a getProperty() method which strips before returning I tried to add the following Method to my product:
def getProperty(self, id, d=None): """Get the property 'id', returning the optional second argument or None if no such property is found.""" if self.hasProperty(id): if id == 'keywords' : # + safe_keywords=self.keywords # + self.keywords=[] # + for keyword in save_keywords: # + keyword=keyword.strip() # + if keyword != '' : # + self.keywords.append(keyword) # + return getattr(self, id) return d I took the code crom PropertyManager and added the marked (# +) lines. I'm not sure if I did this right but it does not work as expected. Any idea how to debug such kind of code? (To make sure that there is no other problem I attached the whole code.) Another problem I see is that I want to test in a DTML Document, whether there are keywords defined or not (resp. if I'm in an MyFolder or not). The following just raises just an AttributeError. getattr(object, string) Return the value of the named attributed of object. name must be a string. If the string is the name of one of the object's attributes, the result is the value of that attribute. For example, getattr(x, "foobar") is equivalent to x.foobar. If the named attribute does not exist, default is returned if provided, otherwise AttributeError is raised. How can I do this cleanly? Kind regards and many thanks for your great help Andreas.