when adding a qestion on OSQA (django&python) its body is empty

174 Views Asked by At

I am currently working on OSQA, and I am having really trouble when I try to import some questions and answers from another q&a site.

Searching before posting, I found this link on meta.osqa about importing data, and some typical errors, but it is no longer valid. http://meta.osqa.net/questions/4080/how-can-i-import-data-from-another-question-and-answer-script

On the other hand, my code is:

from django.core.management.base import NoArgsCommand

from forum.models import *
from forum.actions import *
class Command(NoArgsCommand):
    def handle_noargs(self, **options):
        #retrieve the "asker" from the database
        # "15" for Alumno Paco
        user = User.objects.get(id=15)
        #prepare question data
        qdata = dict(
           title = "Como funciona el TabViewController",
           text = "No entiendo como funciona el TabViewController, alguna ayuda?",
           tags = "iOS iPhone Xcode",
        )
        #save the question, everything will be handled internally,
        #like creating the tags if they don't exist, etc 
        AskAction(user=user).save(data=qdata)

The command creates the question properly on my OSQA site, except that the question's body (text) is empty.

The curiosity is that when adding a question manually, directly from the site registered as a user, it is successfully created.

Reading about, I discover that is a Markdown's issue, but the solutions I have found are no longer suitable because they talk about editing a mdx_urlizer.py file that it does not exist on the current version of OSQA.

Thanks in advance!

Kikerox

2

There are 2 best solutions below

0
AudioBubble On

osqa log can get you more information abouth the bug. It's located in osqa/log/django.osqa.log.

To solve this issue, you need to replace the argument extensions to 'html5' in any python markdow function.

0
suhailvs On

it seems a problem with markdown2.5 release.

i solved the problem by installing markdown2.4 version, ie:

pip uninstall markdown
pip install markdown==2.4