Python Script problems: attribute-less object (assign or del)
Hi, I am trying to create a python script which gathers info from a sql database using get_items (a ZSQLMethod). The first thing it needs to do is if item.name is empty, give item.name the value of item.name2. I get the following error msg when running the complete script, Error Type: TypeError Error Value: attribute-less object (assign or del) the assignment of name2 to name is the problem but I don't understand why. Can someone point me in the right direction please. for item in container.get_items(): if item.name=='': item.name = item.name2 Thanks for your help Richard
From: "Richard Ettema" <richard.ettema@yoursolutions.co.uk>
I am trying to create a python script which gathers info from a sql database using get_items (a ZSQLMethod). The first thing it needs to do is if item.name is empty, give item.name the value of item.name2. I get the following error msg when running the complete script, Error
Type: TypeError Error Value: attribute-less object (assign or del)
Only simple Python lists and dictionaries can be modified by Scripts. Class instances (such as SQL records) may not be written to, unless they conform to the Restricted Python write API. Adding this capability to SQL records would be a good fishbowl project (http://dev.zope.org). Cheers, Evan @ digicool
participants (2)
-
Evan Simpson -
Richard Ettema