Commit e1856a35 authored by ntome's avatar ntome

python3: replace py2 dict.iter* to py3 equivalent in modules

parent 503b09ef
......@@ -45,7 +45,7 @@ class DailymotionModule(Module, CapVideo, CapCollection):
u'380': u'380p',
u'720': u'720p',
u'1080': u'1080p'
}.iteritems())])
}.items())])
format_choice = [u'm3u8', u'mp4']
......
......@@ -153,7 +153,7 @@ class HappnContact(Contact):
if 'fb' in info:
self.set_profile('info', 'facebook', info['fb']['link'])
self.set_profile('facebook', 'likes', 'interests', ', '.join(info['fb']['likes']))
for name, content in info['fb']['infos'].iteritems():
for name, content in info['fb']['infos'].items():
self.set_profile('facebook', 'infos', name, content)
if info.get('twitter_id') is not None:
self.set_profile('info', 'twitter', info['twitter_id'])
......
......@@ -36,7 +36,7 @@ class Author(object):
(UNKNOWN,
MALE,
FEMALE,
TRANSEXUAL) = xrange(4)
TRANSEXUAL) = range(4)
def __init__(self, name=None):
self.name = name
......
......@@ -32,7 +32,7 @@ class LaCentraleBrowser(PagesBrowser):
advert_page = URL('/auto-occasion-annonce-(?P<_id>.*).html', AdvertPage)
def iter_prices(self, product):
_request = '&'.join(['%s=%s' % (key, item) for key, item in product._criteria.iteritems()])
_request = '&'.join(['%s=%s' % (key, item) for key, item in product._criteria.items()])
return self.list_page.go(_request=_request).iter_prices()
def get_price(self, _id, obj):
......
......@@ -229,7 +229,7 @@ class OkCModule(Module, CapMessages, CapContact, CapMessagesPost, CapDating):
if 'profile' in fields:
contact = self.get_contact(contact)
if contact and 'photos' in fields:
for name, photo in contact.photos.iteritems():
for name, photo in contact.photos.items():
if photo.url and not photo.data:
data = self.browser.open(photo.url).content
contact.set_photo(name, data=data)
......
......@@ -142,7 +142,7 @@ class Paypal(LoginBrowser):
'endDate': e,
}
# The response is sometimes not the one we expect.
for i in xrange(3):
for i in range(3):
try:
self.location(
'https://www.paypal.com/myaccount/activity/filter?%s',
......
......@@ -151,7 +151,7 @@ class PhpBB(LoginBrowser):
if topic_id == 0:
if not forum_id:
forums = self.get_forums()
forums_prompt = 'Forums list:\n%s' % ('\n'.join(['\t- %s' % f for f in forums.itervalues()]))
forums_prompt = 'Forums list:\n%s' % ('\n'.join(['\t- %s' % f for f in forums.values()]))
m = re.match('\[(.*)\] (.*)', title or '')
if not m:
raise CantSendMessage('Please enter a title formatted like that:\n\t"[FORUM] SUBJECT"\n\n%s' % forums_prompt)
......
......@@ -251,7 +251,7 @@ class RadioFranceModule(Module, CapRadio, CapCollection, CapAudio):
yield Collection([split_path[0], u'podcasts'], u'Podcast')
elif len(split_path) == 2 and split_path[1] == 'selection':
for _id, item in sorted(self._RADIOS.iteritems()):
for _id, item in sorted(self._RADIOS.items()):
if _id == split_path[0]:
if 'selection' in self._RADIOS[_id]:
selection_url = self._RADIOS[_id]['selection']
......@@ -376,7 +376,7 @@ class RadioFranceModule(Module, CapRadio, CapCollection, CapAudio):
return item
def iter_radios_search(self, pattern):
for key, radio in self._RADIOS.iteritems():
for key, radio in self._RADIOS.items():
if pattern.lower() in radio['title'].lower() or pattern.lower() in key.lower():
yield self.get_radio(key)
......
......@@ -61,7 +61,7 @@ class RadioFranceTest(BackendTest):
self.assertTrue(len(l_sel[0].url) > 0)
def test_podcasts(self):
for key, item in self.backend._RADIOS.iteritems():
for key, item in self.backend._RADIOS.items():
if 'podcast' in item:
emissions = list(self.backend.iter_resources(objs=[BaseAudio], split_path=[key, 'podcasts']))
self.assertTrue(len(emissions) > 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment