On Oct 28, 4:48 pm, Remy Blank <[EMAIL PROTECTED]> 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*.

Got it. Thanks! I've added a minor comment to wiki that component
managers are not singletons. However, it seems that the role of
Component Manager deserves a separate paragraph.

> > 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.

The strange thing that in spite of CacheManager isolated in separate
ComponentManager, the extension point is registered correctly and
plugin is also called when needed. If I understand it right -
implementing plugins should be registered by the Environment in the
Environment. But how does it happen that they are registered as
isolated CacheManager observers?

> 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.

I see that my messages in trac.log are duplicated even without
mod_python with FastCGI. Does that mean they are using some lock
mechanism to access shared resources? Should plugins be aware and use
some API to do the same? I am using MySQL, but it would probably
create problems with SQLite if I decide to make my own database in
trac environment directory for whatever reason I have. Is it right?

> 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.

No-no-no. The whole thing is very interesting and it is not described
anywhere.

> > 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.

Sorry for taking your time, but I won't be able to sleep if I coudn't
get why my plugin observer does not receive required environment
attributes if extension point component was instantiated from other
component manager? I will try to investigate the code further
tomorrow.

Thanks for support. =)
--
WBR,
anatoly

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to