jenkins-bot has submitted this change and it was merged.
Change subject: [IMPROV] i18n: Deprecate list as code in twtranslate ......................................................................
[IMPROV] i18n: Deprecate list as code in twtranslate
`twtranslate` supports a list as code in order to change it and return the actually used code. This was only used for `twntranslate` and shouldn't be used anymore.
Change-Id: I13d45e39ea52d77983fb4e654f8c0772f0263306 --- M pywikibot/i18n.py 1 file changed, 8 insertions(+), 1 deletion(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/i18n.py b/pywikibot/i18n.py index 58e23fd..3bd9e9e 100644 --- a/pywikibot/i18n.py +++ b/pywikibot/i18n.py @@ -33,6 +33,7 @@ import pkgutil
from collections import defaultdict, Mapping +from warnings import warn
import pywikibot
@@ -554,7 +555,9 @@ ... % {'descr': 'seulement'}) 'Robot: Changer seulement quelques pages.'
- @param code: The language code + @param code: When it's a site it's using the code attribute and otherwise it + is using the value directly. + @type code: BaseSite or str @param twtitle: The TranslateWiki string title, in <package>-<key> format @param parameters: For passing parameters. It should be a mapping but for backwards compatibility can also be a list, tuple or a single value. @@ -583,6 +586,10 @@ lang = code.code # check whether we need the language code back elif isinstance(code, list): + # For backwards compatibility still support lists, when twntranslate + # was not deprecated and needed a way to get the used language code back + warn('The code argument should not be a list but either a BaseSite or ' + 'a str/unicode.', DeprecationWarning, 2) lang = code.pop() code_needed = True else:
pywikibot-commits@lists.wikimedia.org