lists.wikimedia.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
List overview
Download
Pywikipedia-svn
September 2009
----- 2024 -----
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
pywikipedia-svn@lists.wikimedia.org
9 participants
145 discussions
Start a n
N
ew thread
SVN: [7199] trunk/pywikipedia/flickrripper.py
by multichill@svn.wikimedia.org
Revision: 7199 Author: multichill Date: 2009-09-02 21:40:23 +0000 (Wed, 02 Sep 2009) Log Message: ----------- Added start_id and end_id option to resume uploads. Modified Paths: -------------- trunk/pywikipedia/flickrripper.py Modified: trunk/pywikipedia/flickrripper.py =================================================================== --- trunk/pywikipedia/flickrripper.py 2009-09-02 18:17:54 UTC (rev 7198) +++ trunk/pywikipedia/flickrripper.py 2009-09-02 21:40:23 UTC (rev 7199) @@ -39,6 +39,7 @@ from Tkinter import * from PIL import Image, ImageTk # see:
http://www.pythonware.com/products/pil/
+ def getPhoto(flickr = None, photo_id = ''): ''' Get the photo info and the photo sizes so we can use these later on @@ -323,11 +324,18 @@ self.root.mainloop() return (self.photoDescription, self.filename, self.skip) -def getPhotos(flickr=None, user_id=u'', group_id=u'', photoset_id=u'', tags=u''): +def getPhotos(flickr=None, user_id=u'', group_id=u'', photoset_id=u'', start_id='', end_id='', tags=u''): ''' Loop over a set of Flickr photos. + ''' - result = [] + result = [] + retry = False + if not start_id: + found_start_id=True + else: + found_start_id=False + #
http://www.flickr.com/services/api/flickr.groups.pools.getPhotos.html
# Get the photos in a group if(group_id): @@ -336,9 +344,24 @@ pages = photos.find('photos').attrib['pages'] for i in range(1, int(pages)): - for photo in flickr.groups_pools_getPhotos(group_id=group_id, user_id=user_id, tags=tags, per_page='100', page=i).find('photos').getchildren(): - yield photo.attrib['id'] - + gotPhotos = False + while not gotPhotos: + try: + for photo in flickr.groups_pools_getPhotos(group_id=group_id, user_id=user_id, tags=tags, per_page='100', page=i).find('photos').getchildren(): + if photo.attrib['id']==start_id: + found_start_id=True + if found_start_id: + if photo.attrib['id']==end_id: + wikipedia.output('Found end_id') + return + else: + yield photo.attrib['id'] + + except flickrapi.exceptions.FlickrError: + gotPhotos = False + wikipedia.output(u'Flickr api problem, sleeping') + sleep(30) + #
http://www.flickr.com/services/api/flickr.photosets.getPhotos.html
# Get the photos in a photoset elif(photoset_id): @@ -346,18 +369,51 @@ pages = photos.find('photos').attrib['pages'] for i in range(1, int(pages)): - for photo in flickr.photosets_getPhotos(photoset_id=photoset_id, per_page='100', page=i).find('photos').getchildren(): - yield photo.attrib['id'] + gotPhotos = False + while not gotPhotos: + try: + for photo in flickr.photosets_getPhotos(photoset_id=photoset_id, per_page='100', page=i).find('photos').getchildren(): + gotPhotos = True + if photo.attrib['id']==start_id: + found_start_id=True + if found_start_id: + if photo.attrib['id']==end_id: + wikipedia.output('Found end_id') + return + else: + yield photo.attrib['id'] + + except flickrapi.exceptions.FlickrError: + gotPhotos = False + wikipedia.output(u'Flickr api problem, sleeping') + sleep(30) #
http://www.flickr.com/services/api/flickr.people.getPublicPhotos.html
# Get the (public) photos uploaded by a user elif(user_id): photos = flickr.people_getPublicPhotos(user_id=user_id, per_page='100', page='1') pages = photos.find('photos').attrib['pages'] + #flickrapi.exceptions.FlickrError + for i in range(1, int(pages)): + gotPhotos = False + while not gotPhotos: + try: + for photo in flickr.people_getPublicPhotos(user_id=user_id, per_page='100', page=i).find('photos').getchildren(): + gotPhotos = True + if photo.attrib['id']==start_id: + found_start_id=True + if found_start_id: + if photo.attrib['id']==end_id: + wikipedia.output('Found end_id') + return + else: + yield photo.attrib['id'] - for i in range(1, int(pages)): - for photo in flickr.people_getPublicPhotos(user_id=user_id, per_page='100', page=i).find('photos').getchildren(): - yield photo.attrib['id'] + except flickrapi.exceptions.FlickrError: + gotPhotos = False + wikipedia.output(u'Flickr api problem, sleeping') + sleep(30) + return def usage(): @@ -389,6 +445,8 @@ group_id = u'' photoset_id = u'' user_id = u'' + start_id= u'' + end_id=u'' tags = u'' totalPhotos = 0 uploadedPhotos = 0 @@ -428,6 +486,16 @@ user_id = wikipedia.input(u'What is the user_id of the flickr user?') else: user_id = arg[9:] + elif arg.startswith('-start_id'): + if len(arg) == 9: + start_id = wikipedia.input(u'What is the id of the photo you want to start at?') + else: + start_id = arg[10:] + elif arg.startswith('-end_id'): + if len(arg) == 7: + end_id = wikipedia.input(u'What is the id of the photo you want to end at?') + else: + end_id = arg[8:] elif arg.startswith('-tags'): if len(arg) == 5: tags = wikipedia.input(u'What is the tag you want to filter out (currently only one supported)?') @@ -447,7 +515,7 @@ override = arg[10:] if user_id or group_id or photoset_id: - for photo_id in getPhotos(flickr=flickr, user_id=user_id, group_id=group_id, photoset_id=photoset_id, tags=tags): + for photo_id in getPhotos(flickr=flickr, user_id=user_id, group_id=group_id, photoset_id=photoset_id, start_id=start_id, end_id=end_id, tags=tags): uploadedPhotos = uploadedPhotos + processPhoto(flickr=flickr, photo_id=photo_id, flickrreview=flickrreview, reviewer=reviewer, override=override) totalPhotos = totalPhotos + 1 else:
14 years, 8 months
1
0
0
0
SVN: [7198] trunk/pywikipedia/families/strategy_family.py
by multichill@svn.wikimedia.org
Revision: 7198 Author: multichill Date: 2009-09-02 18:17:54 +0000 (Wed, 02 Sep 2009) Log Message: ----------- Some cleanup Modified Paths: -------------- trunk/pywikipedia/families/strategy_family.py Modified: trunk/pywikipedia/families/strategy_family.py =================================================================== --- trunk/pywikipedia/families/strategy_family.py 2009-09-02 18:08:23 UTC (rev 7197) +++ trunk/pywikipedia/families/strategy_family.py 2009-09-02 18:17:54 UTC (rev 7198) @@ -14,7 +14,7 @@ 'strategy': '
strategy.wikimedia.org
', } if config.SSL_connection: - self.langs['commons'] = None + self.langs['strategy'] = None self.namespaces[4] = { '_default': [u'Strategic Planning', 'Project'], @@ -22,36 +22,15 @@ self.namespaces[5] = { '_default': [u'Strategic Planning talk', 'Project talk'], } - self.namespaces[100] = { - '_default': [u'Creator', 'Project'], + self.namespaces[106] = { + '_default': [u'Proposal'], } - self.namespaces[101] = { - '_default': [u'Creator talk', 'Project talk'], + self.namespaces[107] = { + '_default': [u'Proposal talk'], } self.interwiki_forward = 'wikipedia' - self.category_redirect_templates = { - 'commons': (u'Category redirect', - u'Categoryredirect', - u'See cat', - u'Seecat', - u'Catredirect', - u'Cat redirect', - u'CatRed', - u'Cat-red', - u'Catredir', - u'Redirect category'), - } - - self.disambiguationTemplates = { - 'commons': [u'Disambig', u'Disambiguation', u'Razločitev', - u'Begriffsklärung'] - } - - self.disambcatname = { - 'commons': u'Disambiguation' - } def version(self, code): return '1.16alpha-wmf'
14 years, 8 months
1
0
0
0
SVN: [7197] trunk/pywikipedia/families/strategy_family.py
by multichill@svn.wikimedia.org
Revision: 7197 Author: multichill Date: 2009-09-02 18:08:23 +0000 (Wed, 02 Sep 2009) Log Message: ----------- Family file for Wikimedia strategy wiki. File based on the Commons family file and altered by [MarkW]. Added Paths: ----------- trunk/pywikipedia/families/strategy_family.py Copied: trunk/pywikipedia/families/strategy_family.py (from rev 7187, trunk/pywikipedia/families/commons_family.py) =================================================================== --- trunk/pywikipedia/families/strategy_family.py (rev 0) +++ trunk/pywikipedia/families/strategy_family.py 2009-09-02 18:08:23 UTC (rev 7197) @@ -0,0 +1,76 @@ +# -*- coding: utf-8 -*- + +__version__ = '$Id$' + +import family, config + +# The Wikimedia Strategy family + +class Family(family.Family): + def __init__(self): + family.Family.__init__(self) + self.name = 'strategy' + self.langs = { + 'strategy': '
strategy.wikimedia.org
', + } + if config.SSL_connection: + self.langs['commons'] = None + + self.namespaces[4] = { + '_default': [u'Strategic Planning', 'Project'], + } + self.namespaces[5] = { + '_default': [u'Strategic Planning talk', 'Project talk'], + } + self.namespaces[100] = { + '_default': [u'Creator', 'Project'], + } + self.namespaces[101] = { + '_default': [u'Creator talk', 'Project talk'], + } + + self.interwiki_forward = 'wikipedia' + + self.category_redirect_templates = { + 'commons': (u'Category redirect', + u'Categoryredirect', + u'See cat', + u'Seecat', + u'Catredirect', + u'Cat redirect', + u'CatRed', + u'Cat-red', + u'Catredir', + u'Redirect category'), + } + + self.disambiguationTemplates = { + 'commons': [u'Disambig', u'Disambiguation', u'Razločitev', + u'Begriffsklärung'] + } + + self.disambcatname = { + 'commons': u'Disambiguation' + } + + def version(self, code): + return '1.16alpha-wmf' + + def dbName(self, code): + return 'strategywiki_p' + + def shared_image_repository(self, code): + return ('commons', 'commons') + + if config.SSL_connection: + def hostname(self, code): + return '
secure.wikimedia.org
' + + def protocol(self, code): + return 'https' + + def scriptpath(self, code): + return '/wikipedia/strategy/w' + + def nicepath(self, code): + return '/wikipedia/strategy/wiki/'
14 years, 8 months
1
0
0
0
SVN: [7196] trunk/pywikipedia/wikipedia.py
by alexsh@svn.wikimedia.org
Revision: 7196 Author: alexsh Date: 2009-09-02 06:21:03 +0000 (Wed, 02 Sep 2009) Log Message: ----------- typo params Modified Paths: -------------- trunk/pywikipedia/wikipedia.py Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2009-09-02 06:18:39 UTC (rev 7195) +++ trunk/pywikipedia/wikipedia.py 2009-09-02 06:21:03 UTC (rev 7196) @@ -2780,9 +2780,8 @@ output(u'Page %s undeleted' % self.aslink()) return result - def protect(self, ec = 'sysop', move = 'sysop', unprotect = False, reason = None, - ec_duration = 'infinite', move_duration = 'infinite', - cascading = False, prompt = True, throttle = True): + def protect(self, ec = 'sysop', move = 'sysop', unprotect = False, reason = None, ec_duration = 'infinite', + move_duration = 'infinite', cascading = False, prompt = True, throttle = True): """(Un)protect a wiki title. Requires administrator status. If the title is not exist, the protection only ec (aka edit/create) available
14 years, 8 months
1
0
0
0
SVN: [7195] trunk/pywikipedia/wikipedia.py
by alexsh@svn.wikimedia.org
Revision: 7195 Author: alexsh Date: 2009-09-02 06:18:39 +0000 (Wed, 02 Sep 2009) Log Message: ----------- Page().protect(): follow current version: diff level duration and page creation protect Modified Paths: -------------- trunk/pywikipedia/wikipedia.py Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2009-08-31 21:52:10 UTC (rev 7194) +++ trunk/pywikipedia/wikipedia.py 2009-09-02 06:18:39 UTC (rev 7195) @@ -2780,12 +2780,14 @@ output(u'Page %s undeleted' % self.aslink()) return result - def protect(self, edit='sysop', move='sysop', unprotect=False, - reason=None, duration = None, cascading = False, prompt=True, throttle=True): - """(Un)protect a wiki page. Requires administrator status. + def protect(self, ec = 'sysop', move = 'sysop', unprotect = False, reason = None, + ec_duration = 'infinite', move_duration = 'infinite', + cascading = False, prompt = True, throttle = True): + """(Un)protect a wiki title. Requires administrator status. + If the title is not exist, the protection only ec (aka edit/create) available If reason is None, asks for a reason. If prompt is True, asks the - user if he wants to protect the page. Valid values for edit and move + user if he wants to protect the page. Valid values for ec and move are: * '' (equivalent to 'none') * 'autoconfirmed' @@ -2799,12 +2801,16 @@ self.site().checkBlocks(sysop = True) address = self.site().protect_address(self.urlname()) + #if self.exists() and ec != move: # check protect level if edit/move not same + # if ec == 'sysop' and move != 'sysop': + # raise Error("The level configuration is not safe") + if unprotect: address = self.site().unprotect_address(self.urlname()) # unprotect_address is actually an alias for protect_address... - edit = move = '' + ec = move = '' else: - edit, move = edit.lower(), move.lower() + ec, move = ec.lower(), move.lower() if throttle: put_throttle() if reason is None: @@ -2826,30 +2832,47 @@ token = self.site().getToken(self, sysop = True) # Translate 'none' to '' - if edit == 'none': edit = '' + if ec == 'none': ec = '' if move == 'none': move = '' # Translate no duration to infinite - if duration == 'none' or duration is None: duration = 'infinite' + if ec_duration == 'none' or not ec_duration: ec_duration = 'infinite' + if move_duration == 'none' or not move_duration: move_duration = 'infinite' # Get cascading if cascading == False: cascading = '0' else: - if edit != 'sysop' or move != 'sysop': + if ec != 'sysop' or move != 'sysop' or not self.exists(): # You can't protect a page as autoconfirmed and cascading, prevent the error + # Cascade only available exists page, create prot. not. cascading = '0' output(u"NOTE: The page can't be protected with cascading and not also with only-sysop. Set cascading \"off\"") else: cascading = '1' - predata = { - 'mwProtect-cascade': cascading, - 'mwProtect-level-edit': edit, - 'mwProtect-level-move': move, - 'mwProtect-reason': reason, - 'mwProtect-expiry': duration, - } + predata = {} + if self.site().versionnumber >= 10: + predata['mwProtect-cascade'] = cascading + + predata['mwProtect-reason'] = reason + + if not self.exists(): #and self.site().versionnumber() >= : + #create protect + predata['mwProtect-level-create'] = ec + predata['wpProtectExpirySelection-create'] = ec_duration + else: + #edit/move Protect + predata['mwProtect-level-edit'] = ec + predata['mwProtect-level-move'] = move + + if self.site().versionnumber() >= 14: + predata['wpProtectExpirySelection-edit'] = ec_duration + predata['wpProtectExpirySelection-move'] = move_duration + else: + predata['mwProtect-expiry'] = ec_duration + + if token: predata['wpEditToken'] = token if self.site().hostname() in config.authenticate.keys(): @@ -2863,8 +2886,7 @@ data)) data = u'' else: - response, data = self.site().postForm(address, predata, - sysop=True) + response, data = self.site().postForm(address, predata, sysop=True) if response.status == 302 and not data: output(u'Changed protection level of page %s.' % self.aslink())
14 years, 8 months
1
0
0
0
← Newer
1
...
12
13
14
15
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Results per page:
10
25
50
100
200