chris...@gmail.com
unread,Apr 7, 2009, 7:46:28 AM4/7/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to WikklyText
GoogleAppEngine doesn't seem to like WikklyText's use of the imp
module , it thinks of it as a restricted module and throws an
ImportError when trying to compile wikklytext.plugins.
I was able to work around this problem with the included diff. This
works for me because I don't use any plugins (yet), but obviously is
not a great solution for people who do.
GAE is reasonably okay with __import__, so there's probably a way to
get the desired behavior without using imp.
This all came up while bringing the google app engine of TiddlyWeb up
to modern times. The wiki serializer now uses wikklytext for doing
some special magic to set the title bar of the browser (we go from
wikitext -> html -> plain text). The old version of TiddlyWeb on GAE
didn't do any wikklytext stuff so this issue was not exposed.
diff -u wikklytext/macro.py /Users/cdent/twappengine/wikklytext/
macro.py
--- wikklytext/macro.py 2008-08-30 17:03:30.000000000 +0100
+++ /Users/cdent/twappengine/wikklytext/macro.py 2009-04-07
12:32:53.000000000 +0100
@@ -319,7 +319,6 @@
return outnode
from boodebr.util import load_module
-from wikklytext.plugins import load_plugins
def call_macro(wcontext, name, elements):
"""
@@ -328,7 +327,11 @@
Returns list of elements that the macro returns. On error, will
raise WikError.
"""
- plugins = load_plugins(wcontext.plugin_dirs)
+ try:
+ from wikklytext.plugins import load_plugins
+ plugins = load_plugins(wcontext.plugin_dirs)
+ except ImportError:
+ plugins = []
func = None
@@ -374,8 +377,12 @@
}
# add names from __all__ in plugins as well
- plugins = load_plugins(wcontext.plugin_dirs)
- eglobals.update(plugins.embed)
+ try:
+ from wikklytext.plugins import load_plugins
+ plugins = load_plugins(wcontext.plugin_dirs)
+ eglobals.update(plugins.embed)
+ except ImportError:
+ pass
for k,v in eglobals.items():
wcontext.mod_embedded.__dict__[k] = v