[Zope-dev] XMLDocument patch feedback

Anthony Pfrunder s341625@student.uq.edu.au
Sat, 23 Oct 1999 21:52:37 +1000 (GMT+1000)


Amos / Martijn,

I applied your patches to the XML Document product but it didn't appear to
fix the problem 
within VisualZope / XMLWidgets.  Below is a traceback and associated
information.

Products/VisualZope/VZManager.py contains one class (VZmanager) which
inherits from:
* Products.XMLDocument.XMLDocument and
* Products.XMLWidgets.XMLWidgetManager.XMLWidgetManagerBase

VZmanager implements the following additional methods:
* dorender
* prender

VZmanager is the superclass for the Form ZClass.  This ZClass, when
"viewed" (ie via URL or index_html)
calls a ZClass method "view" which calls the inherited "dorender" method.

When the Form instance is "viewed" the following occurs:

************************** Edited Extract of HTML Error Page
**********************************
[snip]
  <P>Zope has encountered an error while publishing this resource.

[snip]
  <P>
  <STRONG>Error Type: AttributeError</STRONG><BR>
  <STRONG>Error Value: _id</STRONG><BR> 
  </P>

[snip]
Traceback (innermost last):

[Viewing a VZ Form instance]
  File C:\TEMP\Zope\lib\python\ZPublisher\Publish.py, line 214, in
publish_module
  File C:\TEMP\Zope\lib\python\ZPublisher\Publish.py, line 179, in publish
  File C:\TEMP\Zope\lib\python\Zope\__init__.py, line 201, in
zpublisher_exception_hook
    (Object: ElementWithAttributes)
  File C:\TEMP\Zope\lib\python\ZPublisher\Publish.py, line 165, in publish
  File C:\TEMP\Zope\lib\python\ZPublisher\mapply.py, line 160, in mapply
    (Object: XMLWidgetManagerBase)

[call intercepted by VZManager superclass and redirected to Form
instance.view()]
  File C:\TEMP\Zope\lib\python\ZPublisher\Publish.py, line 102, in
call_object
    (Object: XMLWidgetManagerBase)
  File C:\TEMP\Zope\lib\python\Products\VisualZope\vzManager.py, line 65,
in __call__
    (Object: XMLWidgetManagerBase)
  File C:\TEMP\Zope\lib\python\OFS\DTMLMethod.py, line 145, in __call__
    (Object: view)

[Executing "view" Python Method within Form ZClass]
  File C:\TEMP\Zope\lib\python\DocumentTemplate\DT_String.py, line 502, in
__call__
    (Object: view)
  File C:\TEMP\Zope\lib\python\DocumentTemplate\DT_Util.py, line 321, in
eval
    (Object: dorender(getDocumentElement(), REQUEST))

[Calling inherited "dorender" method located in VZmanager]
  File &lt;string&gt;, line 0, in ?
  File C:\TEMP\Zope\lib\python\Products\VisualZope\vzManager.py, line 77,
in dorender
    (Object: XMLWidgetManagerBase)
  File C:\TEMP\Zope\lib\python\Products\VisualZope\vzManager.py, line 91,
in prender
    (Object: XMLWidgetManagerBase)
  File C:\TEMP\Zope\lib\python\Products\VisualZope\vzManager.py, line 91,
in prender
    (Object: XMLWidgetManagerBase)
  File C:\TEMP\Zope\lib\python\Products\VisualZope\vzManager.py, line 93,
in prender
    (Object: XMLWidgetManagerBase)
  File C:\TEMP\Zope\lib\python\Products\VisualZope\vz.py, line 43, in
prender
  File C:\TEMP\Zope\lib\python\Products\PythonMethod\PythonMethod.py, line
168, in __call__
    (Object: prender)
    (Info: [snip])

[calling Python Method which performs a DOM operation on the data within
VZmanager]
  File &lt;string&gt;, line 15, in prender
    (Object: ElementWithAttributes)
  File C:\TEMP\Zope\lib\python\Products\XMLDocument\Node.py, line 429, in
appendChild
    (Object: Manageable)
  File C:\TEMP\Zope\lib\python\Products\XMLDocument\Node.py, line 396, in
removeChild
    (Object: XMLWidgetManagerBase)
AttributeError: (see above)

The code for the prender Python Method is:
Parameters: self = the widget, manager = the Form instance, node = tag
within Form instance, REQUEST
# This method renders this widget node by modifying a clone of
# the current Form XML tree which contains the widget tag

body = REQUEST['clone'].getElementsByTagName('body')[0]
head = REQUEST['clone'].getElementsByTagName('head')[0]
REQUEST.set('name', node.getAttribute('name'))
REQUEST.set('type', self.id)
REQUEST.set('widget', self)

# Include javascript library for this widget
tmp = manager.createElement('script')
tmp.setAttribute('src',
self.absolute_url()+'/implementation?name='+REQUEST['name'])
tmp.setAttribute('language', 'javascript')
tmp.appendChild(manager.createTextNode(''))
head.appendChild(tmp)
^^^^*********************** head: This object has NO id attribute
*******************
[snip]

If I change XMLDocument back to the wrapped version (adds aq_* attributes)
it works fine.

Do you think there is a problem related to the DTML id problem somewhere?

Cheers,

Anthony Pfrunder