Kind of plugin system
gpodevij at gmail.com
Sun Nov 28 11:27:14 CET 2010
Thank you both, I'll look at this in more depth !
2010/11/27 Marc-Andre Belzile <Marc-Andre.Belzile at autodesk.com>
> I guess you could just define an entry-point in your source provider files
> that would return a specific instance of an InformationProvider class. This
> entry-point would be called by your main app (maybe at startup time or
> during an update phase).
> There are plenty of articles on the web about python plugins that could
> help you out, such as this one:
> From: python-list-bounces+marc-andre.belzile=autodesk.com at python.org[mailto:
> =autodesk.com at python.org] On Behalf Of Gaëtan Podevijn
> Sent: Friday, November 26, 2010 12:46 PM
> To: python-list at python.org
> Subject: Kind of plugin system
> Here is my problem.
> I need to get some informations from files stored on my filesystem, Flickr
> and Picasa. So the idea is to create a class (for instance,
> "InformationsProvider") that provides common methods for those three
> sources, then, for each source, I create a class that inherits from
> "InformationsProvider" such as "InformationsLocalProvider",
> "InformationsFlickrProvider" and "InformationPicasaProvider". It is clearly
> needed because the method to get the informations is totally different for
> each source (the connection with flickr or picasa for exemple).
> However, I'd like, in the future, to be able to add new source and thus,
> just add a new class that implements the methods from Provider. The thing
> is, I'd like to add only one class, and that the rest of the application is
> able to use that class without really knowing how many class there are.
> I'd have something like :
> for each provider that exists: get the informations file
> and if I add a new .py that implements a new provider (say Delicious of
> GMail), the code above takes account of the new class. It must be "dynamic".
> Could you help me with that ? I hope I was clear enough.
> Thanks a lot,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list