Revision: 5863
Author: russblau
Date: 2008-08-28 20:34:46 +0000 (Thu, 28 Aug 2008)
Log Message:
-----------
API has changed timestamp formats
Modified Paths:
--------------
branches/rewrite/pywikibot/page.py
Modified: branches/rewrite/pywikibot/page.py
===================================================================
--- branches/rewrite/pywikibot/page.py 2008-08-28 19:38:11 UTC (rev 5862)
+++ branches/rewrite/pywikibot/page.py 2008-08-28 20:34:46 UTC (rev 5863)
@@ -382,7 +382,7 @@
return self._revisions[self.latestRevision()].anon
def editTime(self):
- """Return timestamp (in MediaWiki format) of last revision to page."""
+ """Return timestamp (in ISO 8601 format) of last revision to page."""
return self._revisions[self.latestRevision()].timestamp
def previousRevision(self):
@@ -1374,7 +1374,7 @@
@type revid: int
@param text: Revision wikitext.
@type text: unicode, or None if text not yet retrieved
- @param timestamp: Revision time stamp (in MediaWiki text format)
+ @param timestamp: Revision time stamp (in ISO 8601 format)
@type timestamp: unicode
@param user: user who edited this revision
@type user: unicode
Bugs item #2011362, was opened at 2008-07-05 20:07
Message generated for change (Comment added) made by melancholie
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2011362&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: Melancholie (melancholie)
Assigned to: Nobody/Anonymous (nobody)
>Summary: Update featured.py (patch)
Initial Comment:
Both, hiwiki and yiwiki do use Template:Link_FA, the pages hi:Template:Lien AdQ and yi:Template: are only redirects.
By re-adding 'Link FA' to the langs arrays, Template:Link_FA will be used by the bot (otherewise those redirects).
----------------------------------------------------------------------
>Comment By: Melancholie (melancholie)
Date: 2008-08-28 09:20
Message:
Logged In: YES
user_id=2089773
Originator: YES
Added 'cy', see
http://als.wikipedia.org/wiki/Benutzer_Diskussion:Melancholie#via_roboto_.2…
File Added: featured.diff
----------------------------------------------------------------------
Comment By: Melancholie (melancholie)
Date: 2008-08-18 23:45
Message:
Logged In: YES
user_id=2089773
Originator: YES
File Added: featured.diff
----------------------------------------------------------------------
Comment By: Melancholie (melancholie)
Date: 2008-08-18 23:44
Message:
Logged In: YES
user_id=2089773
Originator: YES
Added szl category
File Added: featured.diff
----------------------------------------------------------------------
Comment By: Melancholie (melancholie)
Date: 2008-08-05 13:50
Message:
Logged In: YES
user_id=2089773
Originator: YES
added patch (working current)
File Added: featured.diff
----------------------------------------------------------------------
Comment By: Melancholie (melancholie)
Date: 2008-07-11 07:51
Message:
Logged In: YES
user_id=2089773
Originator: YES
Maybe I was a little bit too imprecise ;-)
Here is what I mean:
templatelist = template['_default']
try:
templatelist += template[tosite.lang]
+ (u" {{%s|%s}}" % (templatelist[0],
fromsite.lang))
templatelist[0] is 'Link FA', but the localized templates used are
templatelist[1]. If there is a localized template (with Link_FA being only
a redirect) it should be used for edit. So it might be good to change the
order (make 'try:' first, add _default with +=)
For hi, yi the easiest way might be to just comment out the localized
template names, as they are only redirects to Link_FA.
----------------------------------------------------------------------
Comment By: Melancholie (melancholie)
Date: 2008-07-10 11:59
Message:
Logged In: YES
user_id=2089773
Originator: YES
So {{Link FA}} is always the first choice?
Or does _default actually follow redirects?
----------------------------------------------------------------------
Comment By: NicDumZ Nicolas Dumazet (nicdumz)
Date: 2008-07-10 10:41
Message:
Logged In: YES
user_id=1963242
Originator: NO
I'm not sure melancholie :)
I added {{Leam VdC}} in r5707, however, since r5669 (
https://fisheye.toolserver.org/browse/pywikipedia/trunk/pywikipedia/feature…
) it uses the '_default' entry (Link FA) AND the locale entry. The list for
hi: is for example ['Link Fa', 'Lien AdQ']
----------------------------------------------------------------------
Comment By: Melancholie (melancholie)
Date: 2008-07-10 10:28
Message:
Logged In: YES
user_id=2089773
Originator: YES
Furthermore, add http://fur.wikipedia.org/wiki/Model:Leam_VdC
[I wish I were able to do this things myself, but *still* no account yet]
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2011362&group_…
Revision: 5857
Author: balasyum
Date: 2008-08-28 07:01:33 +0000 (Thu, 28 Aug 2008)
Log Message:
-----------
Made censure.py work with not only wikipedia projects.
Modified Paths:
--------------
trunk/pywikipedia/censure.py
Modified: trunk/pywikipedia/censure.py
===================================================================
--- trunk/pywikipedia/censure.py 2008-08-28 06:05:23 UTC (rev 5856)
+++ trunk/pywikipedia/censure.py 2008-08-28 07:01:33 UTC (rev 5857)
@@ -15,25 +15,27 @@
import sys
import thread
+# The indexes for projects are as: <language code>.<family>
+
# The page, where the bot logs to
logPages = {
- 'hu': u'Wikipédia:Potenciálisan vandalizmus áldozatául esett szócikkek',
+ 'hu.wikipedia': u'Wikipédia:Potenciálisan vandalizmus áldozatául esett szócikkek',
}
# To add a new language, create or find the bad word page
-# similarly to the 'hu' one (one word per line, starting with <pre> and ending with </pre> lines),
+# similarly to the 'hu.wikipedia' one (one word per line, starting with <pre> and ending with </pre> lines),
# and add to the badWordList lines below.
badWordList = {
- 'hu': u'User:Cenzúrabot/lista',
+ 'hu.wikipedia': u'User:Cenzúrabot/lista',
}
site = wikipedia.getSite()
-if not badWordList.has_key(site.language()) or not logPages.has_key(site.language()):
+if not badWordList.has_key(site.language() + '.' + site.family.name) or not logPages.has_key(site.language() + '.' + site.family.name):
wikipedia.output('Error: your language isn\'t supported, see the source code for further details')
sys.exit(1)
-ownWordPage = wikipedia.Page(site, badWordList[site.language()])
+ownWordPage = wikipedia.Page(site, badWordList[site.language() + '.' + site.family.name])
try:
ownWordList = ownWordPage.get(get_redirect = True)
except wikipedia.NoPage:
@@ -64,7 +66,7 @@
return -1
def checkPage(title, onlyLastDiff = False):
- if title == logPages[site.language()]:
+ if title == logPages[site.language() + '.' + site.family.name]:
return
wikipedia.output('Checking ' + title + ' for bad word list')
page = wikipedia.Page(site, title)
@@ -91,7 +93,7 @@
wordsIn.append(badWord)
report = True
if report:
- logPage = wikipedia.Page(site, logPages[site.language()])
+ logPage = wikipedia.Page(site, logPages[site.language() + '.' + site.family.name])
try:
log = logPage.get()
except:
Bugs item #2079760, was opened at 2008-08-28 05:30
Message generated for change (Comment added) made by nicdumz
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2079760&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: General
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Mikko Silvonen (silvonen)
Assigned to: Nobody/Anonymous (nobody)
Summary: Periods converted to percent signs in section links
Initial Comment:
Why did my interwiki.py edit http://en.wikipedia.org/w/index.php?title=1st_Belorussian_Front&diff=234605… convert the link
[[de:Zentralfront#1._Wei.C3.9Frussische_Front]]
to
[[de:Zentralfront#1% Weirussische Front]]?
The correct decoded link would be:
[[de:Zentralfront#1. Weirussische Front]]
C:\svn\pywikipedia>python version.py
Pywikipedia [http] trunk/pywikipedia (r5854, Aug 27 2008, 21:32:58)
Python 2.5.1 (r251:54863, May 1 2007, 17:47:05) [MSC v.1310 32 bit (Intel)]
----------------------------------------------------------------------
>Comment By: NicDumZ Nicolas Dumazet (nicdumz)
Date: 2008-08-28 08:06
Message:
Logged In: YES
user_id=1963242
Originator: NO
r5856 ( patch by Jeremy B. ) should fix this :)
----------------------------------------------------------------------
Comment By: Jeremy Baron (jeremybaron)
Date: 2008-08-28 06:35
Message:
Logged In: YES
user_id=1669658
Originator: NO
I don't know the anchor encoding MediaWiki uses too well but I think this
fixes it. (patch below because I see no obvious way to attach. I know
there is a way, maybe I don't have sufficient privs.)
Rudimentary tests (before and after patch application):
In [7]: import wikipedia
Checked for running processes. 1 processes currently running, including
the current process.
In [8]: sectionlinktests =
('de:Zentralfront#1._Wei.C3.9Frussische_Front','a#.41.29');sectionlinktester
= lambda x: wikipedia.Page(wikipedia.getSite(),x).aslink()
In [9]: [(x,sectionlinktester(x)) for x in sectionlinktests]
Out[9]:
[('de:Zentralfront#1._Wei.C3.9Frussische_Front',
u'[[de:Zentralfront#1% Wei\xdfrussische Front]]'),
('a#.41.29', u'[[A#A)]]')]
In [10]: reload(wikipedia)
Checked for running processes. 2 processes currently running, including
the current process.
Out[10]: <module 'wikipedia' from
'/Users/jeremy/sandbox/mediawiki/pywikipediabot/pywikipedia/wikipedia.py'>
In [11]: [(x,sectionlinktester(x)) for x in sectionlinktests]
Out[11]:
[('de:Zentralfront#1._Wei.C3.9Frussische_Front',
u'[[de:Zentralfront#1. Wei\xdfrussische Front]]'),
('a#.41.29', u'[[A#A)]]')]
patch:
Index: pywikipedia/wikipedia.py
===================================================================
--- pywikipedia/wikipedia.py (revision 5855)
+++ pywikipedia/wikipedia.py (working copy)
@@ -228,6 +228,7 @@
Rwatchlist = re.compile(r"<input tabindex='[\d]+' type='checkbox' "
r"name='wpWatchthis' checked='checked'")
Rlink = re.compile(r'\[\[(?P<title>[^\]\|\[]*)(\|[^\]]*)?\]\]')
+resectiondecode = re.compile(r".(?=[0-9a-f]{2})",re.I)
class Page(object):
@@ -526,7 +527,7 @@
"""
section = self._section
if section and decode:
- section = section.replace('.', '%')
+ section = resectiondecode.sub('%',section)
section = url2unicode(section, self._site)
if not underscore:
section = section.replace('_', ' ')
btw, sourceforge strips all kinds of things out of bugspam, not just
german chars :-/
----------------------------------------------------------------------
Comment By: Jeremy Baron (jeremybaron)
Date: 2008-08-28 06:34
Message:
Logged In: YES
user_id=1669658
Originator: NO
I don't know the anchor encoding MediaWiki uses too well but I think this
fixes it. (patch below because I see no obvious way to attach. I know
there is a way, maybe I don't have sufficient privs.)
Rudimentary tests (before and after patch application):
In [7]: import wikipedia
Checked for running processes. 1 processes currently running, including
the current process.
In [8]: sectionlinktests =
('de:Zentralfront#1._Wei.C3.9Frussische_Front','a#.41.29');sectionlinktester
= lambda x: wikipedia.Page(wikipedia.getSite(),x).aslink()
In [9]: [(x,sectionlinktester(x)) for x in sectionlinktests]
Out[9]:
[('de:Zentralfront#1._Wei.C3.9Frussische_Front',
u'[[de:Zentralfront#1% Wei\xdfrussische Front]]'),
('a#.41.29', u'[[A#A)]]')]
In [10]: reload(wikipedia)
Checked for running processes. 2 processes currently running, including
the current process.
Out[10]: <module 'wikipedia' from
'/Users/jeremy/sandbox/mediawiki/pywikipediabot/pywikipedia/wikipedia.py'>
In [11]: [(x,sectionlinktester(x)) for x in sectionlinktests]
Out[11]:
[('de:Zentralfront#1._Wei.C3.9Frussische_Front',
u'[[de:Zentralfront#1. Wei\xdfrussische Front]]'),
('a#.41.29', u'[[A#A)]]')]
patch:
Index: pywikipedia/wikipedia.py
===================================================================
--- pywikipedia/wikipedia.py (revision 5855)
+++ pywikipedia/wikipedia.py (working copy)
@@ -228,6 +228,7 @@
Rwatchlist = re.compile(r"<input tabindex='[\d]+' type='checkbox' "
r"name='wpWatchthis' checked='checked'")
Rlink = re.compile(r'\[\[(?P<title>[^\]\|\[]*)(\|[^\]]*)?\]\]')
+resectiondecode = re.compile(r".(?=[0-9a-f]{2})",re.I)
class Page(object):
@@ -526,7 +527,7 @@
"""
section = self._section
if section and decode:
- section = section.replace('.', '%')
+ section = resectiondecode.sub('%',section)
section = url2unicode(section, self._site)
if not underscore:
section = section.replace('_', ' ')
btw, sourceforge strips all kinds of things out of bugspam, not just
german chars :-/
----------------------------------------------------------------------
Comment By: Mikko Silvonen (silvonen)
Date: 2008-08-28 05:38
Message:
Logged In: YES
user_id=127947
Originator: YES
Ouch, the SourceForge email system removes the German sharp s character
from the messages. See this issue on the web for the correct links.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2079760&group_…