durusmail: quixote-users: request.get_path() problem/bug
request.get_path() problem/bug
2002-08-02
2002-08-05
request.get_path() problem/bug
Andreas Kostyrka
2002-08-01
Hi!

I've got the following setup:

localhost/fax/ -> /usr/local/httpd/htdocs/fax.cgi rewrite.
in fax.py (the module that is published) I have the
following structure:

files/fax.png

q(getname)/ -> FaxQueue

In the FaxQueue _q_index template I' trying to find out the path where
the published module is visible:

''%\
                (f[0],
                 f[1][0],
                 path)

With the pristine os.environ (I've dumped it to make sure :) ),
path=os.environ.get("SCRIPT_NAME","") would work. But os.environ is not
pristine when my _q_index template gets called.

So, I've tried the following:
 outfile=open("/tmp/faxcgi-dbg.%05d" % os.getpid(),"w")
 for i in xrange(300):        # Well this should be enough.
   try:
     path=request.get_path(0)
     outfile.write("%02d %s\n" % (i,path))
   except ValueError:
     break
 outfile.close()

(The outfile stuff is just for debugging.)

Now this produces a path of /fax/q/ still:
00 /fax/q/
01 /fax/q/
02 /fax/q/
03 /fax/q/
04 /fax/q/
05 /fax/q/
06 /fax/q/
...
296 /fax/q/
297 /fax/q/
298 /fax/q/
299 /fax/q/

Now, the only possible way I see to get BASE url of the application is
to embed the depth of an object in the object. Not exactly the thing
that seems clever to me. (Especially as I've encountered these problems
after I moved from one FaxQueue at / to multiple FaxQueues below
'/%(name)s'.)

"/".join(["..",]*256) doesn't work either, because the client just backs
out from the application without noticing.

So how do experienced Quixote developers solve this problem? Actually I
do not see a solution in the published module, because the information
needed seems to be destroyed during the publishing process.

Andreas



reply