http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11473

Revision: 11473
Author:   drtrigon
Date:     2013-04-27 11:40:24 +0000 (Sat, 27 Apr 2013)
Log Message:
-----------
follow-up; proper solution for issue solved in r11450

Modified Paths:
--------------
    branches/rewrite/pywikibot/__init__.py
    branches/rewrite/scripts/clean_sandbox.py

Modified: branches/rewrite/pywikibot/__init__.py
===================================================================
--- branches/rewrite/pywikibot/__init__.py      2013-04-27 11:27:20 UTC (rev 
11472)
+++ branches/rewrite/pywikibot/__init__.py      2013-04-27 11:40:24 UTC (rev 
11473)
@@ -25,6 +25,7 @@
 from pywikibot.bot import *
 from pywikibot.exceptions import *
 from pywikibot.textlib import *
+from pywikibot.i18n import translate
 
 
 class Timestamp(datetime.datetime):

Modified: branches/rewrite/scripts/clean_sandbox.py
===================================================================
--- branches/rewrite/scripts/clean_sandbox.py   2013-04-27 11:27:20 UTC (rev 
11472)
+++ branches/rewrite/scripts/clean_sandbox.py   2013-04-27 11:40:24 UTC (rev 
11473)
@@ -144,9 +144,9 @@
         self.site = pywikibot.Site()
         self.site.login()
         if self.getOption('user'):
-            localSandboxTitle = i18n.translate(self.site,
-                                               user_sandboxTemplate,
-                                               fallback=False)
+            localSandboxTitle = pywikibot.translate(self.site,
+                                                    user_sandboxTemplate,
+                                                    fallback=False)
             localSandbox      = pywikibot.Page(self.site, localSandboxTitle)
             content.update(user_content)
             sandboxTitle[self.site.lang] = [item.title() \
@@ -164,8 +164,8 @@
         while True:
             wait = False
             now = time.strftime("%d %b %Y %H:%M:%S (UTC)", time.gmtime())
-            localSandboxTitle = i18n.translate(self.site, sandboxTitle,
-                                               fallback=False)
+            localSandboxTitle = pywikibot.translate(self.site, sandboxTitle,
+                                                    fallback=False)
             if type(localSandboxTitle) is list:
                 titles = localSandboxTitle
             else:
@@ -175,8 +175,8 @@
                 pywikibot.output(u'Preparing to process sandbox page %s' % 
sandboxPage.title(asLink=True))
                 try:
                     text = sandboxPage.get()
-                    translatedContent = i18n.translate(self.site, content,
-                                                       fallback=False)
+                    translatedContent = pywikibot.translate(self.site, content,
+                                                            fallback=False)
                     translatedMsg = i18n.twtranslate(self.site,
                                                      'clean_sandbox-cleaned')
                     subst = 'subst:' in translatedContent


_______________________________________________
Pywikipedia-svn mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-svn

Reply via email to