Commit graph

413 commits

Author SHA1 Message Date
6add02c8a2 Move column extractor to own function. 2018-03-18 00:21:03 -07:00
4a39b527f3 Use dot_extension on the photo cards. 2018-03-18 00:19:30 -07:00
d383000441 Add Foreign Keys, Primary Keys, and NOT NULL constraints. 2018-03-18 00:09:08 -07:00
33d506ddaf Rearrange tables in preparation for foreign keys.
In order to create a foreign key the table has to already exist.
So move the object types to the top, with Users first since other
things have authors.
2018-03-17 17:54:15 -07:00
c4d0de7f97 Move digest_directory and easybake to Util mixin. 2018-03-17 17:19:07 -07:00
87886a0a13 Unprivatize PDB._load_config and _save_config. 2018-03-17 17:07:30 -07:00
941d50eae0 Move config saving to own method. 2018-03-17 17:05:34 -07:00
269cfb6762 Improve some variable names for clarity. 2018-03-17 16:48:09 -07:00
ffe0be21f5 Fix Photo thumbnail paths to be relative to the PDB's thumb dir.
Previously they were relative to the directory from which the client
was launched, meaning it usually started with ./_etiquette.
Now it should be more portable and less tight.
2018-03-13 02:50:54 -07:00
f3eb6345f7 Let database_upgrader use the photodb instead of raw sql con. 2018-03-13 02:28:09 -07:00
44d1fb2fff Add PhotoDB init option skip_version_check. 2018-03-13 02:25:04 -07:00
d85d911b22 Add PhotoDB init option create. Disable to require existing. 2018-03-13 02:24:11 -07:00
101f6d9c47 Add exception BadDataDirectory. 2018-03-13 02:21:35 -07:00
b89da5dec2 Add hasattr checks to prevent faulty __del__. 2018-03-13 02:20:17 -07:00
5b310e6d7c Require voussoirkit 0.0.22 for pathclass.Path.relative_to. 2018-03-13 01:48:06 -07:00
1cd78a678b Minor linter appeasements. 2018-03-11 01:54:59 -08:00
c99e783d04 Rename comprehension variable to not look like a conflict.
The existing code worked fine, but it was odd to see that `tag`
was both the loop variable as well as the key into the children.
So let's change it.
2018-03-11 01:35:35 -08:00
a86c27ceb4 Simplify some unnecessarily detailed log formats. 2018-03-11 01:34:32 -08:00
94e518068f Add Album.add_photos for batch adding with less savepoint waste.
Because each call to add_photo opens a savepoint, it is wasteful
to use it for a large number of photos that belong together.
2018-03-10 22:50:41 -08:00
8fcaf15fbe Remove the word "Album" from the h2. The number is okay.
I just decided I like this better.
2018-03-10 19:54:56 -08:00
df86d0f128 Replace "you are here" with the album's name. 2018-03-10 19:54:22 -08:00
45091c6596 Fix thumbnail height in CSS only, no html attr. Don't h-stretch. 2018-03-10 19:53:29 -08:00
f5a126d3bc Oops, fix missing return statement. 2018-03-10 15:42:23 -08:00
42cef093a5 digest_directory: Use _normalize functions for argument prep.
This is a pattern I want to try out.
Not sure if it's ugly yet.
2018-03-10 15:32:31 -08:00
633dbfa3cf Fix typo, searchhelpers.py is a file. 2018-03-10 14:42:33 -08:00
9355cd09ef Add digest_directory parameter new_photo_ratelimit.
Initially inspired by the nuisance of having multiple photos
with the same timestamp because the system is too fast, this
feature could also be used to lessen disk load for running in
the background.
2018-03-10 14:18:28 -08:00
f04e055ca3 On the tag page, put descr in a dark box like albums. 2018-03-10 13:40:02 -08:00
6de0ad8e36 Oops, add this.open fallback to the open binder. 2018-03-10 13:28:13 -08:00
c90585665a Add md and rst as text/plain mimetypes. 2018-03-10 13:27:21 -08:00
daf824caf5 Improve album page's use of data-editor-empty-text. 2018-03-10 13:24:23 -08:00
494d44aa03 Improve editor.js comments and usage of this.
I realized what I was doing wrong with `this`, so now the function
binder is much cleaner.
2018-03-10 13:23:37 -08:00
ae6df8f999 Remove searchhidden from to do list. 2018-03-09 17:52:52 -08:00
f9bee5716c Don't clear the clipboard after pasting into album.
Sometimes I want to do more operations.
2018-03-09 17:50:41 -08:00
a1919a7725 Support giving title when creating albums. Two-step prompt. 2018-03-09 17:38:40 -08:00
5f6d21fdee Give Photos a searchhidden property.
By default, photos with searchhidden do not appear in the search
results. This allows a small number of representative images from
a large album to appear in the results, while the rest can be
found on the album's page.

The same effect could be achieved with a tag and forbid search,
but tag searching has much higher cost and it would be more difficult
to implement as a default behavior without requiring lots of special
checks whenever listing tags etc.
2018-03-09 17:10:27 -08:00
d88db08693 Allow PDB.rollback to take a savepoint; Warn early commits.
If a @transaction method makes calls to other @transaction
methods, and one of those nested calls makes a commit, and then
the outer call raises an exception, then the outer call will
not rollback properly because its savepoint is no longer in
the savepoint stack. So let's warn the user if that happens.
Should this raise an exception instead of just warn? Not sure,
I mean the data is already committed.
2018-03-05 21:35:36 -08:00
26141f8198 Put savepoints in the on_commit_queue so we can cancel on rb. 2018-03-02 20:30:55 -08:00
faacf7b594 Oops, use response["data"]. 2018-02-26 19:06:27 -08:00
8b9ef2a492 Oops, add commit parameter to Photo.copy_tags. 2018-02-25 18:56:11 -08:00
4ae5f52db3 Add some missing decorators and explain others.
Leave comments in places where @transaction or @required_feature
might be expected, but are taken care of by something else.
2018-02-25 18:55:46 -08:00
3ff89c330f Remove obvious and unhelpful stuff from project structure. 2018-02-25 18:45:11 -08:00
3d925c1426 Rename inner wrapped to improve traceback clarity.
Because "line 77, in wrapped_transaction" is at least slightly
better than "in wrapped".
2018-02-25 17:15:35 -08:00
c001b0fc87 Use SQL savepoints to improve @transaction.
I didn't know about these! Now we don't have to roll all the way
back in case of problems. This allows for raising exceptions as
control flow since they won't undo unrelated stuff.
2018-02-25 17:10:04 -08:00
576fac416a Move SQL heavy lifting to its own Mixin. 2018-02-25 16:30:05 -08:00
e4e542a8a6 Replace manual DELETEs with calls to sql_delete. 2018-02-25 16:17:19 -08:00
a2e13003e8 Add PhotoDB.sql_delete. 2018-02-25 16:09:36 -08:00
f6cef5bcbf Require voussoirkit 0.0.21 for sqlhelpers.delete_filler. 2018-02-25 16:07:58 -08:00
f34164bf85 Add search feature has_thumbnails.
Search needs a complete refactor.
But until then, let's keep adding to it!
2018-02-24 23:06:25 -08:00
d653673277 Update truthystring to return bool, not given int. 2018-02-24 23:01:44 -08:00
5f7266c519 Add button to clear clipboard. 2018-02-24 23:00:28 -08:00