[z3-checkins] r41941 - z3/deliverance/DeliveranceVHoster/trunk/dvhoster

ianb at codespeak.net ianb at codespeak.net
Fri Apr 6 17:33:52 CEST 2007


Author: ianb
Date: Fri Apr  6 17:33:52 2007
New Revision: 41941

Modified:
   z3/deliverance/DeliveranceVHoster/trunk/dvhoster/debuginterp.py
   z3/deliverance/DeliveranceVHoster/trunk/dvhoster/dispatcher.py
Log:
Save remote_uri in the environment; use that in the error formatter, instead of redoing the remote_uri matching (which is more complex now)

Modified: z3/deliverance/DeliveranceVHoster/trunk/dvhoster/debuginterp.py
==============================================================================
--- z3/deliverance/DeliveranceVHoster/trunk/dvhoster/debuginterp.py	(original)
+++ z3/deliverance/DeliveranceVHoster/trunk/dvhoster/debuginterp.py	Fri Apr  6 17:33:52 2007
@@ -16,23 +16,12 @@
         error_container.attrib['style'] = self.error_style
         if not current_environ.get('dvhoster.has_errors'):
             current_environ['dvhoster.has_errors'] = True
-            domain_info = current_environ['dvhoster.domain_info']
-            remote_uris = domain_info.remote_uris
-            path_info = current_environ['PATH_INFO']
-            for remote_info in remote_uris:
-                if (path_info.startswith(remote_info['path'])
-                    or not path_info and remote_info['path'] == '/'):
-                    remote = remote_info['remote_uri']
-                    break
-            else:
-                assert 0, (
-                    "Nothing in remote_uris (%r) matches PATH_INFO=%r"
-                    % (remote_uris, path_info))
-            remote += current_environ.get('PATH_INFO', '')
+            remote_uri = current_environ['dvhoster.remote_uri']
+            remote_uri += current_environ.get('PATH_INFO', '')
             if current_environ.get('QUERY_STRING'):
-                remote += '?' + current_environ['QUERY_STRING']
+                remote_uri += '?' + current_environ['QUERY_STRING']
             link = etree.Element('a')
-            link.attrib['href'] = remote
+            link.attrib['href'] = remote_uri
             link.attrib['target'] = '_blank'
             link.text = 'View original content source'
             container = etree.Element('div')

Modified: z3/deliverance/DeliveranceVHoster/trunk/dvhoster/dispatcher.py
==============================================================================
--- z3/deliverance/DeliveranceVHoster/trunk/dvhoster/dispatcher.py	(original)
+++ z3/deliverance/DeliveranceVHoster/trunk/dvhoster/dispatcher.py	Fri Apr  6 17:33:52 2007
@@ -107,6 +107,8 @@
                                          for r in remote_uris])))
             return exc(environ, start_response)
 
+        environ['dvhoster.remote_uri'] = remote_uri
+
         should_theme_uri = True
         if self.should_theme_uri:
             should_theme_uri = self.should_theme_uri(


More information about the z3-checkins mailing list