-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce new DB type: DelimeteredString
- Loading branch information
1 parent
e201dd4
commit bc21caa
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for context this is the version i'm using now:
i think 'delimited string' is the correct term here
the rest of the code doesn't seem to use many abbreviations, so calling the property
delimiter
seems appropriatei don't think a default value for the delimiter makes a lot of sense?
the list comprehension and string conversions in
to_sql
don't seem necessary to me, see above. did you run into trouble without them?the
from_sql
seems to just be missing functionality from theType
parent and seems completely unnecessaryparse
shouldn't be able to fail because at that point, we've ensured that its argument is actually a string.i also added a
if not string
condition because otherwise the empty list of album types would turn into the list containing the empty string (because that's what split returns)if we don't define a
format
method here we print the internal python representation of the values (i.e.['album', 'live']
or somesuch) in thebeet write
output.joining on the delimiter nicely formats the output :)
just so i don't ping you twice unnecessarily, i think it's better to instantiate this type with
'; '
(semicolon space) as the delimiter, because that's what was used before to join the albumtypes and what we'll find in the database