On Oct 28, 2:29 pm, Remy Blank <[EMAIL PROTECTED]> wrote:

> > Done. But I have to patch Trac to provide extension point to my plugin
> > and I plugged it in existing class -
> >http://trac.edgewall.org/attachment/ticket/781/icachechangesetlistene...
>
> > Christian explained that it was rather unusual usage and there was no
> > other choice than to use ComponentManager
> >http://trac.edgewall.org/ticket/7757#comment:5
>
> Not quite. What he said is that, because the CachedRepository class is
> not a Component, you'll have to get access to the environment through
> some other means, probably by passing the environment to
> CachedRepository.__init__.
>
> But you should *never* instantiate a ComponentManager in Trac. The only
> one that should ever exist is the environment.

I am puzzled. Should there be a warning on TracDev page then? 15
minutes ago I was sure that my patch is right. If ComponentManager
implements singleton pattern then it doesn't matter where it is
instantiated. In my extension point manager component I do not need
any of environment features Christian mentioned. It doesn't seem to be
a good design to introduce Environment component as a God Object. 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  I
wonder why would anyone want to do this? And what will happen to the
code that assumes that component is always available? Should I write
extra code to check if my component is returned ok?

> He also suggested having a look at #7723, where we update the caching
> mechanism to work with multiple repositories, and in particular,
> introduce an IRepositoryChangeListener, which will probably get an
> additional method to notify about revprop changes or something similar
> at some point.

I am afraid that before going with future work on multiple
repositories I still need to understand why the current Component
model doesn't work for me. I would gladly update my patch for 0.12
when it will be released, but for now I would like to get everything
working on 0.11.1

> > Unfortunately this doesn't happen.
>
> (...)
>
> >   File "/home/.december/trex/fartrac/plugins/mantis_tickets_query.py",
> > line 50, in edit_changeset
> >     self.log.info("Lookup bug title at Mantis webpage %s" % url)
> > AttributeError: 'MantisChangesetQuery' object has no attribute 'log'
>
> Then there's something wrong with the class MantisChangesetQuery. Either
> it doesn't inherit from Component, or it isn't initialized correctly.

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

The extension point used is
http://trac.edgewall.org/attachment/ticket/781/icachechangesetlistener.diff

To find the cause why the environment is absent from plugin attributes
I've tried to find a difference between current pkg_resource loader
that seems to be invoked for standard trac components and file loader
for plugins, but the setuptools chain is too obscure, so I couldn't
get to the point where the environment is passed down to components.

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