[Zope3-checkins] SVN: Zope3/trunk/src/zope/ Removed HTTPRequest.__anotations__

Dmitry Vasiliev dima at hlabs.spb.ru
Sat Nov 5 07:16:38 EST 2005


Log message for revision 39906:
  Removed HTTPRequest.__anotations__
  

Changed:
  U   Zope3/trunk/src/zope/app/publisher/browser/__init__.py
  U   Zope3/trunk/src/zope/app/publisher/browser/configure.zcml
  U   Zope3/trunk/src/zope/app/traversing/tests/test_lang.py
  U   Zope3/trunk/src/zope/publisher/http.py
  U   Zope3/trunk/src/zope/publisher/tests/test_browserlanguages.py

-=-
Modified: Zope3/trunk/src/zope/app/publisher/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/__init__.py	2005-11-05 11:41:07 UTC (rev 39905)
+++ Zope3/trunk/src/zope/app/publisher/browser/__init__.py	2005-11-05 12:16:38 UTC (rev 39906)
@@ -24,7 +24,6 @@
 from zope.i18n.interfaces import IUserPreferredLanguages
 from zope.i18n.interfaces import IModifiableUserPreferredLanguages
 
-from zope.app.annotation import IAnnotations
 from zope.app.location import Location
 from zope.app.publisher.interfaces.browser import IBrowserView
 from zope.publisher.interfaces.browser import ISkin
@@ -155,7 +154,7 @@
         return languages_data["cached"]
 
     def _getLanguagesData(self):
-        annotations = IAnnotations(self.request)
+        annotations = self.request.annotations
         languages_data = annotations.get(key)
         if languages_data is None:
             annotations[key] = languages_data = {}
@@ -166,8 +165,7 @@
     implements(IModifiableUserPreferredLanguages)
 
     def setPreferredLanguages(self, languages):
-        annotations = IAnnotations(self.request)
-        languages_data = annotations.get(key)
+        languages_data = self.request.annotations.get(key)
         if languages_data is None:
             # Better way to create a compatible with
             # IModifiableUserPreferredLanguages adapter is to use

Modified: Zope3/trunk/src/zope/app/publisher/browser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/configure.zcml	2005-11-05 11:41:07 UTC (rev 39905)
+++ Zope3/trunk/src/zope/app/publisher/browser/configure.zcml	2005-11-05 12:16:38 UTC (rev 39906)
@@ -21,7 +21,7 @@
 <content class="zope.publisher.browser.BrowserRequest">
   <allow
     interface="zope.publisher.interfaces.browser.IBrowserApplicationRequest"
-    attributes="response locale __str__ __annotations__"
+    attributes="response locale __str__"
     />
   <allow
     interface="zope.component.interfaces.IPresentationRequest" />

Modified: Zope3/trunk/src/zope/app/traversing/tests/test_lang.py
===================================================================
--- Zope3/trunk/src/zope/app/traversing/tests/test_lang.py	2005-11-05 11:41:07 UTC (rev 39905)
+++ Zope3/trunk/src/zope/app/traversing/tests/test_lang.py	2005-11-05 12:16:38 UTC (rev 39906)
@@ -22,6 +22,8 @@
 from zope.publisher.interfaces.http import IHTTPRequest
 from zope.i18n.interfaces import IModifiableUserPreferredLanguages
 
+from zope.publisher.tests import test_browserlanguages
+
 from zope.app.testing import ztapi
 from zope.app.annotation import IAttributeAnnotatable, IAnnotations
 from zope.app.annotation.attribute import AttributeAnnotations
@@ -31,14 +33,8 @@
 from zope.app.traversing.namespace import lang
 
 
-class TestRequest(dict):
+class TestRequest(test_browserlanguages.TestRequest):
 
-    def __init__(self, languages):
-        self["HTTP_ACCEPT_LANGUAGE"] = languages
-
-    def setupLocale(self):
-        pass
-
     def shiftNameToApplication(self):
         self.shifted = True
 

Modified: Zope3/trunk/src/zope/publisher/http.py
===================================================================
--- Zope3/trunk/src/zope/publisher/http.py	2005-11-05 11:41:07 UTC (rev 39905)
+++ Zope3/trunk/src/zope/publisher/http.py	2005-11-05 12:16:38 UTC (rev 39906)
@@ -266,7 +266,6 @@
         'method',         # The upper-cased request method (REQUEST_METHOD)
         '_locale',        # The locale for the request
         '_vh_root',       # Object at the root of the virtual host
-        '__annotations__',
         )
 
     retry_max_count = 3    # How many times we're willing to retry

Modified: Zope3/trunk/src/zope/publisher/tests/test_browserlanguages.py
===================================================================
--- Zope3/trunk/src/zope/publisher/tests/test_browserlanguages.py	2005-11-05 11:41:07 UTC (rev 39905)
+++ Zope3/trunk/src/zope/publisher/tests/test_browserlanguages.py	2005-11-05 12:16:38 UTC (rev 39906)
@@ -35,6 +35,7 @@
 class TestRequest(dict):
 
     def __init__(self, languages):
+        self.annotations = {}
         self.localized = False
         self["HTTP_ACCEPT_LANGUAGE"] = languages
 



More information about the Zope3-Checkins mailing list