Hello, Thank you both, I'll look at this in more depth !
Regards, Gaëtan 2010/11/27 Marc-Andre Belzile <marc-andre.belz...@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: > > http://wehart.blogspot.com/2009/01/python-plugin-frameworks.html > > -mab > > > > From: python-list-bounces+marc-andre.belzile=autodesk....@python.org[mailto: > python-list-bounces+marc-andre.belzile<python-list-bounces%2Bmarc-andre.belzile> > =autodesk....@python.org] On Behalf Of Gaëtan Podevijn > Sent: Friday, November 26, 2010 12:46 PM > To: python-list@python.org > Subject: Kind of plugin system > > Hello, > > 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, > > Gaëtan > > >
-- http://mail.python.org/mailman/listinfo/python-list