[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher/Browser - BrowserRequest.py:1.1.4.11

Gary Poster garyposter@earthlink.net
Wed, 17 Apr 2002 15:12:38 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/Publisher/Browser
In directory cvs.zope.org:/tmp/cvs-serv31331/Publisher/Browser

Modified Files:
      Tag: Zope-3x-branch
	BrowserRequest.py 
Log Message:
This commit makes the following changes:

The hookable zcml mechanism now requires an intermediary method to overwrite: see the hookables in Zope.ComponentArchitecture for an example

IServiceService, Service, and ServiceManager now all have this signature for the getService method: name.  They did use context, name.  The context, name signature is still used for the main ComponentArchitecture getService function.

the getServiceDefinition function now requires context

A ServiceContainer returns a wrapped ServiceManager; a ServiceManager returns a wrapped Service.

ServiceManager now overrides two ComponentArchitecture hooks: getServiceManager and getNextServiceManager

getNextServiceManager and getNextService are two new ComponentArchitecture functions useful for placeful services

The Zope.Publisher.Browser.BrowserRequest now includes the Zope2 class definition of record: this means that the placeful RoleService is inching forward towards working.

tests have been updated to reflect these changes.



=== Zope3/lib/python/Zope/Publisher/Browser/BrowserRequest.py 1.1.4.10 => 1.1.4.11 ===
         super(TestRequest, self).__init__(body_instream, outstream, _testEnv)
     
+# add class copied from Zope3
+class record:
+
+    # Allow access to record methods and values from DTML
+    __allow_access_to_unprotected_subobjects__=1
+
+    def __getattr__(self, key, default=None):
+        if key in ('get', 'keys', 'items', 'values', 'copy', 'has_key'):
+            return getattr(self.__dict__, key)
+        raise AttributeError, key
+
+    def __getitem__(self, key):
+        return self.__dict__[key]
+            
+    def __str__(self):
+        L1 = self.__dict__.items()
+        L1.sort()
+        return ", ".join(map(lambda item: "%s: %s" % item, L1)) 
+
+    def __repr__(self):
+        L1 = self.__dict__.items()
+        L1.sort()
+        return ', '.join(
+            map(lambda item: "%s: %s" % (item[0], repr(item[1])), L1))
+    
\ No newline at end of file