Revision: 6909
Author: alexsh
Date: 2009-05-21 10:38:13 +0000 (Thu, 21 May 2009)
Log Message:
-----------
Add -new for load all wikis where setting in user-config.py
Modified Paths:
--------------
trunk/pywikipedia/watchlist.py
Modified: trunk/pywikipedia/watchlist.py
===================================================================
--- trunk/pywikipedia/watchlist.py 2009-05-21 10:05:32 UTC (rev 6908)
+++ trunk/pywikipedia/watchlist.py 2009-05-21 10:38:13 UTC (rev 6909)
@@ -12,6 +12,7 @@
Command line options:
-all - Reloads watchlists for all wikis where a watchlist is already
present
+ -new - Load watchlists for all wikis where accounts is setting in user-config.py
"""
# (C) Daniel Herding, 2005
@@ -78,27 +79,44 @@
pickle.dump(watchlist, f)
f.close()
-def refresh_all():
- import dircache, time
- filenames = dircache.listdir(wikipedia.config.datafilepath('watchlists'))
- watchlist_filenameR = re.compile('watchlist-([a-z\-:]+).dat')
- for filename in filenames:
- match = watchlist_filenameR.match(filename)
- if match:
- arr = match.group(1).split('-')
- family = arr[0]
- lang = '-'.join(arr[1:])
- site = wikipedia.getSite(code = lang, fam = family)
- refresh(site)
+def refresh_all(new = False):
+ if new:
+ import config
+ wikipedia.output('Downloading All watchlists for your accounts in user-config.py');
+ for family in config.usernames:
+ for lang in config.usernames[family]:
+ site = wikipedia.getSite(code=lang, fam = family)
+ refresh(site)
+ for family in config.sysopnames:
+ for lang in config.sysopnames[family]:
+ site = wikipedia.getSite(code=lang, fam = family)
+ refresh(site)
+ else:
+ import dircache, time
+ filenames = dircache.listdir(wikipedia.config.datafilepath('watchlists'))
+ watchlist_filenameR = re.compile('watchlist-([a-z\-:]+).dat')
+ for filename in filenames:
+ match = watchlist_filenameR.match(filename)
+ if match:
+ arr = match.group(1).split('-')
+ family = arr[0]
+ lang = '-'.join(arr[1:])
+ site = wikipedia.getSite(code = lang, fam = family)
+ refresh(site)
+
def main():
all = False
+ new = False
for arg in wikipedia.handleArgs():
- if arg == '-all':
+ if arg == '-all' or arg == '-update':
all = True
-
+ elif arg == '-new':
+ new = True
if all:
refresh_all()
+ elif new:
+ refresh_all(new)
else:
refresh(wikipedia.getSite())
Revision: 6906
Author: russblau
Date: 2009-05-19 14:27:13 +0000 (Tue, 19 May 2009)
Log Message:
-----------
add comments to assist in future maintenance
Modified Paths:
--------------
trunk/pywikipedia/family.py
Modified: trunk/pywikipedia/family.py
===================================================================
--- trunk/pywikipedia/family.py 2009-05-19 10:49:38 UTC (rev 6905)
+++ trunk/pywikipedia/family.py 2009-05-19 14:27:13 UTC (rev 6906)
@@ -3269,7 +3269,12 @@
def category_namespaces(self, code):
return self.namespace(code, 14, all = True)
- # Redirect code can be translated.
+ # Localised magic words for language code 'xyz' can be found in
+ # the MediaWiki source code in the file
+ # /mediawiki/trunk/phase3/languages/messages/MessagesXyz.php
+ # in the 'magicwords' array
+
+ # Localised redirect codes
# Note that redirect codes are case-insensitive, so it is enough
# to enter the code in lowercase here.
@@ -3313,6 +3318,8 @@
'hy': [u'վերահղում'],
'id': [u'alih'],
'is': [u'tilvísun'],
+# 'it': magic words "RINVIA" and "RINVIO" appear in the MediaWiki
+# source code, BUT DO NOT WORK
'ja': [u'転送', u'リダイレクト'],
'jv': [u'alih'],
'ka': [u'გადამისამართება'],
@@ -3337,6 +3344,8 @@
'nl': [u'doorverwijzing'],
'nn': [u'omdiriger'],
'oc': [u'redireccion'],
+# 'os': magic word u"рарвыст" appears in the MediaWiki source code,
+# BUT DOES NOT WORK
'os': [u"перенаправление", u"перенапр"],
'pdc': [u'weiterleitung'],
'pl': [u'redirect', u'patrz', u'tam', u'przekieruj'],