-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 20.02.2012 22:46, wrote Chris Nelson:
> Can someone point me to an example of where one plugin *may* make use of
> another plugin?  That is, I want one plugin to use another if it is
> present but not to *require* it.  It this just putting the `import` in a
> `try` or is there a better idiom?

Seen that in a couple if occasions, i.e. ScreenshotsPlugin implementing
the DefaultTagProvider interface [1], if TagsPlugin is installed. No
conditional import, you'll just miss the whole tracscreenshots.tags
after import failure on plugin load time. Likewise the TracAnnouncer aka
AnnouncerPlugin [2] implementing IAccountChangeListener from
AccountManagerPlugin.

I'm sure, that the try..except ImportError is done a lot more, but
ironically I can't remember an example right-away.

Steffen Hoffmann
(hasienda)


[1]
http://trac-hacks.org/browser/screenshotsplugin/0.12/tracscreenshots/tags.py
[2]
http://trac-hacks.org/browser/announcerplugin/trunk/announcer/opt/acct_mgr/announce.py
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk9CxzIACgkQ31DJeiZFuHdvFACgvVWJBMMHcPDGOsBc6uaSaczF
SPIAn3GkouFW7ibQt6En4ENC/1eRCs6V
=okTk
-----END PGP SIGNATURE-----

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

Reply via email to