• Members 2 posts
    April 26, 2019, 11:59 a.m.

    Hello i got this error. When i try in django console receive get_language() i get None

    File "/srv/misago/misago/threads/participants.py", line 151, in build_noticiation_email
    context={"settings": request.settings, "thread": thread},
    File "/srv/misago/misago/core/mail.py", line 15, in build_mail
    "LANGUAGE_CODE": get_language()[:2],
    TypeError: 'NoneType' object is not subscriptable

  • April 28, 2019, 10:19 p.m.


    How are you getting this error? Can you give detailed description of what you are entering in your console?

  • Members 2 posts
    April 30, 2019, 10:39 a.m.

    I want to create convertor from other forum engine to misago.
    When i create private message in script

    data variable contains json

    {"to":["admin"],"title":"title text","post":"message text","attachments":[]}


    request = RequestFactory().get(reverse("misago:private-threads"))
        request.cache_versions = get_cache_versions()
        request.settings = DynamicSettings(request.cache_versions)
        request.user = user
        request.user_acl = get_user_acl(request.user, request.cache_versions)
        request.method = "POST"
        request.POST = data
        request.data = request.POST
        request.user_ip = ''
        thread = Thread()
        post = Post(thread=thread)
        posting = PostingEndpoint(

    System create email and try to apply language (as i understand). But django function return None (instead 'en') so [:2] from none is error.
    in misago/core/mail.py

    I apply fix without changing in misago engine.

    from django.utils.translation import _trans
    _trans.get_language = lambda: 'en'

    But i think this is not norm practice.

  • April 30, 2019, 7:24 p.m.

    This is super weird way to do data migration. Any reason you can't create management command that reads data from other forum's database and then uses it to create Misago models? Here's example of such data migration that moves data from Misago 0.5 to Misago 0.6.

    As for your issue, Django requires that there's active language before any features using translations are used:

    from django.utils.translation import activate