FW: [Zope-dev] strange behavior of VirtualHostMonster
Casey Duncan
casey at zope.com
Thu Feb 5 09:23:04 EST 2004
On Wed, 4 Feb 2004 22:50:27 -0600
<zope-dev at netchan.cotse.net> wrote:
> Okay, I debugged a bit more:
> > [u'loginUser', u'usermgrFolder', '/', 'VHM'] <= this looks weird to
> me
>
> It seems it's pretty okay, however the last line in
> VirtualHostMonster.__bobo_traverse__ says:
> return parents.pop() # He'll get put back on
>
> Of course, the popped item is 'a', that's the one with the
> beforetraversal hook, so if it's really put back on later, than the
> hook will run again. I think this is the explanation, but the question
> remains: how can I avoid the second call to the beforetraverse hook?
I also ran into this problem recently with an extension I wrote to
CookieCrumber (which has a before traverse hook). It had the unfortunate
affect of working on my local machine (where I was not virtual hosted)
but not on the production box (which did). Luckily I had a test Zope
instance on the production box. The obvious lessons: you can't test too
much, when you're sure it works test it some more and always test in the
*exact* environment as production (in other words the actual production
boxen).
The way CC handles this issue is to set a flag on the REQUEST on the
first run and check for the flag on subsequent runs. Not elegant to be
sure, but workable.
It seems like at the very least this should be a documented "feature" of
VHM, if not a subtle bug.
-Casey
More information about the Zope-Dev
mailing list