# HG changeset patch # User Sylvain Thénault # Date 1287994547 -7200 # Node ID e7ff604491b22ee7320af44d495b30f5203d0685 # Parent 2f2871fbfb517921642d8f490003cd06298fc442 [dbapi] web request compatibility fixes diff -r 2f2871fbfb51 -r e7ff604491b2 dbapi.py --- a/dbapi.py Mon Oct 25 10:14:01 2010 +0200 +++ b/dbapi.py Mon Oct 25 10:15:47 2010 +0200 @@ -570,6 +570,7 @@ req.get_header = lambda x, default=None: default req.set_session = lambda session, user=None: DBAPIRequest.set_session( req, session, user) + req.relative_path = lambda includeparams=True: '' else: req = DBAPIRequest(self.vreg) req.set_session(DBAPISession(self)) diff -r 2f2871fbfb51 -r e7ff604491b2 test/unittest_dbapi.py --- a/test/unittest_dbapi.py Mon Oct 25 10:14:01 2010 +0200 +++ b/test/unittest_dbapi.py Mon Oct 25 10:15:47 2010 +0200 @@ -76,7 +76,10 @@ self.cnx.use_web_compatible_requests('http://perdu.com') req = self.cnx.request() self.assertEqual(req.base_url(), 'http://perdu.com') + self.assertEqual(req.from_controller(), 'view') + self.assertEqual(req.relative_path(), '') req.ajax_replace_url('domid') # don't crash + req.user.cw_adapt_to('IBreadCrumbs') # don't crash if __name__ == '__main__': from logilab.common.testlib import unittest_main