[Zope-Coders] GlobalRequestPatch into Zope Core

Stephan Richter srichter@cbu.edu
Sun, 28 Oct 2001 11:14:57 -0600


--=====================_114519430==_.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed

Hello everyone,

as you may know there was quiet some discussion a while ago about adding 
the GlobalRequestPatch into the Zope core. You can find the patch at 
http://www.zope.org/Members/tmclaugh/GlobalRequestPatch. It was turned 
down, since ZC feels very uneasy about adding another method to Globals.

What does the GlobalRequestPatch do? It adds a method called get_request() 
to Globals that allows you to access the REQUEST variable everywhere in 
your Python code, without having to pass it as an argument or call it via 
self.REQUEST. It is especially needed in __getattr__, since there the 
self.REQUEST variable is not available.
Why do we need it? Well, three internationalization products now use the 
Patch: Tim McLaughlin's recent product, Localizer and ZBabel. All of these 
projects overwrite __getattr__ but need to know the language before they 
can return the appropriate attribute. The language is usually found in the 
REQUEST itself or in 'HTTP_ACCEPT_LANGUAGE', which is the standard HTTP 
language string.

A compromise: Even though the get_request() method would not make it into 
the Globals module, it would be very helpful to have the rest of the patch 
in the core. You can then access the method via 
ZPublisher.Request.get_request(). I think that would be fine, thinking of 
the fairly rare cases you would need the method for.

BTW, the proposal is here: 
http://www.zope.org/Wikis/DevSite/Proposals/GlobalGetRequest. Please note 
that Tim wrote the proposal when he did not know much about Zope, so some 
of his arguments seem to be incorrect.

Please let me know what you guys think about it and I will (if I get 
positive responses) add it to Zope. (A good chance to test my CVS access. :-) )

Regards,
Stephan

--
Stephan Richter
CBU - Physics and Chemistry Student
Web2k - Web Design/Development & Technical Project Management
--=====================_114519430==_.ALT
Content-Type: text/html; charset="us-ascii"

<html>
Hello everyone,<br><br>
as you may know there was quiet some discussion a while ago about adding
the GlobalRequestPatch into the Zope core. You can find the patch at
<a href="http://www.zope.org/Members/tmclaugh/GlobalRequestPatch" eudora="autourl">http://www.zope.org/Members/tmclaugh/GlobalRequestPatch</a>.
It was turned down, since ZC feels very uneasy about adding another
method to Globals. <br><br>
What does the GlobalRequestPatch do? It adds a method called
get_request() to Globals that allows you to access the REQUEST variable
everywhere in your Python code, without having to pass it as an argument
or call it via self.REQUEST. It is especially needed in __getattr__,
since there the self.REQUEST variable is not available.<br>
Why do we need it? Well, three internationalization products now use the
Patch: Tim <b>McLaughlin's recent</b> product, Localizer and ZBabel. All
of these projects overwrite __getattr__ but need to know the language
before they can return the appropriate attribute. The language is usually
found in the REQUEST itself or in 'HTTP_ACCEPT_LANGUAGE', which is the
standard HTTP language string.<br><br>
A compromise: Even though the get_request() method would not make it into
the Globals module, it would be very helpful to have the rest of the
patch in the core. You can then access the method via
ZPublisher.Request.get_request(). I think that would be fine, thinking of
the fairly rare cases you would need the method for.<br><br>
BTW, the proposal is here:
<a href="http://www.zope.org/Wikis/DevSite/Proposals/GlobalGetRequest" eudora="autourl">http://www.zope.org/Wikis/DevSite/Proposals/GlobalGetRequest</a>.
Please note that Tim wrote the proposal when he did not know much about
Zope, so some of his arguments seem to be incorrect. <br><br>
Please let me know what you guys think about it and I will (if I get
positive responses) add it to Zope. (A good chance to test my CVS access.
:-) )<br><br>
Regards,<br>
Stephan<br>
<x-sigsep><p></x-sigsep>
--<br>
Stephan Richter<br>
CBU - Physics and Chemistry Student<br>
Web2k - Web Design/Development &amp; Technical Project Management</html>

--=====================_114519430==_.ALT--