Revision: 5450 Author: nicdumz Date: 2008-05-28 10:54:30 +0000 (Wed, 28 May 2008)
Log Message: ----------- syntax / regex fixes for previous commit
Modified Paths: -------------- trunk/pywikipedia/welcome.py
Modified: trunk/pywikipedia/welcome.py =================================================================== --- trunk/pywikipedia/welcome.py 2008-05-28 10:37:23 UTC (rev 5449) +++ trunk/pywikipedia/welcome.py 2008-05-28 10:54:30 UTC (rev 5450) @@ -387,29 +387,29 @@
def parselog(wsite, raw, talk, number): """ The function to load the users (only users who have a certain number of edits) """ - #FIXME : Why is there a need for this 'done' list ? + #FIXME : Why is there a need for this 'done' list ? We're not even checking for duplicates... done = list()
- autocreated = wikipedia.mediawiki_message('newuserlog-autocreate-entry') + autocreated = wsite.mediawiki_message('newuserlog-autocreate-entry')
# I search with a regex how many user have not the talk page # and i put them in a list (i find it more easy and secure).
# XXX: That's the regex, if there are problems, take a look here.
- reg = u'(<a href="' + re.escape(wsite.path()) - + u'?title=%s(?P<user>.*?)&(?:amp;|)action=(?:edit|editredlink|edit&redlink=1)"' % talk - + u'.*?) (?P<reason>.*?) </li>' + reg = u'(<a href="' + re.escape(wsite.path()) + reg += u'?title=%s(?P<user>.*?)&(?:amp;|)action=(?:edit|editredlink|edit&redlink=1)"' % talk + reg += u'.*?) (?P<reason>.*?) \u200E </li>' p = re.compile(reg, re.UNICODE)
for x in p.finditer(raw): + username = x.group('user') + if username not in done: + done.append(username) #skip autocreated users (SUL) if autocreated in x.group('reason'): - wikipedia.output(u'%s has been created automatically, skipping...') + wikipedia.output(u'%s has been created automatically, skipping...' % username) continue - username = x.group('user') - if username not in done: - done.append(username) userpage = wikipedia.Page(wsite, username) # Defing the contrib's page of the user. pathWiki = wsite.family.nicepath(wsite.lang) @@ -847,7 +847,7 @@ # is in username lower_uname.replace(xy, '') for word in elenco: - baduser = word.lower() in lower_uname: + baduser = word.lower() in lower_uname break # He has a badusername, trying to report him... if baduser: