mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-19 21:03:21 -07:00
Add len function to notification expressions
This commit is contained in:
parent
9ca5d81b60
commit
dff9a56950
3 changed files with 9 additions and 0 deletions
|
@ -537,6 +537,13 @@ def helper_divmod(a, b):
|
|||
return 0
|
||||
|
||||
|
||||
def helper_len(s):
|
||||
try:
|
||||
return len(s)
|
||||
except (ValueError, TypeError):
|
||||
return 0
|
||||
|
||||
|
||||
def helper_round(n, ndigits=None):
|
||||
try:
|
||||
return round(n, ndigits)
|
||||
|
|
|
@ -1825,6 +1825,7 @@ def str_eval(field_name, kwargs):
|
|||
'divmod': helpers.helper_divmod,
|
||||
'float': helpers.cast_to_float,
|
||||
'int': helpers.cast_to_int,
|
||||
'len': helpers.helper_len,
|
||||
'round': helpers.helper_round,
|
||||
'str': str
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue