Kind of plugin system
gpodevij at gmail.com
Fri Nov 26 18:46:01 CET 2010
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