Question

first of all: I am not a python programmer, i just want to run default instalation of OSQA on linux hosting. My hosting provider installed it for me, and OSQA is working with ony one (but serious) error - if i try to post question/answer/comment with URL in text (http://www.whatever.com/whatever) - the empty post is added (no text at all), and this error appears in log :

/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' 

I tried to google it, but no luck.

OSQA is Fantasy Island (v0.9.0) Beta 3, Django is in version 1.3.1 afaik.

Thanks for any help!

Was it helpful?

Solution

The Python-Markdown new version seems move etree/AtomicString to markdown.util, So you can try this workaround, modify 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)

You may also see this patch as reference.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top