Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_date(data):
"""Add tzinfo"""
res = _get_date(data)
# assuming UTC by default
if res.tzinfo is None:
res = pytz.utc.localize(res)
return res
def get_date_modified(self, page, default):
if hasattr(page, 'modified'):
if isinstance(page.modified, datetime):
return page.modified
return get_date(page.modified)
else:
return default