def check_version(self, actions): records = actions.get_iugversion() if len(records) > 0 : dbdate = str_to_date(records[0]['version_date']) else: actions.add_iugversion({'version':'1.0', 'version_date':(datetime.now()- timedelta(10)).strftime('%Y-%m-%d')}) dbdate = self.initial_date current = datetime.date(datetime.now()) if (current - dbdate).days > 5: return False else: return True
def __init__(self): self.initial_date = str_to_date((datetime.now()- timedelta(10)).strftime('%Y-%m-%d'))