http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9635
Revision: 9635
Author: multichill
Date: 2011-10-16 18:21:46 +0000 (Sun, 16 Oct 2011)
Log Message:
-----------
* Add some fair use templates to the list of skip templates to prevent the bot from uploading photos of (unfree) sculptures
* Add {{orphan image}} to the list of garbage templates to remove
* Also strip off garbage templates with parameters
* If the license is in the permission part of the information template: Remove it, otherwise it will show up twice.
Modified Paths:
--------------
trunk/pywikipedia/imagecopy_self.py
Modified: trunk/pywikipedia/imagecopy_self.py
===================================================================
--- trunk/pywikipedia/imagecopy_self.py 2011-10-16 12:23:45 UTC (rev 9634)
+++ trunk/pywikipedia/imagecopy_self.py 2011-10-16 18:21:46 UTC (rev 9635)
@@ -126,6 +126,10 @@
u'Ffd',
u'PD-user', # Only the self templates are supported for now.
u'Ticket Scan',
+ u'Non-free 2D art',
+ u'Non-free 3D art',
+ u'Non-free architectural work',
+ u'Non-free fair use in',
],
'lb' : [u'Läschen',
],
@@ -169,7 +173,7 @@
'en': [u'==\s*Description\s*==',
u'==\s*Summary\s*==',
u'==\s*Licensing:?\s*==',
- u'\{\{(Copy to Wikimedia Commons|Move to Commons|Move to commons|Move to Wikimedia Commons|Copy to commons|Mtc|MtC|MTC|CWC|CtWC|CTWC|Ctwc|Tocommons|Copy to Commons|To Commons|Movetocommons|Move to Wikimedia commons|Move-to-commons|Commons ok|ToCommons|To commons|MoveToCommons|Copy to wikimedia commons|Upload to commons|CopyToCommons|Copytocommons|MITC|MovetoCommons|Do move to Commons)\}\}'
+ u'\{\{(Copy to Wikimedia Commons|Move to Commons|Move to commons|Move to Wikimedia Commons|Copy to commons|Mtc|MtC|MTC|CWC|CtWC|CTWC|Ctwc|Tocommons|Copy to Commons|To Commons|Movetocommons|Move to Wikimedia commons|Move-to-commons|Commons ok|ToCommons|To commons|MoveToCommons|Copy to wikimedia commons|Upload to commons|CopyToCommons|Copytocommons|MITC|MovetoCommons|Do move to Commons|Orphan image)(\|[^\}]+)?\}\}'
],
'lb' : [u'==\s*Résumé\s*==',
u'==\s*Lizenz:\s*==',
@@ -382,6 +386,9 @@
# Permission
# Still have to filter out crap like "see below" or "yes"
if not contents[u'permission']==u'':
+ # Strip of the license temlate if it's in the permission section
+ for (regex, repl) in licenseTemplates[imagepage.site().language()]:
+ contents[u'permission'] = re.sub(regex, u'', contents[u'permission'], flags=re.IGNORECASE)
permission = self.convertLinks(contents[u'permission'], imagepage.site())
# Other_versions
http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9632
Revision: 9632
Author: xqt
Date: 2011-10-16 11:41:54 +0000 (Sun, 16 Oct 2011)
Log Message:
-----------
Bugfix for unexpected results of family.namespaces dict (bug #3424343). family.namespace() must work on a clone, not on the namespaces itself and always return a copy. Otherwise it could duplicate namespaces dictionarys content on every call.
Modified Paths:
--------------
trunk/pywikipedia/family.py
Modified: trunk/pywikipedia/family.py
===================================================================
--- trunk/pywikipedia/family.py 2011-10-15 17:34:36 UTC (rev 9631)
+++ trunk/pywikipedia/family.py 2011-10-16 11:41:54 UTC (rev 9632)
@@ -3733,7 +3733,9 @@
raise KeyError('ERROR: Unknown namespace %d for %s:%s' % (ns_number, code, self.name))
elif self.isNsI18N(ns_number, code):
v = self.namespaces[ns_number][code]
- if type(v) is not list:
+ if type(v) == list:
+ v = v[:]
+ else:
v = [v,]
if all and self.isNsI18N(ns_number, fallback):
v2 = self.namespaces[ns_number][fallback]
@@ -3743,7 +3745,9 @@
v.append(v2)
elif fallback and self.isNsI18N(ns_number, fallback):
v = self.namespaces[ns_number][fallback]
- if type(v) is not list:
+ if type(v) == list:
+ v = v[:]
+ else:
v = [v,]
else:
raise KeyError('ERROR: title for namespace %d in language %s unknown' % (ns_number, code))