OSQA和Django 1.3.1发布文本时出现错误

2024-06-25 07:20:25 发布

您现在位置:Python中文网/ 问答频道 /正文

首先:我不是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)Beta3,Django是版本1.3.1Afaik。在

谢谢你的帮助!在


Tags: inpybuildwebnodedataegglinux
1条回答
网友
1楼 · 发布于 2024-06-25 07:20:25

Python Markdown的新版本似乎将etree/AtomicString移到降价.util,因此您可以尝试此解决方法,修改mdx_url大小.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作为参考。在

相关问题 更多 >