Not sure if this is better asked here or on the Trac development list, or 
someplace else… it's not a question about how to use Trac, but about how to 
write a Trac plugin: Exactly how is a plugin supposed to know if it's enabled 
or not?

I ask because I have http://trac-hacks.org/wiki/NeverNotifyUpdaterPlugin 
installed system-wide, and I have two instances of Trac 1.0.1 on that system. 
One instance has the plugin enabled in trac.ini, and the other has it disabled:

[components]
nevernotifyupdaterplugin.api.nevernotifyupdatersetupparticipant = disabled

However, it's still running on the instance where it's disabled. The plugin 
does the following to see if it's enabled or not 
<http://trac-hacks.org/browser/nevernotifyupdaterplugin/0.13/nevernotifyupdaterplugin/api.py#L19>:

      def is_enabled():
        return self.compmgr.enabled[self.__class__]

      def new_get_recipients(self, tktid):
        self.env.log.debug('NeverNotifyUpdaterPlugin: getting recipients for 
%s' % tktid)
        (torecipients, ccrecipients) = old_get_recipients(self,tktid)
        if not is_enabled():
          self.env.log.debug('NeverNotifyUpdaterPlugin: disabled, returning 
original results')
          return (torecipients, ccrecipients)

        self.env.log.debug('NeverNotifyUpdaterPlugin: START tkt:%s, tos , ccs = 
%s, %s' %
                           (tktid, torecipients, ccrecipients))

I enabled debug logging, and it's *not* showing "NeverNotifyUpdaterPlugin: 
disabled, returning original results", and *is* showing 
"NeverNotifyUpdaterPlugin: START tkt", so is_enabled() must be returning True.

I searched the source of some other plugins (such as 
timingandestimationplugin), and they don't seem to check compmgr.enabled at 
all, but they do honor the disabled setting. So why does 
nevernotifyupdaterplugin still run even though it's marked as disabled? And how 
do other plugins know that they've been disabled?

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To post to this group, send email to trac-users@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to