Revision: 4147
Author: btongminh
Date: 2007-08-30 11:15:10 +0000 (Thu, 30 Aug 2007)
Log Message:
-----------
Add a script that checks whether the namespaces of a family file are still current.
Added Paths:
-----------
trunk/pywikipedia/maintenance/
trunk/pywikipedia/maintenance/family_check.py
Added: trunk/pywikipedia/maintenance/family_check.py
===================================================================
--- trunk/pywikipedia/maintenance/family_check.py (rev 0)
+++ trunk/pywikipedia/maintenance/family_check.py 2007-08-30 11:15:10 UTC (rev 4147)
@@ -0,0 +1,52 @@
+import sys
+sys.path.append('..')
+
+import wikipedia, config
+from wikipedia import output
+
+import simplejson
+
+def check_namespaces(site):
+ predata = {'action': 'query',
+ 'meta': 'siteinfo',
+ 'siprop': 'namespaces',
+ 'format': 'json'}
+ response, json = site.postForm(site.apipath(), predata)
+ if '<h1 class="firstHeading">Wiki does not exist</h1>' in json:
+ output(u'Warning! %s is defined but does not exist!' % site)
+ return
+
+ data = simplejson.loads(json)
+ result = []
+ for namespace in data['query']['namespaces'].itervalues():
+ try:
+ defined_namespace = site.namespace(namespace['id'])
+ except KeyError:
+ output(u'Warning! %s has no _default for namespace %s' % \
+ (site, namespace['id']))
+ defined_namespace = None
+
+ if defined_namespace != namespace['*'] and namespace['*']:
+ result.append((namespace['id'], namespace['*']))
+ return result
+
+def check_family(family):
+ output(u'Checking namespaces for %s' % family.name)
+ result = {}
+ for lang in family.langs:
+ site = wikipedia.getSite(lang, family)
+ output(u'Checking %s' % site)
+ namespaces = check_namespaces(site)
+ if namespaces:
+ for id, name in namespaces:
+ output(u'Namespace %s for %s is %s, %s is defined in family file.' % \
+ (id, site, name, site.namespace(id)))
+ result[lang] = namespaces
+ return result
+
+if __name__ == '__main__':
+ wikipedia.handleArgs()
+ family = wikipedia.Family(wikipedia.default_family)
+ result = check_family(family)
+ output(u'Writing raw Python dictionary to stdout.')
+ print result
\ No newline at end of file
Patches item #1784709, was opened at 2007-08-30 12:08
Message generated for change (Comment added) made by rhodo
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1784709&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: rhodo (rhodo)
Assigned to: Nobody/Anonymous (nobody)
Summary: remove unnecessary line in func unwatchedpages
Initial Comment:
removes a line in wikipedia.py. The line can cause the script to break.
----------------------------------------------------------------------
>Comment By: rhodo (rhodo)
Date: 2007-08-30 12:21
Message:
Logged In: YES
user_id=1836665
Originator: YES
I wrote this function and send it to Head. Unfortunately it contained a
debug line which is unnecessary and may cause the script to break if the
html output contains non unicode characters like german umlauts.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1784709&group_…
Patches item #1784709, was opened at 2007-08-30 12:08
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1784709&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: rhodo (rhodo)
Assigned to: Nobody/Anonymous (nobody)
Summary: remove unnecessary line in func unwatchedpages
Initial Comment:
removes a line in wikipedia.py. The line can cause the script to break.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1784709&group_…
Patches item #1784625, was opened at 2007-08-30 09:41
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1784625&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Leszek Krupiński (leszek_k)
Assigned to: Nobody/Anonymous (nobody)
Summary: Regular expression page generator
Initial Comment:
Included patch adds new page generator, which yields pages with title matching to given regular expression.
Additionally it fixes small bug with google page generator.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1784625&group_…