def cms_post_age(row):
 if hasattr(row, 'cms_post'):
  row = row.cms_post
 try:
  date = row.date
 except:
  return messages['NONE']
 now = request.utcnow
 age = (now - date)
 if (age < timedelta(days=2)):
  return 1
 elif (age < timedelta(days=7)):
  return 2
 else:
  return 3

def cms_post_age ( row ) : if hasattr ( row , 'cms_post' ) : row = row . cms_post try : date = row . date except : return messages [ 'NONE' ] now = request . utcnow age = ( now - date ) if ( age < timedelta ( days = 2 ) ) : return 1 elif ( age < timedelta ( days = 7 ) ) : return 2 else : return 3
the age of the post - used for colour-coding markers of alerts & incidents .