[z3-checkins] r41942 - in z3/deliverance/DeliveranceVHoster/trunk: . dvhoster tests
ianb at codespeak.net
ianb at codespeak.net
Fri Apr 6 18:27:05 CEST 2007
Author: ianb
Date: Fri Apr 6 18:27:04 2007
New Revision: 41942
Modified:
z3/deliverance/DeliveranceVHoster/trunk/dvhoster/debuginterp.py
z3/deliverance/DeliveranceVHoster/trunk/setup.py
z3/deliverance/DeliveranceVHoster/trunk/tests/test_init_func.py
Log:
Fixed the error message generator, which had problems when recursive errors occurred. Requires update from Paste
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 18:27:04 2007
@@ -14,12 +14,26 @@
error_container = etree.Element('div')
error_container.attrib['style'] = self.error_style
- if not current_environ.get('dvhoster.has_errors'):
- current_environ['dvhoster.has_errors'] = True
- remote_uri = current_environ['dvhoster.remote_uri']
- remote_uri += current_environ.get('PATH_INFO', '')
- if current_environ.get('QUERY_STRING'):
- remote_uri += '?' + current_environ['QUERY_STRING']
+ environ = None
+ for match_environ in current_environ._object_stack():
+ if 'dvhoster.remote_uri' in match_environ:
+ # This was the original request that we are interested in
+ environ = match_environ
+ break
+ else:
+ warnings.warn(
+ "No environment with dvhoster.remote_uri can be found, "
+ "which is unexpected")
+ # But lets not actually keep the error message from working
+ assert 0
+ return error
+ environ = current_environ._current_obj()
+ if not environ.get('dvhoster.has_errors'):
+ environ['dvhoster.has_errors'] = True
+ remote_uri = environ.get('dvhoster.remote_uri', '')
+ remote_uri += environ.get('PATH_INFO', '')
+ if environ.get('QUERY_STRING'):
+ remote_uri += '?' + environ['QUERY_STRING']
link = etree.Element('a')
link.attrib['href'] = remote_uri
link.attrib['target'] = '_blank'
Modified: z3/deliverance/DeliveranceVHoster/trunk/setup.py
==============================================================================
--- z3/deliverance/DeliveranceVHoster/trunk/setup.py (original)
+++ z3/deliverance/DeliveranceVHoster/trunk/setup.py Fri Apr 6 18:27:04 2007
@@ -8,7 +8,7 @@
#author_email="",
#url="",
install_requires=[
- 'Paste>1.1.1',
+ 'Paste==dev,>=1.3.1dev-r6419',
'PasteScript',
'Deliverance',
'WSGIFilter',
Modified: z3/deliverance/DeliveranceVHoster/trunk/tests/test_init_func.py
==============================================================================
--- z3/deliverance/DeliveranceVHoster/trunk/tests/test_init_func.py (original)
+++ z3/deliverance/DeliveranceVHoster/trunk/tests/test_init_func.py Fri Apr 6 18:27:04 2007
@@ -65,6 +65,13 @@
res = app.get('/', extra_environ={'HTTP_X_NO_THEME': '1', 'HTTP_HOST': 'foo3.openplans.org'})
assert 'Plone' not in res
+def test_error_message():
+ # This will give us some content that can't be themed, testing the
+ # error messages:
+ setup_module(None, text=False)
+ res = app.get('/', extra_environ={'HTTP_HOST': 'foo4.openplans.org'})
+ res.mustcontain('View original content source')
+
def setup_module(module, text=True):
from paste.script import testapp
app = testapp.TestApplication(text=text)
More information about the z3-checkins
mailing list