Tim Wilson writes:
.... I'm using a boolean property called "readmore" that determines whether the link is displayed or not. I use a PythonScript to add the instance and I'm trying to figure out how to set the "readmore" property depending on whether any text has been entered in the body field. Here's what I have so far: ... if REQUEST.has_key('body'): newsitem.propertysheets.Basic.manage_changeProperties(REQUEST, readmore=TRUE) else: newsitem.propertysheets.Basic.manage_changeProperties(REQUEST, readmore=FALSE) What happens?
I would expect a "NameError" as "TRUE" and "FALSE" are not predefined names (use "1" for "TRUE" and "0" for "FALSE"). Then, I would expect that "REQUEST" always has the key "body". It just may be empty or not. Thus, you should probably use: if REQUEST.get('body'): .... More optimizations possible.... Dieter