I had product with below properties: class easyArticle(SimpleItem.SimpleItem): _properties = ( {'id':'author', 'type':'string', 'mode':'w'} ) ... I inputted some objects of this product. Later I added some properties: class easyArticle(SimpleItem.SimpleItem): _properties = ( {'id':'author', 'type':'string', 'mode':'w'}, {'id':'n1','type':'float', 'mode':'w'}, {'id':'n2','type':'float', 'mode':'w'} ) ... After that, I cannt read old objects of this class. Zope write: Site Error An error was encountered while publishing this resource. Error Type: AttributeError Error Value: n1 How can I solve this problem? Regard, Serg.
Serg wrote:
I had product with below properties:
class easyArticle(SimpleItem.SimpleItem): _properties = ( {'id':'author', 'type':'string', 'mode':'w'} ) ...
I inputted some objects of this product.
Later I added some properties: class easyArticle(SimpleItem.SimpleItem): _properties = ( {'id':'author', 'type':'string', 'mode':'w'}, {'id':'n1','type':'float', 'mode':'w'}, {'id':'n2','type':'float', 'mode':'w'} ) ...
After that, I cannt read old objects of this class. Zope write: Site Error An error was encountered while publishing this resource. Error Type: AttributeError Error Value: n1
How can I solve this problem?
Two possibilities: 1) Create an update-method, which you call on each object and which adds the required attribute (self.n1=0.0 etc.) 2) Add the additional (better: all) properties as class-attributes. Something like: class easyArticle(SimpleItem.SimpleItem): id='' n1=0.0 n2=0.0 _properties = ... Cheers, Maik
After that, I cannt read old objects of this class. Zope write: Site Error An error was encountered while publishing this resource. Error Type: AttributeError Error Value: n1
How can I solve this problem?
class easyArticle(SimpleItem.SimpleItem): n1 = 0.0 n2 = 0.0 _properties = ( {'id':'author', 'type':'string', 'mode':'w'}, {'id':'n1','type':'float', 'mode':'w'}, {'id':'n2','type':'float', 'mode':'w'} ) cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
participants (3)
-
Chris Withers -
Maik Jablonski -
Serg