Zclass manage_changeProperties
I want a method to change the 'auteur' property of my Zclass instance 'PDFclass'. The property sheet is PDFinfo and 'auteur' is a string field. This is an example of what can be the method : _______________________________________________ <dtml-var standard_html_header> <dtml-call "REQUEST.set('numero_doc' , '7')"> <dtml-in "Catalog({'numero_doc': _.str(numero_doc)})"> <dtml-with getObject> <dtml-call "Control_Panel.Products.PDFclass.propertysheets.PDFinfo.manage_changeProperties({'auteur': 'nicolas'})"> </dtml-with> </dtml-in> _______________________________________________ and I get the following error : Error Type: AttributeError Error Value: PDFinfo <!-- Traceback (innermost last): File /usr/local/Zope-2.3.1-linux2-x86/lib/python/ZPublisher/Publish.py, line 223, in publish_module File /usr/local/Zope-2.3.1-linux2-x86/lib/python/ZPublisher/Publish.py, line 187, in publish File /usr/local/Zope-2.3.1-linux2-x86/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook (Object: Traversable) File /usr/local/Zope-2.3.1-linux2-x86/lib/python/ZPublisher/Publish.py, line 171, in publish File /usr/local/Zope-2.3.1-linux2-x86/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: test) File /usr/local/Zope-2.3.1-linux2-x86/lib/python/ZPublisher/Publish.py, line 112, in call_object (Object: test) File /usr/local/Zope-2.3.1-linux2-x86/lib/python/OFS/DTMLMethod.py, line 189, in __call__ (Object: test) File /usr/local/Zope-2.3.1-linux2-x86/lib/python/DocumentTemplate/DT_String.py, line 538, in __call__ (Object: test) File /usr/local/Zope-2.3.1-linux2-x86/lib/python/DocumentTemplate/DT_In.py, line 713, in renderwob (Object: Catalog({'numero_doc': _.str(numero_doc)})) File /usr/local/Zope-2.3.1-linux2-x86/lib/python/DocumentTemplate/DT_With.py, line 146, in render (Object: getObject) File /usr/local/Zope-2.3.1-linux2-x86/lib/python/DocumentTemplate/DT_Util.py, line 334, in eval (Object: Control_Panel.Products.PDFclass.propertysheets.PDFinfo.manage_changeProperties({'auteur': 'nicolas'})) (Info: Control_Panel) File <string>, line 0, in ? File /usr/local/Zope-2.3.1-linux2-x86/lib/python/DocumentTemplate/DT_Util.py, line 127, in careful_getattr AttributeError: (see above) --> I really don't understand, I read the syntax from the [Zope-DEV]mailing list and it seems to be correct. thanx, sbaline () / \ | <> | (____) zazen rules ... _______________________________________________________ Send a cool gift with your E-Card http://www.bluemountain.com/giftcenter/
Sebal wrote:
I want a method to change the 'auteur' property of my Zclass instance 'PDFclass'. The property sheet is PDFinfo and 'auteur' is a string field.
This is an example of what can be the method : _______________________________________________ <dtml-var standard_html_header> <dtml-call "REQUEST.set('numero_doc' , '7')"> <dtml-in "Catalog({'numero_doc': _.str(numero_doc)})"> <dtml-with getObject> <dtml-call "Control_Panel.Products.PDFclass.propertysheets.PDFinfo.manage_changeProperties({'auteur': 'nicolas'})"> </dtml-with> </dtml-in> _______________________________________________ and I get the following error : Error Type: AttributeError Error Value: PDFinfo
[snip] You should be able to do this call inside the with to change the property: <dtml-call expr="propertysheets.PDFinfo.manage_changeProperties(auteur='nicolas')"> Since getObject returns the instance and with puts in on top of the namespace, you do not need to explicitly go through the Control_Panel. Going through the ZClass is in fact not what you want because you want to change an instance property not a class property.
I really don't understand, I read the syntax from the [Zope-DEV]mailing list and it seems to be correct.
thanx, sbaline
hth, -- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
participants (2)
-
Casey Duncan -
Sebal