[Zope-dev] Change in meaning of BASEx in Zope 2?

Phillip J. Eby pje@telecommunity.com
Mon, 14 Jun 1999 14:29:31 -0500


It looks like a (possibly inadvertent) change was made to the semantics of
BASE1-BASE9 as of the May 18th version of ZPublisher/HTTPRequest.py.  To
compare examples...

Older ZPublisher values
-----------------------
URL0	http://telecommunity.com/ATEST/REQUEST
URL1	http://telecommunity.com/ATEST
URL2	http://telecommunity.com

BASE0	http://telecommunity.com
BASE1	http://telecommunity.com/ATEST
BASE2	http://telecommunity.com/ATEST/REQUEST

Newer ZPublisher values
-----------------------
URL0	http://teams.internal.rapidsite.net/ATEST/REQUEST
URL1	http://teams.internal.rapidsite.net/ATEST
URL2	http://teams.internal.rapidsite.net

BASE0	http://teams.internal.rapidsite.net
BASE1	http://teams.internal.rapidsite.net/ATEST/REQUEST
BASE2  undefined


This looks to me like an error, although it may not affect Zope or ZServer.
 Or is this an intended change in semantics?  Looks to me like it would
break existing DTML.

I suspect this is an unintentional side effect of other changes in that
version.  Here's a diff that restores the old semantics:

diff -u -r1.6 HTTPRequest.py
--- HTTPRequest.py      1999/05/25 12:58:07     1.6
+++ HTTPRequest.py      1999/06/14 19:09:44
@@ -426,11 +426,11 @@
         if key[:1]=='B' and BASEmatch(key) >= 0:
             n=ord(key[4])-ord('0')
             if n:
-                if len(self.steps) < n:
+                if len(self.steps) < n-1:
                     raise KeyError, key
                 v=self.script
                 while v[-1:]=='/': v=v[:-1]
-                v=join([v]+self.steps[:n],'/')
+                v=join([v]+self.steps[:n-1],'/')
             else:
                 v=self.base
                 while v[-1:]=='/': v=v[:-1]