Revision: 4680 Author: rotem Date: 2007-12-09 20:19:59 +0000 (Sun, 09 Dec 2007)
Log Message: ----------- Fixing whitespace and comments, changing version in family.py to the newest one.
Modified Paths: -------------- trunk/pywikipedia/families/wikipedia_family.py trunk/pywikipedia/families/wikitech_family.py trunk/pywikipedia/families/wikitravel_family.py trunk/pywikipedia/family.py
Modified: trunk/pywikipedia/families/wikipedia_family.py =================================================================== --- trunk/pywikipedia/families/wikipedia_family.py 2007-12-09 20:01:44 UTC (rev 4679) +++ trunk/pywikipedia/families/wikipedia_family.py 2007-12-09 20:19:59 UTC (rev 4680) @@ -953,8 +953,8 @@
def dbName(self, code): # returns the name of the MySQL database - # for historic reasons, the databases are called wikixx instead of - # wikipediaxx for Wikipedias. + # for historic reasons, the databases are called xxwiki instead of + # xxwikipedia for Wikipedias. return '%swiki' % code
def code2encodings(self, code):
Modified: trunk/pywikipedia/families/wikitech_family.py =================================================================== --- trunk/pywikipedia/families/wikitech_family.py 2007-12-09 20:01:44 UTC (rev 4679) +++ trunk/pywikipedia/families/wikitech_family.py 2007-12-09 20:19:59 UTC (rev 4680) @@ -1,29 +1,28 @@ # -*- coding: utf-8 -*- import family
-# Linpedia.org, the GNU/Linux encyclopedia +# Wikitech site
class Family(family.Family):
def __init__(self): family.Family.__init__(self) - self.name = 'wikitech' - + self.name = 'wikitech' + self.langs = { - 'en':'wikitech.leuksman.com', + 'en': 'wikitech.leuksman.com', }
# Namespaces - self.namespaces[4] = { - '_default': [u'Wikitech', self.namespaces[4]['_default']], - } - self.namespaces[5] = { - '_default': [u'Wikitech talk', self.namespaces[5]['_default']], - } - + '_default': [u'Wikitech', self.namespaces[4]['_default']], + } + self.namespaces[5] = { + '_default': [u'Wikitech talk', self.namespaces[5]['_default']], + } + def version(self, code): - return "1.11alpha" + return "1.12alpha"
def path(self, code): return '/index.php'
Modified: trunk/pywikipedia/families/wikitravel_family.py =================================================================== --- trunk/pywikipedia/families/wikitravel_family.py 2007-12-09 20:01:44 UTC (rev 4679) +++ trunk/pywikipedia/families/wikitravel_family.py 2007-12-09 20:19:59 UTC (rev 4680) @@ -1,7 +1,7 @@ import family, config - -# The wikimedia family that is known as wikitravel
+# The wikitravel family + # Translation used on all wikitravels for the 'article' text. # A language not mentioned here is not known by the robot
Modified: trunk/pywikipedia/family.py =================================================================== --- trunk/pywikipedia/family.py 2007-12-09 20:01:44 UTC (rev 4679) +++ trunk/pywikipedia/family.py 2007-12-09 20:19:59 UTC (rev 4680) @@ -2279,7 +2279,7 @@ 'zwiki': 'zwiki', 'zzz wiki': 'zzz wiki', } - + # A list of disambiguation template names in different languages self.disambiguationTemplates = { '_default': [] @@ -2293,19 +2293,18 @@
# On most wikis page names must start with a capital letter, but some # languages don't use this. - self.nocapitalize = [] - + # attop is a list of languages that prefer to have the interwiki # links at the top of the page. self.interwiki_attop = [] # on_one_line is a list of languages that want the interwiki links # one-after-another on a single line self.interwiki_on_one_line = [] - + # String used as separator between interwiki links and the text self.interwiki_text_separator = '\r\n\r\n' - + # Similar for category self.category_attop = [] # on_one_line is a list of languages that want the category links @@ -2314,7 +2313,7 @@
# String used as separator between category links and the text self.category_text_separator = '\r\n\r\n' - + # When both at the bottom should categories come after interwikilinks? self.categories_last = []
@@ -2324,32 +2323,28 @@ # interwiki_putfirst, interwiki_putfirst is checked first, and # languages are put in the order given there. All other languages are put # after those, in code-alphabetical order. - self.interwiki_putfirst = {}
# Languages in interwiki_putfirst_doubled should have a number plus a list # of languages. If there are at least the number of interwiki links, all # languages in the list should be placed at the front as well as in the # normal list. - self.interwiki_putfirst_doubled = {}
- # Which language codes do no longer exist and by which language code should - # they be replaced. If for example the language with code xx: now should get - # code yy:, add {'xx':'yy'} to obsolete. - # If all links to language xx: shall be removed, add {'xx': None}. - # Some families, e. g. commons and meta, are not multilingual and # forward interlanguage links to another family (wikipedia). # These families can set this variable to the name of the target # family. self.interwiki_forward = None
+ # Which language codes do no longer exist and by which language code should + # they be replaced. If for example the language with code xx: now should get + # code yy:, add {'xx':'yy'} to obsolete. + # If all links to language xx: shall be removed, add {'xx': None}. self.obsolete = {} - + # Language codes of the largest wikis. They should be roughly sorted # by size. - self.languages_by_size = []
# Some languages belong to a group where the possibility is high that @@ -2498,27 +2493,27 @@ # fallback = None. def special_namespace(self, code, fallback = '_default'): return self.namespace(code, -1, fallback) - + def special_namespace_url(self, code, fallback = '_default'): encoded_title = self.namespace(code, -1, fallback).encode(self.code2encoding(code)) return urllib.quote(encoded_title) - + def image_namespace(self, code, fallback = '_default'): return self.namespace(code, 6, fallback) - + def image_namespace_url(self, code, fallback = '_default'): encoded_title = self.namespace(code, 6, fallback).encode(self.code2encoding(code)) return urllib.quote(encoded_title) - + def mediawiki_namespace(self, code, fallback = '_default'): return self.namespace(code, 8, fallback) - + def template_namespace(self, code, fallback = '_default'): return self.namespace(code, 10, fallback) - + def category_namespace(self, code, fallback = '_default'): return self.namespace(code, 14, fallback) - + def category_namespaces(self, code): namespaces = [] namespace_title = self.namespace(code, 14) @@ -2608,10 +2603,7 @@ pos2 += [p,p.lower()] return pos2
- - # Methods - def protocol(self, code): """ Can be overridden to return 'https'. @@ -2621,7 +2613,7 @@
def hostname(self, code): return self.langs[code] - + def path(self, code): return '/w/index.php'
@@ -2639,11 +2631,10 @@ return '%s%s' % (code, self.name)
# Which version of MediaWiki is used? - def version(self, code): # Don't use this, use versionnumber() instead. This only exists # to not break family files. - return "1.5" + return "1.12alpha"
def versionnumber(self, code): R = re.compile(r"(\d+).(\d+)") @@ -2655,7 +2646,7 @@
def page_action_address(self, code, name, action): return '%s?title=%s&action=%s' % (self.path(code), name, action) - + def put_address(self, code, name): return '%s?title=%s&action=submit' % (self.path(code), name)
@@ -2665,7 +2656,7 @@ # The URL to get a page, in the format indexed by Google. def nice_get_address(self, code, name): return '/wiki/%s' % (name) - + def edit_address(self, code, name): return '%s?title=%s&action=edit' % (self.path(code), name)
@@ -2814,13 +2805,13 @@
def uncategorizedcategories_address(self, code, limit=500): return "%s?title=%s:Uncategorizedcategories&limit=%d" % (self.path(code), self.special_namespace_url(code), limit) - + def uncategorizedimages_address(self, code, limit=500): return "%s?title=%s:Uncategorizedimages&limit=%d" % (self.path(code), self.special_namespace_url(code), limit) - + def uncategorizedpages_address(self, code, limit=500): return "%s?title=%s:Uncategorizedpages&limit=%d" % (self.path(code), self.special_namespace_url(code), limit) - + def unusedcategories_address(self, code, limit=500): return "%s?title=%s:Unusedcategories&limit=%d" % (self.path(code), self.special_namespace_url(code), limit)
@@ -2841,6 +2832,7 @@ return cmp(self.name, otherfamily.name) except AttributeError: return cmp(id(self), id(otherfamily)) + def __hash__(self): return hash(self.name)
@@ -2858,7 +2850,7 @@ def has_query_api(self,code): """Is query.php installed in the wiki?""" return False - + def shared_image_repository(self, code): """Return the shared image repository, if any.""" return (None, None)
pywikipedia-l@lists.wikimedia.org