Revision: 6917 Author: alexsh Date: 2009-05-24 13:19:09 +0000 (Sun, 24 May 2009)
Log Message: ----------- *optimize wikiversity url when using SSL connection *Fix secure url faild in oldwikisource and SSL connection *Add progress shortcut for redirect.py (double->do, broken->br) *Other syntax fix and comments in watchlist.py and login.py
Modified Paths: -------------- trunk/pywikipedia/families/wikisource_family.py trunk/pywikipedia/families/wikiversity_family.py trunk/pywikipedia/login.py trunk/pywikipedia/redirect.py trunk/pywikipedia/watchlist.py
Modified: trunk/pywikipedia/families/wikisource_family.py =================================================================== --- trunk/pywikipedia/families/wikisource_family.py 2009-05-24 10:37:36 UTC (rev 6916) +++ trunk/pywikipedia/families/wikisource_family.py 2009-05-24 13:19:09 UTC (rev 6917) @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- import urllib -import family, config +import family, config, wikipedia
__version__ = '$Id$'
@@ -20,15 +20,15 @@ 'gl', 'zh-min-nan', 'fo', ]
- self.langs = { - '-': 'wikisource.org', - } + self.langs['-'] = 'wikisource.org' if config.SSL_connection and self.name in config.available_ssl_project: for lang in self.languages_by_size: self.langs[lang] = 'secure.wikimedia.org' + self.langs['-'] = 'secure.wikimedia.org' else: for lang in self.languages_by_size: self.langs[lang] = '%s.wikisource.org' % lang + self.langs['-'] = 'wikisource.org'
# Override defaults self.namespaces[2]['pl'] = 'Wikiskryba' @@ -345,6 +345,9 @@ 'pl': self.alphabetic, 'simple': self.alphabetic } + if config.SSL_connection and wikipedia.default_code == '-': + def scriptpath(self, code): + return '/wikipedia/sources/w'
def version(self, code): return '1.15alpha'
Modified: trunk/pywikipedia/families/wikiversity_family.py =================================================================== --- trunk/pywikipedia/families/wikiversity_family.py 2009-05-24 10:37:36 UTC (rev 6916) +++ trunk/pywikipedia/families/wikiversity_family.py 2009-05-24 13:19:09 UTC (rev 6917) @@ -15,17 +15,16 @@ 'en', 'fi', 'fr', 'es', 'de', 'it', 'el', 'cs', 'ja', 'pt' ]
- self.langs = { - 'beta': 'beta.wikiversity.org', - } - for lang in self.languages_by_size: - self.langs[lang] = '%s.wikiversity.org' % lang - if config.SSL_connection and self.name in config.available_ssl_project: for lang in self.languages_by_size: self.langs[lang] = 'secure.wikimedia.org' self.langs['beta'] = 'secure.wikimedia.org' + else: + for lang in self.languages_by_size: + self.langs[lang] = '%s.wikiversity.org' % lang + self.langs['beta'] = 'beta.wikiversity.org'
+ # Most namespaces are inherited from family.Family. # Translation used on all wikis for the different namespaces. # (Please sort languages alphabetically)
Modified: trunk/pywikipedia/login.py =================================================================== --- trunk/pywikipedia/login.py 2009-05-24 10:37:36 UTC (rev 6916) +++ trunk/pywikipedia/login.py 2009-05-24 13:19:09 UTC (rev 6917) @@ -227,9 +227,9 @@ for line in file: if not line.strip(): continue entry = eval(line) - if len(entry) == 2: + if len(entry) == 2: #for default userinfo if entry[0] == self.username: self.password = entry[1] - elif len(entry) == 4: + elif len(entry) == 4: #for userinfo included code and family if entry[0] == self.site.lang and \ entry[1] == self.site.family.name and \ entry[2] == self.username:
Modified: trunk/pywikipedia/redirect.py =================================================================== --- trunk/pywikipedia/redirect.py 2009-05-24 10:37:36 UTC (rev 6916) +++ trunk/pywikipedia/redirect.py 2009-05-24 13:19:09 UTC (rev 6917) @@ -789,9 +789,9 @@ number = None always = False for arg in wikipedia.handleArgs(*args): - if arg == 'double': + if arg == 'double' or arg == 'do': action = 'double' - elif arg == 'broken': + elif arg == 'broken' or arg == 'br': action = 'broken' elif arg == 'both': action = 'both'
Modified: trunk/pywikipedia/watchlist.py =================================================================== --- trunk/pywikipedia/watchlist.py 2009-05-24 10:37:36 UTC (rev 6916) +++ trunk/pywikipedia/watchlist.py 2009-05-24 13:19:09 UTC (rev 6917) @@ -84,13 +84,11 @@ 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 lang in config.usernames[ family ]: + refresh(wikipedia.getSite( code = lang, fam = family ) ) for family in config.sysopnames: - for lang in config.sysopnames[family]: - site = wikipedia.getSite(code=lang, fam = family) - refresh(site) + for lang in config.sysopnames[ family ]: + refresh(wikipedia.getSite( code = lang, fam = family ) )
else: import dircache, time @@ -102,8 +100,7 @@ arr = match.group(1).split('-') family = arr[0] lang = '-'.join(arr[1:]) - site = wikipedia.getSite(code = lang, fam = family) - refresh(site) + refresh(wikipedia.getSite(code = lang, fam = family))
def main(): all = False @@ -123,7 +120,7 @@ watchlist = get(wikipedia.getSite()) wikipedia.output(u'%i pages in the watchlist.' % len(watchlist)) for pageName in watchlist: - wikipedia.output(pageName, toStdout = True) + wikipedia.output( pageName, toStdout = True )
if __name__ == "__main__": try:
pywikipedia-svn@lists.wikimedia.org