anatoly techtonik wrote:
> If ComponentManager
> implements singleton pattern then it doesn't matter where it is
> instantiated.

But Components are *not* singletons. There is exactly one instance of
each Component *per ComponentManager*, so in the case of Trac, *per
environment*.

> In my extension point manager component I do not need
> any of environment features Christian mentioned.

You do: you need component management.

> If I
> understand correctly the only outcome of skipping the Environment in
> my case is that my extension point can not be disabled in trac.ini

No, it means that when you call CacheManager(ComponentManager()), you
will instantiate a new manager and a new component every time.

There's another complexity that is hidden. When you run Trac in Apache
with worker threads and mod_python, and multiple projects, you will have
several environment loaded *at the same time*, one for each project.
Every environment will instantiate every active component once. The
environment is what ties these instances together.

But really, this is all plumbing that you shouldn't worry about. Your
only problem is that you don't have access to the environment from
inside CachedRepository, so you have to find a way to get it there.
That's all.

> Inherited and initialized. The line 50 is located inside of observer's
> method.
> http://python.pastebin.com/d2f6044ae

That looks correct indeed. It is most certainly related to your
instantiation of a ComponentManager. Fix the problem above, and the rest
should start working.

-- Remy

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to