Commit graph

1100 commits

Author SHA1 Message Date
f8bd34eb7a Let add_searchtag and remove_searchtag take the ul instead of box.
With a name like add_searchtag you'd think it'd be past the point
of reading box input, and deeper into the abstraction zone. But nope,
it wasn't. I'll try to take this a few steps further from here too.
2020-04-02 17:04:23 -07:00
3cb8f0adcf Remove code intended for tag trumping but currently useless.
I think at one point I was using full qualnames on the tag objects
in the mmf uls. But now they just show their base name, so this
code is useless. And I don't think I'll reinstate it because tags
have multiple parents now and I don't want to implement all the
lineage checking in the client js. We'll just let the server handle
the slightly less efficient query.
2020-04-02 16:56:44 -07:00
00ad82e07c Dedent this code by doing an early return instead of if. 2020-04-02 16:25:19 -07:00
faf0c62426 Check if limit is falsey to avoid useless prevnext buttons.
If limit is 0 then you get prev and next links which also have
limit 0 and are pointless to click.
2020-03-28 17:38:10 -07:00
a00fb65758 Don't leave falsey values out of dict_to_params, let caller do it.
Explicit is better than implicit and all that.
2020-03-28 17:37:28 -07:00
0fdf08adf5 Fix bug where searching musts=[A, A.B] ignored B.
The problem was that during the expansion of A, B would get added to
the `total` set. And then because B was already in total, it would
bail early instead of expanding, but that meant it got left out of
the final query. But this only happened sometimes since random set
ordering would sometimes expand B before A and everything was ok.
I think the best solution is to do this first pass that eliminates
ancestors. Furthermore, I realized that the entirety of expand_nested
hinged on this flawed logic and was otherwise completely redundant
for a simple list comprehension.
2020-03-19 19:04:09 -07:00
13c3a1c0e9 Update docstrings for walk_children, walk_parents. 2020-03-19 19:03:47 -07:00
0a8a754cbc Replace set([]) with {}. 2020-03-19 17:40:52 -07:00
a30649b0a8 Replace looping set.add with set.update. 2020-03-19 17:38:51 -07:00
e35efb5c61 Make this string an r-string so it gets better syntax highlighting. 2020-03-11 18:11:54 -07:00
6529aedde6 Add docstring to PDB.__init__. 2020-03-06 09:43:16 -08:00
9ac91d3850 Add tag delete button to specific tag page.
On the main tag listing, for child tags, you only get an unlink
button on hover. So if you want to delete a child tag you'd have to
unlink, then refresh, then delete. Now you can just go to its page
and delete it there.
2020-02-27 14:57:27 -08:00
3f2cde02e1 Use send2trash to support recycle_instead_of_delete. 2020-02-27 14:18:46 -08:00
961ece0081 digest_directory excludes extend defaults instead of overriding them.
With this change, there is currently no way to specify that I actually
want to include thumbs.db etc, but I think the likelikhood of wanting
to extend the defaults greatly exceeds wanting to overrid them.
2020-02-27 14:17:30 -08:00
30a0715980 Add photo delete buttons to hovering toolbox.
I tried putting them in the #left but it was looking seriously ugly.
Actually #left is always ugly because the variety of info and buttons
and text alignments. Hover toolbox is not ideal and I don't want it
to become a dumping ground, but deleting should be a rare action and I
don't want it right next to stuff like the basic metadata.
2020-02-27 14:15:13 -08:00
45cb96cc5c Add endpoint /photo/photo_id/delete. 2020-02-26 18:57:29 -08:00
a88fcc2092 Move the clipboard checkbox into metadata list too. 2020-02-26 18:41:17 -08:00
66f73a6aab Move the photo filename out of list to top of left. 2020-02-26 18:40:03 -08:00
596eb86f6e Move the refresh metadata button into metadata bullet list. 2020-02-26 18:39:19 -08:00
02db1f3971 Make response_type required, explicit in all calls. 2020-02-26 17:50:36 -08:00
9d620b4b97 Remove unused imports & other small things. 2020-02-20 22:44:56 -08:00
b846be75b0 Stop pretending that there are tests. 2020-02-20 21:51:06 -08:00
ca8c642add Add "Are you sure you want to quit" to erepl. 2020-02-20 18:57:08 -08:00
4a193d228c Add commit=True to frontend where necessary. 2020-02-20 00:34:28 -08:00
854fa4db51 Rename PDB.register_user -> new_user.
I was treating User a little bit special here, but I prefer to
have the more consistent terminology.
2020-02-20 00:18:40 -08:00
1fc2ed09f5 Remove commit argument from ALL methods. @transaction does it. 2020-02-19 23:56:09 -08:00
0a984117c5 Add rollback queue, like commit queue. 2020-02-19 23:46:30 -08:00
8c854f3b6a Improve this comment about Photo rename logic. 2020-02-19 23:22:08 -08:00
f99d3d03d9 Photo.rename new_path.assert_not_exists. 2020-02-19 23:12:29 -08:00
00a443eec3 Always use the commit queue, don't bypass with commit=True. 2020-02-19 23:12:11 -08:00
7f3602d673 Remove @transaction from mixin methods, apply it to object methods. 2020-02-19 23:10:49 -08:00
953a85c998 Delete method Tag.leave_group, leftover from 1-parent days. 2020-02-19 23:05:55 -08:00
8c797024e0 Remove calls to pdb.commit(). Let @transaction do it. 2020-02-19 22:58:21 -08:00
203fb9e00f @transaction intercept commit argument; commit / release here. 2020-02-19 22:36:00 -08:00
04f3f6f297 Remove commit=False from all method calls, it's default now. 2020-02-19 22:20:21 -08:00
3a9d7fc2dc Set default commit=False for ALL methods.
I'm working on tightening up some of the transaction code. In the
past it was default commit=True because I would launch the repl, do
something, and quit, so it was nice to have auto commit. But really
it makes more sense to have it default False and be explicit when
to commit.
2020-02-19 20:08:24 -08:00
108ba8bd95 Add PDB.release_savepoint. 2020-02-19 17:00:08 -08:00
bcd13b9ae4 Make the commit queue task popping a little more clear. 2020-02-19 16:26:23 -08:00
e7c90faf79 PhotoDB.rollback without savepoint should roll all, like real sql.
In sqlite3, rollback without a savepoint undoes the entire pending
transaction stack, whereas I was just popping the last save.
This change makes it match real sqlite. Also the only current call
for rollback is in the @transaction decorator which is already
explicit.
2020-02-19 16:26:02 -08:00
9e0051ca9c Photo.move_file assert new path doesn't exist yet. 2020-02-19 16:23:31 -08:00
1375d9fb26 Fix new_photo, data[extension] to use new pathclass.Extension. 2020-02-19 15:11:52 -08:00
5da8d793d6 Return this None instead of assigning then returning. 2020-02-19 14:06:53 -08:00
e25c6e8697 Use code.interact instead of py -i. 2020-02-19 13:15:03 -08:00
31517a41d2 Add missing period on exception message. 2020-02-19 13:11:57 -08:00
851ab2d4cc main should return the args.func(args) value. 2020-02-08 17:24:57 -08:00
92f3569971 Use of extract_table_column_map has moved to sqlhelpers. 2020-02-07 15:15:49 -08:00
b88d577ddd Use voussoirkit.imagetools for fit_into_bounds function. 2020-02-04 19:35:46 -08:00
25ed427272 Wrap DB_INIT in a transaction. 2020-02-04 18:43:30 -08:00
d6d7521bce Assert table exists for any sql op involving argument tables.
At the moment, all of these functions are safe because they're
called with hardcoded tables determined by other code, not user input.
But while I was working in this area I felt it would be good to add
a safety check just in case.
2020-02-04 18:15:14 -08:00
64f9eb5f2b Replace some % formatting with fstrings. 2020-02-04 18:12:41 -08:00