Yep. It will just be a PITA to change every single template to add that
It could just have been the âerrorâ return value by default.
Forcing to code a nonsensical default value is ⌠nonsensical
Yep. It will just be a PITA to change every single template to add that
It could just have been the âerrorâ return value by default.
Forcing to code a nonsensical default value is ⌠nonsensical
Funny thought: shouldnât there be a default default
value?
âEnsure you supply a default value because thereâs none by default.â
Weâll see how many need to be updated. Iâm going to update tonight. TBH I doubt it will change much other than a bunch of warnings in the logs. IMO, warnings donât bother me. I just ignore them unless they are bad.
WellâŚ
I can already picture the forum filled with âMy template stopped workingâ
yah but that means it will return ââ, i.e. unavailable.
Not sure. That sounds more like âexceptionâ â âerrorâ to me âŚ
It depends whether theyâll check if there is a default, or just fail if the rendering fails, which is very fine by me
Effectively, theyâre removing the existing fixed default (which can be as lame as just reporting the original value, but itâs still something) and now allowing the user to supply their own default ⌠except they must supply it because thereâs no longer a default default.
Yes, come December, there may be a lot of âbusy workâ for everyone who hasnât yet supplied default values.
they no longer regex templates, so I would assume itâs the latter. The only issue would be if they destroy the listener when this occurs.
That one is very, very lame, imho, as you cannot test itâŚ
Well you can, just check the output against the input. Thatâs what I always do in python
Indeed⌠Wonât work with timestamp_local(default=now()) == now()
, though, so that one is not an option.
Probably, timestamp_local(default=0) == 0
will be the easiest.
Can you explain why the first test, using now()
, not work but the second one will? Is it because there might be a few microseconds of difference between the two instances of now()
?
Yes. now()
will be evaluated at the time of invocation, then a second time at the time of comparison.
Thatâs theoretical, though. It might work, but isnât safe anyway.
It would work if you set a variable as now
Ofc, but that starts to be a whole lot of coding and resources for a bloody useless default
Iâm trying to figure out what problem they are trying to solve with forcing users to add defaults to all the filters all of a sudden?
Templates have worked fine forever (of course there may be some edge cases - there is for everything) so why make everyone go thru the trouble now to add this to every filter template?
Whatâs the purpose?
You should watch the release party sometime. Youâll get a firsthand peak into the reasoning being things, including this.
FWIW, I just helped someone who didnât understand why they are now getting a warning for this:
'00:00' | timestamp_custom('%H:%S', False)
We both know thatâs invalid. In previous versions, the function wasnât getting what it needed so it quietly did nothing and passed along the string. Now it warns the user that this isnât valid (it needs a timestamp, not a string) and, unless a default value is supplied, the December release will flag this as an error.
Unfortunately, the user didnât understand the warning message and was confused by its presence because the template âworked beforeâ. In this case, âworkedâ was by pure chance because the input was already in the desired output format (the timestamp_custom
function isnât even needed here)
Thatâs good, no question about it. But what will happen now is that users will just blindly paste some snippet with a default and forget about it.
The warning is gone, but the issue is still there, which basically solves nothing.
Also, the (currently) warning is pushed at each scan_interval.
Thatâs a pretty good incentive to fix those asap