--- a/req.py Fri Nov 16 11:41:38 2012 +0100
+++ b/req.py Fri Nov 16 11:52:06 2012 +0100
@@ -427,7 +427,7 @@
"""return the root url of the instance
"""
if secure:
- raise NotImplementedError()
+ return self.vreg.config.get('https-url', self.vreg.config['base-url'])
return self.vreg.config['base-url']
# abstract methods to override according to the web front-end #############
--- a/test/unittest_rset.py Fri Nov 16 11:41:38 2012 +0100
+++ b/test/unittest_rset.py Fri Nov 16 11:52:06 2012 +0100
@@ -112,6 +112,17 @@
# '%stask/title/go' % baseurl)
# empty _restpath should not crash
self.compare_urls(req.build_url('view', _restpath=''), baseurl)
+ self.assertNotIn('https', req.build_url('view', vid='foo', rql='yo',
+ __secure__=True))
+ try:
+ self.config.global_set_option('https-url', 'https://testing.fr/')
+ self.assertTrue('https', req.build_url('view', vid='foo', rql='yo',
+ __secure__=True))
+ self.compare_urls(req.build_url('view', vid='foo', rql='yo',
+ __secure__=True),
+ '%sview?vid=foo&rql=yo' % req.base_url(secure=True))
+ finally:
+ self.config.global_set_option('https-url', None)
def test_build(self):