[Zope] Traps for the unwary...
Graham King
Graham.King@team.ozemail.com.au
Thu, 28 Mar 2002 15:55:52 +1100
Just thought I'd mention in passing... no need for responses or navel
gazing. :)
We have two identical Zope envts on different OS platforms. (python 2.1.2,
gcc 2.95.3, Zope 2.5.0 on openBSD 3.0 and Solaris 8)
We migrated a Zope DTML application from Solaris systems (where it worked
fine on 3 different Zope instances) to two openBSD systems.
An obscure bit of "superfluous" DTML code caused lib/python/DTML.py to
crash.
Of course, when using ProxyPass method, it caused Zope itself to crash, but
if we used FastCGI or port 8080, then it just failed...
The offending code (marked *)
<dtml-if sequence-end>
* <dtml-call "REQUEST.set('span', (5 -
(_.int(_.getitem('sequence-number')) % 4)) )">
* <dtml-if "_.getitem('span') > 4"><dtml-call "REQUEST.set('span',
1)"></dtml-if>
<dtml-else>
<dtml-call "REQUEST.set('span', 1)">
</dtml-if>
then fixed with:
<dtml-call "REQUEST.set('span', 1 )">
<dtml-if "_.getitem('span') > 4"><dtml-call "REQUEST.set('span',
1)"></dtml-if>
In hindsight, the programmer qualifies this with:
"ok.. but be prepared for some abuse about the shitty code.. I don't
remember what I was thinking at the time and I could not understand what I
was doing when I read it back.. that is generally a sign of bad code :)"
We're all still learning.... :) I was just surprised (read "horrified",
since it was production) that some DTML appln code would crash Zope itself.
I put it down to the vagaries of C compiles on different platforms.
cheers all
hope you have a code-free Easter holiday...
Graham