Prev: Another "Go is Python-like" article.
Next: gettext compatible, public domain collections of translations forstrings commonly used in software applications?
From: Adam Tauno Williams on 21 May 2010 15:43
On Fri, 2010-05-21 at 08:50 -0700, timo verbeek wrote:
> What is the easiest way in python to create a addon system?
> I found to easy ways:
> * using a import system like this:
> for striper in stripers:
> if striper["enabled"]:
> exec("from strip import %s as _x"%striper["striper"])
> string = _x.start(string)
This is how I chose to do it. Just walking a list of bundles and
discover the available classes [as plugins].
Adam Tauno Williams <awilliam(a)whitemice.org> LPIC-1, Novell CLA
OpenGroupware, Cyrus IMAPd, Postfix, OpenLDAP, Samba
From: timo verbeek on 22 May 2010 06:06
Is there not an other way to create a fast addon system?
A module or something like that
From: Christian Heimes on 22 May 2010 09:55
Am 22.05.2010 12:06, schrieb timo verbeek:
> Is there not an other way to create a fast addon system?
> A module or something like that
How fancy are your requirements? People have written numerous plugin
systems, from simple to use ones like CherryPy's tool system up to a
complex component architecture like zope.component.
I recommend against exec() and execfile(). It makes debugging and
testing harder and it has security concern, too.