Fix bugs from moving variables

This commit is contained in:
voussoir 2016-12-16 19:08:34 -08:00
parent a1894edcca
commit 0160af57dd
2 changed files with 8 additions and 5 deletions

View file

@ -262,7 +262,7 @@ def _setify_tags(photodb, tags, warn_bad_tags=False):
try:
tag = photodb.get_tag(tag)
tagset.add(tag)
except NoSuchTag:
except exceptions.NoSuchTag:
if warn_bad_tags:
warnings.warn(constants.WARNING_NO_SUCH_TAG.format(tag=tag))
continue

View file

@ -1759,8 +1759,8 @@ class Photo(ObjectBase):
(new_width, new_height) = helpers.fit_into_bounds(
image_width=width,
image_height=height,
frame_width=self.config['thumbnail_width'],
frame_height=self.config['thumbnail_height'],
frame_width=self.photodb.config['thumbnail_width'],
frame_height=self.photodb.config['thumbnail_height'],
)
if new_width < width:
image = image.resize((new_width, new_height))
@ -1775,8 +1775,8 @@ class Photo(ObjectBase):
size = helpers.fit_into_bounds(
image_width=probe.video.video_width,
image_height=probe.video.video_height,
frame_width=self.config['thumbnail_width'],
frame_height=self.config['thumbnail_height'],
frame_width=self.photodb.config['thumbnail_width'],
frame_height=self.photodb.config['thumbnail_height'],
)
size = '%dx%d' % size
duration = probe.video.duration
@ -1997,6 +1997,9 @@ class Tag(ObjectBase, GroupableMixin):
self.group_getter = self.photodb.get_tag
self._cached_qualified_name = None
def __eq__(self, other):
return self.name == other or ObjectBase.__eq__(self, other)
def __hash__(self):
return hash(self.name)