You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by Apache Bloodhound <bl...@incubator.apache.org> on 2013/01/02 07:45:48 UTC
[Apache Bloodhound] #323: Add support for custom hooks configurable
through trac.ini
#323: Add support for custom hooks configurable through trac.ini
-----------------------------------+------------------
Reporter: jure | Owner: jure
Type: enhancement | Status: new
Priority: major | Milestone:
Component: multiproduct | Version:
Keywords: bep-0003 multiproduct |
-----------------------------------+------------------
Multiproduct legacy data schema support (#288) requires `IterableCursor`
and `Environment` classes to be replaced by custom implementation(s). trac
code should be changed to invoke configurable 'hooks'. This would enable
bloodhound_multiproduct plugin to install custom class implementation(s).
--
Ticket URL: <https://issues.apache.org/bloodhound/ticket/323>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker
Re: [Apache Bloodhound] #323: Add support for custom hooks
configurable through trac.ini
Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#323: Add support for custom hooks configurable through trac.ini
---------------------------+-----------------------------------
Reporter: jure | Owner: jure
Type: enhancement | Status: assigned
Priority: major | Milestone:
Component: multiproduct | Version:
Resolution: | Keywords: bep-0003 multiproduct
---------------------------+-----------------------------------
Comment (by jure):
For now, global hooks are 'installed' directly from `trac/__init__.py`, at
least until we find a more suitable solution. The hooks that get executed
are hardcoded in trac/hooks.py, so there's currently no easy way of
disabling the `trac.env.Environment` and `trac.db.util.IterableCursor`.
--
Ticket URL: <https://issues.apache.org/bloodhound/ticket/323#comment:2>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker
Re: [Apache Bloodhound] #323: Add support for custom hooks
configurable through trac.ini
Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#323: Add support for custom hooks configurable through trac.ini
---------------------------+-----------------------------------
Reporter: jure | Owner: jure
Type: enhancement | Status: closed
Priority: major | Milestone: Release 6
Component: multiproduct | Version:
Resolution: fixed | Keywords: bep-0003 multiproduct
---------------------------+-----------------------------------
Changes (by olemis):
* milestone: => Release 6
--
Ticket URL: <https://issues.apache.org/bloodhound/ticket/323#comment:4>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker
Re: [Apache Bloodhound] #323: Add support for custom hooks configurable
through trac.ini
Posted by Jure Zitnik <ju...@digiverse.si>.
On 1/14/13 7:09 PM, Olemis Lang wrote:
> On 1/14/13, Jure Zitnik <ju...@digiverse.si> wrote:
>> On 1/11/13 9:27 PM, Olemis Lang wrote:
>>> On 1/11/13, Jure Zitnik <ju...@digiverse.si> wrote:
> [...]
>> I'm aware of the configuration inheritance, the problem is that
>> inheritance by itself does not solve the issue. Let me try to elaborate
>> on the problem a bit more ;)
>>
> I kind of understand what you mean now . I'm of the idea that Trac's
> dispatch_request is not particularly useful for us . That's why I
> suggested in BEP 3 to get rid of it and override the dispatching
> system by generating our own deployment scripts , using our own entry
> points , etc ...
>
> ... about global.ini , well, I'm not sure right now what should I
> suggest about it .
>
For now, global hooks are executed directly from trac/__init__.py, at
least until we find a more suitable solution. The hooks that get
executed are hardcoded in trac/hooks.py, so there's currently no easy
way of disabling the monkey patching of trac.env.Environment and
trac.db.util.IterableCursor. We might revisit this at a later point in
time though.
Cheers,
Jure
Re: [Apache Bloodhound] #323: Add support for custom hooks
configurable through trac.ini
Posted by Olemis Lang <ol...@gmail.com>.
On 1/14/13, Jure Zitnik <ju...@digiverse.si> wrote:
> On 1/11/13 9:27 PM, Olemis Lang wrote:
>> On 1/11/13, Jure Zitnik <ju...@digiverse.si> wrote:
>
[...]
>
> I'm aware of the configuration inheritance, the problem is that
> inheritance by itself does not solve the issue. Let me try to elaborate
> on the problem a bit more ;)
>
I kind of understand what you mean now . I'm of the idea that Trac's
dispatch_request is not particularly useful for us . That's why I
suggested in BEP 3 to get rid of it and override the dispatching
system by generating our own deployment scripts , using our own entry
points , etc ...
... about global.ini , well, I'm not sure right now what should I
suggest about it .
--
Regards,
Olemis.
Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/
Featured article:
Re: [Apache Bloodhound] #323: Add support for custom hooks configurable
through trac.ini
Posted by Jure Zitnik <ju...@digiverse.si>.
On 1/11/13 9:27 PM, Olemis Lang wrote:
> On 1/11/13, Jure Zitnik <ju...@digiverse.si> wrote:
> [...]
>> So I was playing with an idea to introduce global.ini (or boot.ini or
>> something like that) that would be located on a well-known location in
>> the installation tree (trac.env_parent_dir for example) and would hold
>> global (=common for all environments) settings (custom hooks for
>> starters). The question is where this configuration is supposed to be
>> loaded/processed. trac/__init__.py would be one place but I'm not sure
>> that's the right one :)
>>
> IMO there's no reason to spend some time developing something new for
> this to happen . The reason is *not* that your reasoning is not
> correct . The fact is that this (configuration inheritance) has been
> already there since a long time .
I'm aware of the configuration inheritance, the problem is that
inheritance by itself does not solve the issue. Let me try to elaborate
on the problem a bit more ;)
What I'm trying to achieve is to monkey patch trac.env.Environment and
trac.db.util.IterableCursor. To enable multi-product support, both
classes should be replaced by our implementation, namely with
multiproduct.env.Environment and
multiproduct.dbcursor.BloodhoundIterableCursor. As things are currently
implemented, the code that does monkey patching (hooks) is executed
inside trac.web.main.dispatch_request. At this point, the environment
(based on the URL) has already been selected (but not instantiated!) so
the hook path can be read from that specific environment's configuration
(as the path to the .ini is known) and hooks can be executed. This
happens just before trac.env.open_environment and thus the
open_environment already instantiates multiproduct.env.Environment. So
this works fine when running within a web request (through
trac.web.main.dispatch_request).
But, there is code that doesn't at all get executed through that
(dispatch_request) execution path. Example would be tests. To enable
multi-product functionality in test code (or any other code that doesn't
get executed through dispatch_request), the hooks (monkey patching)
should be executed rather soon, before the first trac.env.Environment
gets instantiated. So, the question is how to achieve that. Note that
there is no 'environment' at that point. The idea was to have a
global.ini or something similar on a well known path (not really sure
what that would be though). trac/__init__.py would be modified to load
configuration from that well known path and execute configured hooks.
If this approach (configurable hooks) is not feasible, we can always
hardcode them in trac/__init__.py ...
Cheers,
Jure
Re: [Apache Bloodhound] #323: Add support for custom hooks
configurable through trac.ini
Posted by Olemis Lang <ol...@gmail.com>.
On 1/11/13, Jure Zitnik <ju...@digiverse.si> wrote:
>
[...]
>
> So I was playing with an idea to introduce global.ini (or boot.ini or
> something like that) that would be located on a well-known location in
> the installation tree (trac.env_parent_dir for example) and would hold
> global (=common for all environments) settings (custom hooks for
> starters). The question is where this configuration is supposed to be
> loaded/processed. trac/__init__.py would be one place but I'm not sure
> that's the right one :)
>
IMO there's no reason to spend some time developing something new for
this to happen . The reason is *not* that your reasoning is not
correct . The fact is that this (configuration inheritance) has been
already there since a long time . If you have one such file e.g.
global.ini and add the following lines in trac.ini
{{{
#!ini
[inherit]
file = /path/to/global.ini
}}}
then trac.ini will inherit all the settings specified in there .
So IMO , instead of modifying the source code to introduce such global
configuration files , I'd rather suggest to setup this at deployment
time e.g. in installer script .
PS: configuration inheritance even works for product environments ...
mainly in two (complementary) ways :
1. if there's a value for [inherit] file option stored
product config table (i.e. in the database) then
it will work just like explained above for ini files .
Relative paths are resolved relative to
/path/to/env/conf sub-folder
2. `parents` arg in multiproduct.config.Configuration.__init__
--
Regards,
Olemis.
Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/
Featured article:
Re: [Apache Bloodhound] #323: Add support for custom hooks configurable
through trac.ini
Posted by Jure Zitnik <ju...@digiverse.si>.
Currently, this (loading configured hooks) has been implemented just
before opening the environment within trac.web.main.dispatch_request
(when the environment & it's path is already known/resolved). The hook
paths are loaded from the selected environment's trac.ini and executed
appropriately. As this is enough when processing requests within
already selected environment, it does not cover tests and other code
that might use trac.env.Environment and/or trac.db.IterableCursor (these
are the two classes that get replaced atm) out of the (selected)
environment request scope.
So I was playing with an idea to introduce global.ini (or boot.ini or
something like that) that would be located on a well-known location in
the installation tree (trac.env_parent_dir for example) and would hold
global (=common for all environments) settings (custom hooks for
starters). The question is where this configuration is supposed to be
loaded/processed. trac/__init__.py would be one place but I'm not sure
that's the right one :)
Any suggestions/comments on this?
Cheers,
Jure
On 1/2/13 7:45 AM, Apache Bloodhound wrote:
> #323: Add support for custom hooks configurable through trac.ini
> -----------------------------------+------------------
> Reporter: jure | Owner: jure
> Type: enhancement | Status: new
> Priority: major | Milestone:
> Component: multiproduct | Version:
> Keywords: bep-0003 multiproduct |
> -----------------------------------+------------------
> Multiproduct legacy data schema support (#288) requires `IterableCursor`
> and `Environment` classes to be replaced by custom implementation(s). trac
> code should be changed to invoke configurable 'hooks'. This would enable
> bloodhound_multiproduct plugin to install custom class implementation(s).
>
Re: [Apache Bloodhound] #323: Add support for custom hooks
configurable through trac.ini
Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#323: Add support for custom hooks configurable through trac.ini
---------------------------+-----------------------------------
Reporter: jure | Owner: jure
Type: enhancement | Status: closed
Priority: major | Milestone:
Component: multiproduct | Version:
Resolution: fixed | Keywords: bep-0003 multiproduct
---------------------------+-----------------------------------
Changes (by jure):
* status: assigned => closed
* resolution: => fixed
--
Ticket URL: <https://issues.apache.org/bloodhound/ticket/323#comment:3>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker
Re: [Apache Bloodhound] #323: Add support for custom hooks
configurable through trac.ini
Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#323: Add support for custom hooks configurable through trac.ini
---------------------------+-----------------------------------
Reporter: jure | Owner: jure
Type: enhancement | Status: assigned
Priority: major | Milestone:
Component: multiproduct | Version:
Resolution: | Keywords: bep-0003 multiproduct
---------------------------+-----------------------------------
Changes (by jure):
* status: new => assigned
--
Ticket URL: <https://issues.apache.org/bloodhound/ticket/323#comment:1>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker