On Wed, Aug 6, 2014 at 9:53 PM, <[email protected]> wrote:

> Author: rjollos
> Date: Thu Aug  7 04:53:34 2014
> New Revision: 1616401
>
> URL: http://svn.apache.org/r1616401
> Log:
> 0.8dev: Correctly set `environment_factory` and `request_factory` on
> multiproduct upgrade. Refs #795.
>
> Modified:
>     bloodhound/trunk/bloodhound_multiproduct/multiproduct/api.py
>     bloodhound/trunk/trac/trac/hooks.py
>
> Modified: bloodhound/trunk/bloodhound_multiproduct/multiproduct/api.py
> URL:
> http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_multiproduct/multiproduct/api.py?rev=1616401&r1=1616400&r2=1616401&view=diff
>
> ==============================================================================
> --- bloodhound/trunk/bloodhound_multiproduct/multiproduct/api.py (original)
> +++ bloodhound/trunk/bloodhound_multiproduct/multiproduct/api.py Thu Aug
>  7 04:53:34 2014
> @@ -506,16 +506,15 @@ class MultiProductSystem(Component):
>
>      def _enable_multiproduct_hooks(self):
>          # enable multi product hooks in environment configuration
> -        import multiproduct.hooks
> -        import inspect
>
>          config_update = False
> -        hook_path =
> os.path.realpath(inspect.getsourcefile(multiproduct.hooks))
>          if not 'environment_factory' in self.env.config['trac']:
> -            self.env.config['trac'].set('environment_factory', hook_path)
> +            self.env.config['trac'].set('environment_factory',
> +
>  'multiproduct.hooks.MultiProductEnvironmentFactory')
>              config_update = True
>          if not 'request_factory' in self.env.config['trac']:
> -            self.env.config['trac'].set('request_factory', hook_path)
> +            self.env.config['trac'].set('request_factory',
> +
>  'multiproduct.hooks.ProductRequestFactory')
>              config_update = True
>          if config_update:
>              self.log.info(
>
> Modified: bloodhound/trunk/trac/trac/hooks.py
> URL:
> http://svn.apache.org/viewvc/bloodhound/trunk/trac/trac/hooks.py?rev=1616401&r1=1616400&r2=1616401&view=diff
>
> ==============================================================================
> --- bloodhound/trunk/trac/trac/hooks.py (original)
> +++ bloodhound/trunk/trac/trac/hooks.py Thu Aug  7 04:53:34 2014
> @@ -87,10 +87,12 @@ def install_global_hooks():
>
>
>  def environment_factory(env):
> +    print load_class(env.config.get('trac', 'environment_factory'))
>      return load_class(env.config.get('trac', 'environment_factory'))
>
>
>  def request_factory(env):
> +    print load_class(env.config.get('trac', 'request_factory'))
>      return load_class(env.config.get('trac', 'request_factory'))
>

On upgrade, the following change should be made:

[trac]
environment_factory = multiproduct.hooks.MultiProductEnvironmentFactory
request_factory = multiproduct.hooks.ProductRequestFactory

We don't currently have a mechanism to automatically upgrade installations,
so this step will need to done manually on upgrade. We can include the step
in the release notes.

If the change tests out okay, I will go ahead and prepare release 0.8.

Reply via email to