首先:我不是python程序员,我只想在linux主机上运行OSQA的默认安装。我的托管服务提供商为我安装了它,并且OSQA正在处理一个(但是严重的)错误 - 如果我尝试用文本中的URL发布问题/答案/评论(http://www.whatever.com/whatever) - 添加空帖子(根本没有文字),此错误出现在日志中:
/data/web/slovensko20.sk/web/forum/models/node.py TIME: 2012-02-05 23:29:14,944 MSG: node.py:_as_markdown:34 Caught exception 'module' object has no attribute 'etree' in markdown parser rendering Answer 'module' object has no attribute 'etree':\s Traceback (most recent call last): File "/data/web/slovensko20.sk/web/forum/models/node.py", line 30, in _as_markdown return mark_safe(sanitize_html(markdown.markdown(content, extensions=extensions))) File "build/bdist.linux-x86_64/egg/markdown/__init__.py", line 396, in markdown File "build/bdist.linux-x86_64/egg/markdown/__init__.py", line 287, in convert File "build/bdist.linux-x86_64/egg/markdown/treeprocessors.py", line 289, in run text), child) File "build/bdist.linux-x86_64/egg/markdown/treeprocessors.py", line 110, in __handleInline data, patternIndex, startIndex) File "build/bdist.linux-x86_64/egg/markdown/treeprocessors.py", line 237, in __applyPattern node = pattern.handleMatch(match) File "/data/web/slovensko20.sk/web/forum/markdownext/mdx_urlize.py", line 27, in handleMatch el = markdown.etree.Element("a") AttributeError: 'module' object has no attribute 'etree'
我试着谷歌,但没有运气。
OSQA是Fantasy Island(v0.9.0)Beta 3,Django是1.3.1版本。
感谢您的帮助!
答案 0 :(得分:1)
Python-Markdown新版本似乎将etree / AtomicString移动到markdown.util,所以你可以试试这个解决方法,修改mdx_urlize.py
try:
from markdown.util import etree
## replace markdown.etree with just etree
#el = markdown.etree.Element("a")
el = etree.Element("a")
## replace markdown.AtomicString with markdown.util.AtomicString
#el.text = markdown.AtomicString(text)
el.text = markdown.util.AtomicString(text)
您可能还会看到此patch作为参考。