Minor fixes & pylint appeasements.
This commit is contained in:
parent
e5a316ff9c
commit
1c1e7f158f
11 changed files with 44 additions and 16 deletions
|
@ -1,3 +1,7 @@
|
|||
'''
|
||||
This file provides data and objects that do not change throughout the runtime.
|
||||
'''
|
||||
|
||||
import converter
|
||||
import logging
|
||||
import string
|
||||
|
|
|
@ -35,6 +35,7 @@ class EtiquetteException(Exception, metaclass=ErrorTypeAdder):
|
|||
'''
|
||||
error_message = ''
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__()
|
||||
self.given_args = args
|
||||
self.given_kwargs = kwargs
|
||||
self.error_message = self.error_message.format(*args, **kwargs)
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
'''
|
||||
This file provides functions which are used in various places throughout the
|
||||
codebase but don't deserve to be methods of any class.
|
||||
'''
|
||||
|
||||
import datetime
|
||||
import math
|
||||
import mimetypes
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import json
|
||||
|
||||
'''
|
||||
This file provides functions that convert the Etiquette objects into
|
||||
dictionaries suitable for JSON serializing.
|
||||
'''
|
||||
|
||||
def album(a, minimal=False):
|
||||
j = {
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
'''
|
||||
This file provides the data objects that should not be instantiated directly,
|
||||
but are returned by the PDB accesses.
|
||||
'''
|
||||
|
||||
import os
|
||||
import PIL.Image
|
||||
import traceback
|
||||
|
@ -623,7 +628,7 @@ class Photo(ObjectBase):
|
|||
'id': self.id,
|
||||
'tagged_at': helpers.now(),
|
||||
}
|
||||
self.photodb.sql_update(table='photos', data=data, where_key='id', commit=False)
|
||||
self.photodb.sql_update(table='photos', pairs=data, where_key='id', commit=False)
|
||||
|
||||
if commit:
|
||||
self.photodb.log.debug('Committing - add photo tag')
|
||||
|
@ -859,7 +864,7 @@ class Photo(ObjectBase):
|
|||
self.duration = probe.format.duration or probe.video.duration
|
||||
self.width = probe.video.video_width
|
||||
self.height = probe.video.video_height
|
||||
except:
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
|
||||
elif self.simple_mimetype == 'audio' and constants.ffmpeg:
|
||||
|
@ -867,7 +872,7 @@ class Photo(ObjectBase):
|
|||
probe = constants.ffmpeg.probe(self.real_filepath)
|
||||
if probe and probe.audio:
|
||||
self.duration = probe.audio.duration
|
||||
except:
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
|
||||
if self.width and self.height:
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
'''
|
||||
This function provides helper functions used to normalize the arguments that
|
||||
go into search queries. Mainly converting the strings given by the user
|
||||
into proper data types.
|
||||
'''
|
||||
|
||||
from . import constants
|
||||
from . import exceptions
|
||||
from . import helpers
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
'''
|
||||
This file provides a variety of functions for exporting a PDB's tags into other
|
||||
formats. Strings, dicts, etc.
|
||||
'''
|
||||
|
||||
def easybake(tags):
|
||||
'''
|
||||
A string where every line is the qualified name of a tag or its synonyms.
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
<a href="{{bookmark.url}}"
|
||||
class="bookmark_title"
|
||||
data-editor-id="title"
|
||||
data-editor-placeholer="title"
|
||||
data-editor-placeholder="title"
|
||||
data-editor-empty-text="{{bookmark.id}}">
|
||||
{%- if bookmark.title -%}
|
||||
{{bookmark.title}}
|
||||
|
|
|
@ -311,7 +311,7 @@ function refresh_metadata(photoid)
|
|||
{
|
||||
var url= "/photo/" + photoid + "/refresh_metadata";
|
||||
var data = new FormData();
|
||||
callback = function(){location.reload();};
|
||||
var callback = function(){location.reload();};
|
||||
post(url, data, callback);
|
||||
}
|
||||
|
||||
|
|
|
@ -162,8 +162,8 @@ form
|
|||
{% if search_kwargs[key] %}
|
||||
{% for tagname in search_kwargs[key] %}
|
||||
<li class="search_builder_{{tagtype}}_inputted">
|
||||
<span class="tag_object">{{tagname}}</span><!--
|
||||
--><button class="remove_tag_button red_button"
|
||||
<span class="tag_object">{{tagname}}</span>{{-''-}}
|
||||
<button class="remove_tag_button red_button"
|
||||
onclick="remove_searchtag(this, '{{tagname}}', inputted_{{tagtype}});"></button>
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
@ -252,11 +252,11 @@ form
|
|||
{% do limit_options.sort() %}
|
||||
{% endif %}
|
||||
{% for limit_option in limit_options %}
|
||||
<option
|
||||
value="{{limit_option}}"
|
||||
{{"selected" if search_kwargs['limit'] == limit_option else ""}}
|
||||
<option{{-' '-}}
|
||||
value="{{limit_option}}"{{-''-}}
|
||||
{{-" selected" if search_kwargs['limit'] == limit_option else ""-}}
|
||||
>
|
||||
{{limit_option}} items
|
||||
{{- limit_option }} items{{-''-}}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
@ -275,14 +275,14 @@ form
|
|||
<span>Tags on this page (click to join query):</span>
|
||||
<ul>
|
||||
{% for tag in total_tags %}
|
||||
<li>{{tag_object.tag_object(
|
||||
<li>{{-tag_object.tag_object(
|
||||
tag,
|
||||
extra_classes="tags_on_this_page",
|
||||
link='void',
|
||||
qualified_name=False,
|
||||
with_alt_qualified_name=True,
|
||||
with_alt_description=True,
|
||||
)}}</li>
|
||||
)-}}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
|
||||
{{' '}}class="tag_object {{extra_classes}}"
|
||||
|
||||
{% set altlines=[] %}
|
||||
{%- set altlines=[] -%}
|
||||
{% if with_alt_qualified_name %}{% do altlines.append(tag.qualified_name()) %}{% endif %}
|
||||
{% if with_alt_description and tag.description != "" %}{% do altlines.append(tag.description) %}{% endif %}
|
||||
{% set altlines=altlines|join("\n") %}
|
||||
|
|
Loading…
Reference in a new issue