Roundup Tracker - Issues

Message7507

Author rouilj
Recipients marcus.priesch, rouilj, schlatterbeck
Date 2022-05-04.22:28:56
Message-id <1651703336.88.0.191630681504.issue2551184@roundup.psfhosted.org>
In-reply-to
Ok testing mailgw.py is getting weird.

While setting the db.config vars as I mentioned should work, there is a glitch.
The handle_message method which sets the language by looking at the db.config vars
is never called by the test harness. The test routine calls _handle_message (which is
called by handle_message) directly.

I think this is because handle_message() opens and closes the database. This would wipe
out the db and config setting that are crafted for the tests.

So I extracted code from handle_message that sets up the language translation services.
This would set the test's db.i18n property and the global _ variable.
I already imported i18n in the test.

In this code (mailgw.py:1606):

        language = self.instance.config["MAILGW_LANGUAGE"] or 
self.instance.config["TRACKER_LANGUAGE"]
        self.db.i18n = i18n.get_language (language)

is what I copied. However i18n.get_language() isn't a valid method.
I am not sure what i18n refers to. The mailgw.py doesn't import i18n anywhere.

Should get_language() be get_translation() (which does exist in i18n)?

Ideas? If a patch is added for this problem please name it "mailgw_lang" or something
to differentiate it from the other patches. It should probably get a new issue actually
but....
History
Date User Action Args
2022-05-04 22:28:56rouiljsetmessageid: <1651703336.88.0.191630681504.issue2551184@roundup.psfhosted.org>
2022-05-04 22:28:56rouiljsetrecipients: + rouilj, schlatterbeck, marcus.priesch
2022-05-04 22:28:56rouiljlinkissue2551184 messages
2022-05-04 22:28:56rouiljcreate