Re: [Zope] VHM / traverse subpath interaction bug?

2008-10-10 Thread Dieter Maurer
Chris Withers wrote at 2008-10-10 15:56 +0100:
> ...
>Well okay, but can Zope 2's VHM be re-implemented in such a way as to 
>not need the silly hidden traversal step?

As I have explained: It could -- but probably would not do the correct
thing when you put objects with traversal magic between
"VirtualHostBase" and "VirtualHostRoot".
Especially, (silly) PythonScripts as one of the steps there, were
likely to fail -- in a different way.



-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] VHM / traverse subpath interaction bug?

2008-10-10 Thread Chris Withers
Tres Seaver wrote:
>>>   steps.
>> I bet repoze's VHM replacement doesn't need this ;-)
>> I wonder how they do it?
> 
> Two parts:
> 
>   - The first (WSGI middleware) uses either extra headers or the
> Zope2-style URL tokens to adjust the CGI environment variables
> (SERVER_NAME, HTTP_HOST, SCRIPT_NAME, and PATH_INFO), plus a
> stock WSGI environment variable ('wsgi.url_scheme'). See
> http://svn.repoze.org/repoze.vhm/trunk/repoze/vhm/middleware.py
> 
>   - The second part (in the application) just uses those values
> according to their "stock" CGI meanings, and sets the 'SERVER_URL'
> key in the request.  Once that is set, the stock ZPublisher
> virtual hosting machinery is neutered. ;)  See
> http://svn.repoze.org/repoze.zope2/trunk/repoze/zope2/z2bob.py

Well okay, but can Zope 2's VHM be re-implemented in such a way as to 
not need the silly hidden traversal step?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] VHM / traverse subpath interaction bug?

2008-10-04 Thread Dieter Maurer
Chris Withers wrote at 2008-10-3 15:32 +0100:
>Dieter Maurer wrote:
>>> Worse yet, if you go to:
>>>
>>> http://localhost:8080/VirtualHostBase/https/example.com:443/test/VirtualHostRoot/_vh_something/x/y/z
>>>
>>> ...you get:
>>>
>>> ['virtual_hosting', '/something', 'x', 'y', 'z']
>>>
>>> Anyone got any ideas as to what's going on here?
>> 
>> It is very strange that you want to define a Python Script as
>> root of your site. This use case is simple not supported.
>
>Who said anything about it being the root of a site? ;-)

Me.
You see the "VirtualHostRoot" in your url?
It defines the site root.

>I guess this wouldn't actually happen if the python script was after the 
>  vritual host's root...

Yes. The "VirtualHostRoot" is the place where the additional
steps added by the "VHM" are removed again.

> ...
>(see the __before_traverse__ hook code)
>
>>   A VHM needs to get control twice -- once to set things up
>>   and once to set the virtual root.
>>   It ensures to get control the second time by adding additional traversal
>>   steps.
>
>I bet repoze's VHM replacement doesn't need this ;-)
>I wonder how they do it?

If one is ready to give up traversal flexibility (and assumes that
the traversal steps seen in the urls are precisely those which will
enter the url generation), then the request can immediately be set up
as the second control would do. Of course, "Script (Python)" on the
path between "VirtualHostBase" and "VirtualHostRoot" would not work --
as this belongs to the traversal flexibility that would be lost :-)



-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] VHM / traverse subpath interaction bug?

2008-10-03 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chris Withers wrote:
> Dieter Maurer wrote:
>>> Worse yet, if you go to:
>>>
>>> http://localhost:8080/VirtualHostBase/https/example.com:443/test/VirtualHostRoot/_vh_something/x/y/z
>>>
>>> ...you get:
>>>
>>> ['virtual_hosting', '/something', 'x', 'y', 'z']
>>>
>>> Anyone got any ideas as to what's going on here?
>> It is very strange that you want to define a Python Script as
>> root of your site. This use case is simple not supported.
> 
> Who said anything about it being the root of a site? ;-)
> 
> I guess this wouldn't actually happen if the python script was after the 
>   vritual host's root...
> 
> I actually bumped into this trying to get the antique ZRoundup product 
> to work on Zope 2.11. The fix wasn't that pretty:
> 
> http://sourceforge.net/tracker/index.php?func=detail&aid=2141835&group_id=31577&atid=402788
> 
> (see the __before_traverse__ hook code)
> 
>>   A VHM needs to get control twice -- once to set things up
>>   and once to set the virtual root.
>>   It ensures to get control the second time by adding additional traversal
>>   steps.
> 
> I bet repoze's VHM replacement doesn't need this ;-)
> I wonder how they do it?

Two parts:

  - The first (WSGI middleware) uses either extra headers or the
Zope2-style URL tokens to adjust the CGI environment variables
(SERVER_NAME, HTTP_HOST, SCRIPT_NAME, and PATH_INFO), plus a
stock WSGI environment variable ('wsgi.url_scheme'). See
http://svn.repoze.org/repoze.vhm/trunk/repoze/vhm/middleware.py

  - The second part (in the application) just uses those values
according to their "stock" CGI meanings, and sets the 'SERVER_URL'
key in the request.  Once that is set, the stock ZPublisher
virtual hosting machinery is neutered. ;)  See
http://svn.repoze.org/repoze.zope2/trunk/repoze/zope2/z2bob.py


Tres.
- --
===
Tres Seaver  +1 540-429-0999  [EMAIL PROTECTED]
Palladion Software   "Excellence by Design"http://palladion.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFI5kZJ+gerLs4ltQ4RAh/WAKDDoOzY16/EkHbnuxONqXpAzzH3vACeNtoP
tvirU7lgA2wzyo3KI4BCq9w=
=fHOB
-END PGP SIGNATURE-

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] VHM / traverse subpath interaction bug?

2008-10-03 Thread Chris Withers
Dieter Maurer wrote:
>> Worse yet, if you go to:
>>
>> http://localhost:8080/VirtualHostBase/https/example.com:443/test/VirtualHostRoot/_vh_something/x/y/z
>>
>> ...you get:
>>
>> ['virtual_hosting', '/something', 'x', 'y', 'z']
>>
>> Anyone got any ideas as to what's going on here?
> 
> It is very strange that you want to define a Python Script as
> root of your site. This use case is simple not supported.

Who said anything about it being the root of a site? ;-)

I guess this wouldn't actually happen if the python script was after the 
  vritual host's root...

I actually bumped into this trying to get the antique ZRoundup product 
to work on Zope 2.11. The fix wasn't that pretty:

http://sourceforge.net/tracker/index.php?func=detail&aid=2141835&group_id=31577&atid=402788

(see the __before_traverse__ hook code)

>   A VHM needs to get control twice -- once to set things up
>   and once to set the virtual root.
>   It ensures to get control the second time by adding additional traversal
>   steps.

I bet repoze's VHM replacement doesn't need this ;-)
I wonder how they do it?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] VHM / traverse subpath interaction bug?

2008-10-03 Thread Dieter Maurer
Chris Withers wrote at 2008-10-2 08:13 +0100:
>I've tried this on Zope 2.8-2.11.1 and it behaves the same on all but 
>feels like a bug. I wonder if anyone else agrees or, better yet, knows 
>what's going on here...
>
>So, add a Script (Python) called test in the root on a Zope instance 
>running on port 8080 and in it put:
>
>return repr(traverse_subpath)
>
>Now go to:
>
>http://localhost:8080/test/x/y/z
>
>..you'll get:
>
>['x', 'y', 'z']
>
>...which makes sense.
>
>Now, if you have a VHM called virtual_hosting (as it normally is) if you 
>go to:
>
>http://localhost:8080/VirtualHostBase/https/example.com:443/test/VirtualHostRoot/x/y/z
>
>...you'll now get:
>
>['virtual_hosting', '/', 'x', 'y', 'z']
>
>...which doesn't seem right to me.
>
>Worse yet, if you go to:
>
>http://localhost:8080/VirtualHostBase/https/example.com:443/test/VirtualHostRoot/_vh_something/x/y/z
>
>...you get:
>
>['virtual_hosting', '/something', 'x', 'y', 'z']
>
>Anyone got any ideas as to what's going on here?

It is very strange that you want to define a Python Script as
root of your site. This use case is simple not supported.


What you see are implementation artifacts (in your not supported use case):

  A "Script (Python)" (among other types) stops traversal and
  makes the remaining traversal steps available in "traverse_subpath".

  A VHM needs to get control twice -- once to set things up
  and once to set the virtual root.
  It ensures to get control the second time by adding additional traversal
  steps.

  Usually, i.e. when the traversal steps leading to the root behave
  "normally", this works fine.
  But, if someone places objects with unusual traversal behaviour
  on the way to the virtual root (such as a "Script (Python)"),
  it may not work.



-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] VHM / traverse subpath interaction bug?

2008-10-02 Thread Chris Withers
Hi All,

I've tried this on Zope 2.8-2.11.1 and it behaves the same on all but 
feels like a bug. I wonder if anyone else agrees or, better yet, knows 
what's going on here...

So, add a Script (Python) called test in the root on a Zope instance 
running on port 8080 and in it put:

return repr(traverse_subpath)

Now go to:

http://localhost:8080/test/x/y/z

..you'll get:

['x', 'y', 'z']

...which makes sense.

Now, if you have a VHM called virtual_hosting (as it normally is) if you 
go to:

http://localhost:8080/VirtualHostBase/https/example.com:443/test/VirtualHostRoot/x/y/z

...you'll now get:

['virtual_hosting', '/', 'x', 'y', 'z']

...which doesn't seem right to me.

Worse yet, if you go to:

http://localhost:8080/VirtualHostBase/https/example.com:443/test/VirtualHostRoot/_vh_something/x/y/z

...you get:

['virtual_hosting', '/something', 'x', 'y', 'z']

Anyone got any ideas as to what's going on here?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )