plugin / intra process communication system
dino at phidev.org
Mon Feb 15 23:12:23 CET 2010
On Sun, 2010-02-14 at 18:47 +0100, Diez B. Roggisch wrote:
> > Here there problem with the trac (and other plugin systems I've
> > approach:
> > You need to define something like:
> > |
> > | class IAuthPlugin(Interface): [...]
> > |
> > in your blog software.
> Why? Any reason you can't define it in a separate package the
> blog-software depends on, as well as your wiki?
That's actually my point - most plugin systems I've seen, like the one
trac uses, are not encouraging you to do so. Having a module that just
defines an Interface is kind of weird - and in the real world no one is
> And then of course, this is not really needed. In Python, behavior
> counts, not type-information. So you can get away without any explicit
> declared interface. You might chose to not do that, for aestetic
> reasons, or better documentation. But you aren't forced.
Actually some plugin-systems in python do force you and they check if
your "implementation" comply with the "interface".
Here is one solution I came up with. Based on the earlier example:
> > Lets say you program a wiki and like to allow different kind of
> > authentications. So you create two plugins (for example one for
> > OpenID and one for Shibboleth).
> > Some time later you feel like reinventing the wheel again and
> > you program a blog. Again you like to allow different ways of
> > authentication and you already wrote plugins for exactly the
> > same for your wiki, right?
auth_openid.py - providing the authentication service
wiki.py - providing the wiki
Now putting both together:
> import pbus
> import wiki
> import auth_openid
> # or: import auth_shibboleth
No interface definitions.
What do you think? Any obvious pitfalls (besides reinventing something)?
Please keep in mind that syntax/api is not "done" or anything its just
an concept presentation.
Florian Ludwig <dino at phidev.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 197 bytes
Desc: This is a digitally signed message part
More information about the Python-list