Fix media display for no media_data row in sql.
If there is no media_data row for the current media (for whatever reason, there might be good ones), let MediaEntry.media_data not raise an exception but just return None. The exif display part now handles this by checking whether .media_data.exif is defined (None has no attribute exif, so it's undefined, all fine).
This commit is contained in:
parent
007ac2e720
commit
729424befd
@ -176,7 +176,7 @@ class MediaEntry(Base, MediaEntryMixin):
|
||||
session = Session()
|
||||
|
||||
return session.query(self.media_data_table).filter_by(
|
||||
media_entry=self.id).one()
|
||||
media_entry=self.id).first()
|
||||
|
||||
def media_data_init(self, **kwargs):
|
||||
"""
|
||||
|
@ -17,8 +17,8 @@
|
||||
#}
|
||||
|
||||
{% block exif_content %}
|
||||
{% if media.media_data.has_key('exif')
|
||||
and app_config['exif_visible']
|
||||
{% if app_config['exif_visible']
|
||||
and media.media_data.exif is defined
|
||||
and media.media_data.exif.has_key('useful') %}
|
||||
<h3 class="sidedata">EXIF</h3>
|
||||
<table>
|
||||
|
Loading…
x
Reference in New Issue
Block a user