yapsy doesn't load plugin correctly
I am using yapsy for a python apps.
i wrote a new plugin for my app and put it into the same folder where all the other plugins are
my plugins all inherit from a plugin class called doctypes which is in general.interfaces the doctype class inherits from the IPlugin class again
all plugins load correctly but for the new plugin i get:
< general.interfaces.DocType object at 0x......>
instead of
< PDF object at 0x.......>
it seems to me as if yapsy loaded the main plugin class from which all plugins inherit and which itself inherits from IPlugin
my app works fine with all plugins except for the new one i checked for any diffe开发者_JAVA百科rences in code but all things seem correct
I'm yapsy's main developer and I've just come across this message...
Though I guess after 4 months you went for something else but anyway.
The first thing I'd like to point to is that it could be best if you filled a bug report on yapsy's tracker at:
https://sourceforge.net/tracker/?group_id=208383
And if you decide to do so, it would help me a lot if you could also attach some pieces of code.
From the simple description you gave here, it's hard for me to tell where the problem is, but it seems at least that the "settings" can be reproduced as a small alteration of some of yapsy's unit test.
If I had to do a wild guess anyway, the problem might come from the (very crude) use of Python's 'issubclass' to identify the plugins of various categories. Which comes from the fact that "categories" are defined w.r.t a parent class that all plugins of the same category must inherit from (more precisely "instances of a class inheriting from...").
This would cause confusions if you defined the categories mapping with something like the following:
{
"GeneralDocCategory": general.interfaces.DocType,
"PDFcategory": general.interfaces.PDFDocType
}
Where PDFDocType inherits from DocType. And the source of the problem would be the presence of the mother class and one of its child classes to define two different categories.
Solution to this could be:
Solution A/ redesign yapsy in a more clever way (not happening soon in yapsy's main repo because of a dramatic lack of time but feel free to fork/contribute/change everything)
Solution B/ define a 'specific' class for 'unspecific' doc types (not -only- a joke) to get the categories defined by something like:
{
"UnkownDocCategory": general.interfaces.UnknownDocType,
"PDFcategory": general.interfaces.PDFDocType
}
Where UnknownDocType and PDFDocType would both inherit DocType.
精彩评论