I was able to find the documentation on PageEditor
from this answer.
But I can't find information on how to construct a proper ScriptContext
object to pass into the PageEditor
as the request parameter.
when I try and create a ScriptContext
as in the examples, I am getting the following errors.
[Fri Mar 11 11:04:42] [root]@[dev] /usr/local/share/moin
# python2.6
Python 2.6.5 (r265:79063, Jun 4 2010, 21:43:07)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from MoinMoin.web.contexts import ScriptContext
2011-03-11 11:05:01,828 WARNING MoinMoin.log:139 using logging configuration read from built-in fallback in MoinMoin.log
module!
2011-03-11 11:05:02,015 WARNING MoinMoin.log:111 /usr/lib/python2.6/site-packages/MoinMoin/support/pygments/plugin.py:39
: UserWarning: Module site was already imported from /usr/lib/python2.6/site.pyc, but /usr/lib/python2.6/site-packages i
s being added to sys.path
>>> request = ScriptContext()
2011-03-11 11:05:07,495 INFO MoinMoin.config.multiconfig:93 using farm 开发者_如何学Cconfig: /usr/local/share/moin/farmconfig.pyc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/site-packages/MoinMoin/web/contexts.py", line 439, in __init__
wsgiapp.init(self)
File "/usr/lib/python2.6/site-packages/MoinMoin/wsgiapp.py", line 51, in init
context.lang = setup_i18n_preauth(context)
File "/usr/lib/python2.6/site-packages/MoinMoin/wsgiapp.py", line 233, in setup_i18n_preauth
i18n.i18n_init(context)
File "/usr/lib/python2.6/site-packages/MoinMoin/i18n/__init__.py", line 72, in i18n_init
meta_cache = caching.CacheEntry(request, 'i18n', 'meta', scope='wiki', use_pickle=True)
File "/usr/lib/python2.6/site-packages/MoinMoin/caching.py", line 71, in __init__
self.arena_dir = get_arena_dir(request, arena, scope)
File "/usr/lib/python2.6/site-packages/MoinMoin/caching.py", line 32, in get_arena_dir
return os.path.join(request.cfg.cache_dir, request.cfg.siteid, arena)
File "/usr/lib/python2.6/site-packages/MoinMoin/web/contexts.py", line 56, in get
res = obj.environ.setdefault(self.name, factory(obj))
File "/usr/lib/python2.6/site-packages/MoinMoin/web/contexts.py", line 132, in cfg
raise NotFound('<p>No wiki configuration matching the URL found!</p>')
werkzeug.exceptions.NotFound: 404 Not Found
What is the magic incantation to create a ScriptContext()
with a wikifarm configuration?
I finally found an example on how to create the ScriptContext
object, with wikifarm configuration you have to tell it which wiki you want by its URL.
[Fri Mar 11 11:44:35] [root]@[dev] /usr/local/share/moin
# python2.6
Python 2.6.5 (r265:79063, Jun 4 2010, 21:43:07)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from MoinMoin.web.contexts import ScriptContext
>>> request = ScriptContext('http://wiki.dev.mycompany.com')
2011-03-11 11:45:11,481 INFO MoinMoin.config.multiconfig:93 using farm config: /usr/local/share/moin/farmconfig.pyc
2011-03-11 11:45:11,561 INFO MoinMoin.config.multiconfig:127 using wiki config: /usr/local/share/moin/mywiki.pyc
>>>
精彩评论