Hi there, I'm afraid I'm having trouble making this work. Anthony Pfrunder wrote: [snip]
Python Methods requires a simple patch to work. For some reason methods located within a ZClass crash upon creating a function with a self parameter. To fix this, goto the innermost line ref'd in the traceback and delete the "...and len(cofunc...)..." bit. Restart Zope.
I can't find the traceback. *which* traceback? I grepped VisualZope and PythonMethods but couldn't find any reference to 'len(cofunc', should I patch Zope itself? I'm wary to do that..
XMLDocument has lots of bugs in it (sorry Amos ;) most of which are fixed in the subclasses within VZ. One which I haven't patched yet is insertBefore(newchild, oldchild). For some reason if you pass it getFirstChild it will dup this node and then insert your newchild.
Studying the code and remembering some trickiness I encountered with ZDOM, I imagine it has to do with the following: when I insert a new node in Python, and then try to refer to that node, it doesn't work. Instead I need to get at the node through the ZDOM (for instance through getNextSibling(), if I just insert it below a node). In that case it does work. I can't get any of it to work. When I try the index_html in the example folder, I get: Error Type: AttributeError Error Value: _name Traceback (innermost last): File /home/zope/lib/python/ZPublisher/Publish.py, line 214, in publish_module File /home/zope/lib/python/ZPublisher/Publish.py, line 179, in publish File /home/zope/lib/python/Zope/__init__.py, line 201, in zpublisher_exception_hook (Object: ElementWithAttributes) File /home/zope/lib/python/ZPublisher/Publish.py, line 165, in publish File /home/zope/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: XMLWidgetManagerBase) File /home/zope/lib/python/ZPublisher/Publish.py, line 102, in call_object (Object: XMLWidgetManagerBase) File /home/zope/lib/python/Products/XMLWidgets/XMLWidgetManager.py, line 29, in __call__ (Object: XMLWidgetManagerBase) File /home/zope/lib/python/Products/VisualZope/vzManager.py, line 124, in render (Object: XMLWidgetManagerBase) AttributeError: (see above) When I try to add a Form, I get: Error Type: TypeError Error Value: too many arguments; expected 3, got 4 Traceback (innermost last): File /home/zope/lib/python/ZPublisher/Publish.py, line 214, in publish_module File /home/zope/lib/python/ZPublisher/Publish.py, line 179, in publish File /home/zope/lib/python/Zope/__init__.py, line 201, in zpublisher_exception_hook (Object: RoleManager) File /home/zope/lib/python/ZPublisher/Publish.py, line 165, in publish File /home/zope/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: Form_add) File /home/zope/lib/python/ZPublisher/Publish.py, line 102, in call_object (Object: Form_add) File /home/zope/lib/python/OFS/DTMLMethod.py, line 145, in __call__ (Object: Form_add) File /home/zope/lib/python/DocumentTemplate/DT_String.py, line 502, in __call__ (Object: Form_add) File /home/zope/lib/python/DocumentTemplate/DT_With.py, line 133, in render (Object: Form.createInObjectManager(REQUEST['id'], REQUEST)) File /home/zope/lib/python/DocumentTemplate/DT_Util.py, line 321, in eval (Object: Form.createInObjectManager(REQUEST['id'], REQUEST)) File <string>, line 0, in ? File /home/zope/lib/python/ZClasses/ZClass.py, line 419, in createInObjectManager (Object: Form) File /home/zope/lib/python/ZPublisher/mapply.py, line 161, in mapply (Object: Form) File /home/zope/lib/python/Products/VisualZope/vzManager.py, line 25, in __init__ (Object: XMLWidgetManagerBase) TypeError: (see above)
From the code, it looks like you patched XMLWidgets so that its init() function accepts an extra argument (the document?). My XMLWidgets is original and does not do what you want it to do. :) I'll be glad to study proposed patches, though.
Regards, Martijn