Bug fix for null title, #512

This commit is contained in:
Rhet Turnbull 2021-08-29 13:06:09 -07:00
parent 062d8eb206
commit 6bcc67634c
4 changed files with 12 additions and 4 deletions

View File

@ -1702,7 +1702,7 @@ Substitution Description
{lf} A line feed: '\n', alias for {newline}
{cr} A carriage return: '\r'
{crlf} a carriage return + line feed: '\r\n'
{osxphotos_version} The osxphotos version, e.g. '0.42.78'
{osxphotos_version} The osxphotos version, e.g. '0.42.79'
{osxphotos_cmd_line} The full command line used to run osxphotos
The following substitutions may result in multiple values. Thus if specified for
@ -3561,7 +3561,7 @@ The following template field substitutions are availabe for use the templating s
|{lf}|A line feed: '\n', alias for {newline}|
|{cr}|A carriage return: '\r'|
|{crlf}|a carriage return + line feed: '\r\n'|
|{osxphotos_version}|The osxphotos version, e.g. '0.42.78'|
|{osxphotos_version}|The osxphotos version, e.g. '0.42.79'|
|{osxphotos_cmd_line}|The full command line used to run osxphotos|
|{album}|Album(s) photo is contained in|
|{folder_album}|Folder path + album photo is contained in. e.g. 'Folder/Subfolder/Album' or just 'Album' if no enclosing folder|

View File

@ -1,3 +1,3 @@
""" version info """
__version__ = "0.42.78"
__version__ = "0.42.79"

View File

@ -564,7 +564,12 @@ class PhotoInfo:
@property
def title(self):
"""name / title of picture"""
return self._info["name"]
# if user sets then deletes title, Photos sets it to empty string in DB instead of NULL
# in this case, return None so result is the same as if title had never been set (which returns NULL)
# issue #512
title = self._info["name"]
title = None if title == "" else title
return title
@property
def uuid(self):

View File

@ -1004,6 +1004,9 @@ class PhotoTemplate:
elif self.dirname:
value = sanitize_dirname(value)
# ensure no empty strings in value (see #512)
value = None if value == "" else value
return [value]
def get_template_value_pathlib(self, field):