Manually loading plugins

1 view
Skip to first unread message

jdlrobson

unread,
Jan 8, 2010, 7:05:13 AM1/8/10
to WikklyText
In the python version of wikklytext I can specific a plugins directory
which I can then have folders with a __init__ function.

Inside this init code I am doing something like:

__safe__ = ['helloworld']

def helloworld(context,*args):
return "hello world"


I'd rather not have this folder at all, and would rather replace it
with a file called wikklytextplugins.py and load it before making a
call to wikklytext.WikklyText_to_InnerHTML - just to make my code more
self contained in one single folder

something like
#create context..
context = ....
context.load_plugins(wikklytextplugins)
wikklytext.WikklyText_to_InnerHTML(context

Can this be done?
Jon

Frank McIngvale

unread,
Jan 8, 2010, 2:24:56 PM1/8/10
to wikkl...@googlegroups.com
My concern is this is overloading the interface too much -- load from module dirs, vs. a single file, vs. embedded code ... gets to be too many paths I think. However, there is a hook you can use to do ANYTHING you want regarding macros -- it is the 'macro_handler' parameter to WikContext (and the toplevel render funcs). Look in base.py about line 128 to see the definition. You could do anything including replacing the entire plugin system with this hook since is the FIRST thing called to handle macros.

frank
 
Jon

--
You received this message because you are subscribed to the Google Groups "WikklyText" group.
To post to this group, send email to wikkl...@googlegroups.com.
To unsubscribe from this group, send email to wikklytext+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/wikklytext?hl=en.




Reply all
Reply to author
Forward
0 new messages