0

我能够PageEditor从这个答案中找到文档。

但是我找不到有关如何构造适当的ScriptContext对象以PageEditor作为请求参数传递的信息。

当我尝试在示例中创建 aScriptContext时,我收到以下错误。

[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 config: /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

ScriptContext()使用 wikifarm 配置创建一个魔法咒语是什么?

4

1 回答 1

0

我终于找到了一个关于如何创建ScriptContext对象的示例,使用 wikifarm 配置,您必须通过其 URL 告诉它您想要哪个 wiki。

[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
>>>
于 2011-03-11T16:47:08.493 回答