[Zope] XMLDocument create attributes problem
matt
matt@virtualspectator.com
Fri, 6 Oct 2000 22:55:53 +1300
Hi,
I'm trying to make an external method create and set some attributes of nodes
in an XML document. The following is a fragment of the code, and the error. I
can't even get a valid attribute created, let alone set. Does anyone have some
examples?
Please could you reply to me as well as the list,
regards
Matt
from Products.XMLDocument.XMLDocument import Document
def add(self, id, title):
ob=Document()
ob.title=title
ob.id=id
id=self._setObject(id, ob)
log_node = ob.createElement('log')
an_at = ob.createAttribute('attribute1')
Zope Error
Zope has encountered an error while publishing this resource.
Error Type: TypeError
Error Value: too many arguments; expected 3, got 4
Traceback (innermost last):
File /usr/local/zope/Zope-2.2.0-linux2-x86/lib/python/ZPublisher/Publish.py, line 222, in publish_module
File /usr/local/zope/Zope-2.2.0-linux2-x86/lib/python/ZPublisher/Publish.py, line 187, in publish
File /usr/local/zope/Zope-2.2.0-linux2-x86/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook
(Object: Traversable)
File /usr/local/zope/Zope-2.2.0-linux2-x86/lib/python/ZPublisher/Publish.py, line 171, in publish
File /usr/local/zope/Zope-2.2.0-linux2-x86/lib/python/ZPublisher/mapply.py, line 160, in mapply
(Object: CreateNewsItem)
File /usr/local/zope/Zope-2.2.0-linux2-x86/lib/python/ZPublisher/Publish.py, line 112, in call_object
(Object: CreateNewsItem)
File /usr/local/zope/Zope-2.2.0-linux2-x86/lib/python/OFS/DTMLMethod.py, line 172, in __call__
(Object: CreateNewsItem)
File /usr/local/zope/Zope-2.2.0-linux2-x86/lib/python/DocumentTemplate/DT_String.py, line 528, in __call__
(Object: CreateNewsItem)
File /usr/local/zope/Zope-2.2.0-linux2-x86/lib/python/DocumentTemplate/DT_Util.py, line 337, in eval
(Object: addxmldoc('test', 'some_title_test'))
(Info: addxmldoc)
File <string>, line 0, in ?
File /usr/local/zope/Zope-2.2.0-linux2-x86/lib/python/Products/ExternalMethod/ExternalMethod.py, line 270, in __call__
(Object: addxmldoc)
(Info: (('test', 'some_title_test'), {}, None))
File /usr/local/zope/Zope-2.2.0-linux2-x86/Extensions/addxmldoc.py, line 11, in add
(Object: Traversable)
File /usr/local/zope/Zope-2.2.0-linux2-x86/lib/python/Products/XMLDocument/XMLDocument.py, line 283, in createAttribute
(Object: Manageable)
TypeError: (see above)