rename 'shown' to 'hidden'
This commit is contained in:
parent
de020c0cc5
commit
928dbcb16d
3 changed files with 7 additions and 5 deletions
|
|
@ -343,8 +343,10 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
|
|||
contact.status_msg = profile.get_status()
|
||||
contact.summary = profile.description
|
||||
for photo in profile.photos:
|
||||
contact.set_photo(photo['url'].split('/')[-1], url=photo['url'],
|
||||
thumbnail_url=photo['url'].replace('image', 'thumb1_'), shown=photo['shown'])
|
||||
contact.set_photo(photo['url'].split('/')[-1],
|
||||
url=photo['url'],
|
||||
thumbnail_url=photo['url'].replace('image', 'thumb1_'),
|
||||
hidden=photo['hidden'])
|
||||
contact.profile = []
|
||||
|
||||
stats = ProfileNode('stats', 'Stats', [], flags=ProfileNode.HEAD|ProfileNode.SECTION)
|
||||
|
|
|
|||
|
|
@ -273,14 +273,14 @@ class ProfilePage(PageBase):
|
|||
m = self.PHOTO_REGEXP.match(div.getAttribute('background'))
|
||||
if m:
|
||||
self.photos.append(dict(url=re.sub(u'thumb[0-2]_', u'image', div.getAttribute('background')),
|
||||
shown=True))
|
||||
hidden=False))
|
||||
photo_regex = re.compile('(?P<base_url>http://.+\.adopteunmec\.com/.+/)image(?P<id>.+)\.jpg')
|
||||
photo_max_id = max(int(photo_regex.match(photo['url']).groupdict()['id']) for photo in self.photos)
|
||||
base_url = photo_regex.match(self.photos[0]['url']).groupdict()['base_url']
|
||||
for id in xrange(1, photo_max_id + 1):
|
||||
url = '%simage%s.jpg' % (base_url, id)
|
||||
if not url in [photo['url'] for photo in self.photos]:
|
||||
self.photos.append(dict(url=url, shown=False))
|
||||
self.photos.append(dict(url=url, hidden=True))
|
||||
if div.hasAttribute('width') and str(div.getAttribute('width')) == '226':
|
||||
trs = div.getElementsByTagName('tr')
|
||||
for tr in trs:
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class ContactPhoto(CapBaseObject):
|
|||
self.add_field('data', str)
|
||||
self.add_field('thumbnail_url', basestring)
|
||||
self.add_field('thumbnail_data', basestring)
|
||||
self.add_field('shown', bool)
|
||||
self.add_field('hidden', bool, False)
|
||||
|
||||
def __iscomplete__(self):
|
||||
return (self.data and (not self.thumbnail_url or self.thumbnail_data))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue