[Checkins] SVN: PluggableAuthService/branches/rossp-access-log/PluggableAuthService.py Play nicely with tests or other setups that don't match our access.log

Ross Patterson me at rpatterson.net
Thu Sep 13 16:07:13 EDT 2007


Log message for revision 79620:
  Play nicely with tests or other setups that don't match our access.log
  hack
  

Changed:
  U   PluggableAuthService/branches/rossp-access-log/PluggableAuthService.py

-=-
Modified: PluggableAuthService/branches/rossp-access-log/PluggableAuthService.py
===================================================================
--- PluggableAuthService/branches/rossp-access-log/PluggableAuthService.py	2007-09-13 19:29:59 UTC (rev 79619)
+++ PluggableAuthService/branches/rossp-access-log/PluggableAuthService.py	2007-09-13 20:07:12 UTC (rev 79620)
@@ -256,15 +256,16 @@
                                   , roles
                                   ):
 
-                # Hack the underlying request headers so that the new
-                # user will be displayed in the access log/Z2.log
-                request.response.stdout._request._header_cache[
-                    'authorization'] = 'basic %s' % (
-                    '%s:<from %s>' % (
-                    user.getUserName(),
-                    '/'.join(self.getPhysicalPath()))
-                    ).encode('base64')
-
+                if hasattr(request.response.stdout, '_request'):
+                    # Hack the underlying request headers so that the new
+                    # user will be displayed in the access log/Z2.log
+                    request.response.stdout._request._header_cache[
+                        'authorization'] = 'basic %s' % (
+                        '%s:<from %s>' % (
+                            user.getUserName(),
+                            '/'.join(self.getPhysicalPath()))
+                        ).encode('base64')
+                    
                 return user
 
         if not is_top:



More information about the Checkins mailing list