Minor improvements, update to-do list.

This commit is contained in:
voussoir 2017-04-20 18:31:48 -07:00
parent e3610eef2b
commit d95eac4bb6
4 changed files with 14 additions and 1 deletions

View file

@ -20,6 +20,8 @@ Documentation is still a work in progress. In general, I use:
- Debate whether the `UserMixin.login` method should accept usernames or I should standardize the usage of IDs only internally.
- Album size is calculated every time you refresh the page. For large albums this is very slow. Consider caching? Or saving to db?
- Organize the tag exporter functions better.
- Replace columns like area, ratio, bitrate by using [expression indices](https://sqlite.org/expridx.html) — `width * height` etc.
- Add some way to support large image albums without flooding the search results. Considering a "hidden" property so that a handful of representative images can appear in the search results, and the rest can be found on the actual Album page.
### Changelog

View file

@ -1,6 +1,9 @@
import re
def pascal_to_loudsnakes(text):
'''
NoSuchPhoto -> NO_SUCH_PHOTO
'''
match = re.findall('[A-Z][a-z]*', text)
text = '_'.join(match)
text = text.upper()

View file

@ -225,6 +225,10 @@ def post_login():
username = request.form['username']
password = request.form['password']
try:
# Consideration: Should the server hash the password to discourage
# information (user exists) leak via response time?
# Currently I think not, because they can check if the account
# page 404s anyway.
user = P.get_user(username=username)
user = P.login(user.id, password)
except (exceptions.NoSuchUser, exceptions.WrongLogin):

View file

@ -148,7 +148,11 @@
{% set tags = photo.sorted_tags() %}
{% for tag in tags %}
<li>
<a class="tag_object" href="/search?tag_musts={{tag.name}}">{{tag.qualified_name()}}</a><!--
{% set display_name=tag.qualified_name() %}
{% if display_name|length > 30 %}
{% set display_name = '...' + display_name[-27:] %}
{% endif %}
<a class="tag_object" href="/search?tag_musts={{tag.name}}">{{display_name}}</a><!--
--><button
class="remove_tag_button"
onclick="remove_photo_tag('{{photo.id}}', '{{tag.name}}', receive_callback);">