mistercrunch commented on code in PR #34051:
URL: https://github.com/apache/superset/pull/34051#discussion_r2186033702
##########
superset/models/helpers.py:
##########
@@ -546,10 +546,28 @@ def changed_on_utc(self) -> str:
@property
def changed_on_humanized(self) -> str:
+ locale = str(get_locale() or 'en')
+ try:
+ humanize.i18n.activate(locale)
+ result = humanize.naturaltime(datetime.now() - self.changed_on)
+ humanize.i18n.deactivate()
+ return result
+ except:
Review Comment:
Are we expecting this to fail? In what cases? Not sure if swallowing
anything/everything is best here, often if we know something might fail we'd
try to swallow just that one particular exception, and maybe
`logging.exception(e)` to handle the rest of the pessimisticism, so it's
unexcpected, handled - but **logged** somewhere.
Otherwise you may just never know that say your particular locale isn't
handled by `humanize`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]