[Zope] <dtml-with> namespace conflict question needs explanation
Jason CUNLIFFE <jasonic@nomadicsltd.com>
jasonic@nomadicsltd.com
Fri, 11 Aug 2000 23:19:05 +0200
Hello
Please can someone help us understand how to avoid DTML method names
conflicting with other zope objects with same name.
For example using Zope export/import during recent site development to
transfer work from local machines to the linux server broke sections of our
site in a manner which was very hard to find. The reason we have finally
traced to namespace conflict.
We imported code which included calls to a local zope object named 'swf' for
simple substitution. But suddenly our code did not work. It turned out that
another object identically named 'swf' was an already existing 'folder'
..!!
This is a very disturbing discovery, becuase it implies that one might have
anywhere at anytime hidden or visible namespace conflicts emerging and
vanishing with no control. We had thought that <dtml-with
something></dtml-with> would avoid this. But it does not and may even cause
it! It also implies that makes development of Zope sites across various
machines very hit-or-miss
Please help..
Exact code dump follows...
1. I have an original DTML template called 'objembedswf' in a folder named
'Flash4'
<OBJECT ID='login' CLASSID='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'
CODEBASE='http://active.macromedia.com/flash2/cabs/swflash.cab#version=3,0,0
,0'
WIDTH=<dtml-var width> HEIGHT=<dtml-var height>>
<PARAM NAME='Movie' VALUE='<dtml-var swf>'>
<PARAM NAME='Play' VALUE='false'>
<PARAM NAME='Quality' VALUE='best'>
<PARAM NAME='swLiveConnect' VALUE='true'>
<PARAM NAME='menu' VALUE='false'>
<EMBED NAME='login' mayscript='mayscript' SRC='<dtml-var swf>'
swLiveConnect='true'
WIDTH='100%' HEIGHT='100%' salign='t' quality='best' play='false'
menu='false'
TYPE='application/x-shockwave-flash'
pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_
Version=ShockwaveFlash'>
</EMBED>
</OBJECT>
2. Below this my DTML file includes calls to this template like this:
<dtml-with Flash4>
<dtml-call "REQUEST.set('swf','login.swf')">
<dtml-call "REQUEST.set('width','100%')">
<dtml-call "REQUEST.set('height','100%')">
<dtml-var objembedswf>
</dtml-with>
3. Here is the result of substitution returned in browser
<OBJECT ID='login' CLASSID='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'
CODEBASE='http://active.macromedia.com/flash2/cabs/swflash.cab#version=3,0,0
,0'
WIDTH=100% HEIGHT=100%>
<PARAM NAME='Movie' VALUE='<Folder instance at 8557b00>'>
<PARAM NAME='Play' VALUE='false'>
<PARAM NAME='Quality' VALUE='best'>
<PARAM NAME='swLiveConnect' VALUE='true'>
<PARAM NAME='menu' VALUE='false'>
<EMBED NAME='login' mayscript='mayscript' SRC='<Folder instance at
8557b00>' swLiveConnect='true'
WIDTH='100%' HEIGHT='100%' salign='t' quality='best' play='false'
menu='false'
TYPE='application/x-shockwave-flash'
pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_
Version=ShockwaveFlash'>
</EMBED>
</OBJECT>
I draw you attention to the fact that <dtml-var swf> was supposed to be
subsituted with 'login.swf', but instead became <Folder instance at
8557b00>
..ouch..
4. The reason appears to be that there is a namespace conflict elsewhere in
my Zope tree. As it turns out, we have a folder right under / called 'swf'.
In fact it could be many places and still cause a conflict.
This 'bug/feature' is the same under Zope 2.1.6, and Zope 2.2.0 in Win98se
and LinuxRedhat.
Is it something about <dtml-with> or perhaps our use of <dtml-call
"REQUEST.set> which creates this unpredictable and confusing effect?
Is this is a bug? As it stands it means is is very hard to have people
working on separate sections of a Zope site because at any time they might
be causing namespace collisions like this. In our case the effect was
obvious - our swf files immedaitely woudl not display. But other voodoo
could easily occur which migh not appear for some time.
It provokes me to ask simply what is the search path priority of object
acquistion in zope and how do you control it safely?
Thank you
- Jason Cunliffe