Author: jure Date: Wed Feb 27 15:22:22 2013 New Revision: 1450802 URL: http://svn.apache.org/r1450802 Log: Make sure global environment absolute href is set before instantiating product environment, product URL typo
Modified: incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/env.py incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/hooks.py Modified: incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/env.py URL: http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/env.py?rev=1450802&r1=1450801&r2=1450802&view=diff ============================================================================== --- incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/env.py (original) +++ incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/env.py Wed Feb 27 15:22:22 2013 @@ -642,7 +642,7 @@ class ProductEnvironment(Component, Comp self.log.warn("product_base_url option not set in " "configuration, generated links may be " "incorrect") - urlpattern = 'product/$(prefix)s' + urlpattern = 'products/$(prefix)s' url = urlpattern.replace('$(', '%(') \ .replace('%(prefix)s', self.product.prefix) \ .replace('%(name)s', self.product.name) Modified: incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/hooks.py URL: http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/hooks.py?rev=1450802&r1=1450801&r2=1450802&view=diff ============================================================================== --- incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/hooks.py (original) +++ incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/hooks.py Wed Feb 27 15:22:22 2013 @@ -22,6 +22,7 @@ import multiproduct.dbcursor import re from trac.hooks import EnvironmentFactoryBase +from trac.web.main import RequestWithSession PRODUCT_RE = re.compile(r'^/products/(?P<pid>[^/]*)(?P<pathinfo>.*)') @@ -35,5 +36,11 @@ class MultiProductEnvironmentFactory(Env if m: pid = m.group('pid') if pid: + if not global_env._abs_href: + # make sure global environment absolute href is set before + # instantiating product environment. This would normally + # happen from within trac.web.main.dispatch_request + req = RequestWithSession(environ, None) + global_env._abs_href = req.abs_href env = multiproduct.env.ProductEnvironment(global_env, pid) return env