Beispiel #1
0
 def setup():
     if not MasterTable.table_exists():
         print("Master table does not exists!")
         return
     if not MasterHelper.has_keys():
         print("First start...")
         key = MasterHelper.create()
         print("Your key: \"" + str(key) + "\"")
Beispiel #2
0
 def is_master_mode():
     if not Master.table_exists():
         print("Master table does not exists!")
         return True
     master_mode = False
     with Master.atomic() as txn:
         now = datetime.utcnow()
         keys = Master.select().where(Master.revoked == False)
         for key in keys:
             if key.revoke_date and key.revoke_date < now:
                 key.revoked = True
                 key.revoke_date = datetime.utcnow()
                 key.save()
             else:
                 master_mode = True
     return master_mode
Beispiel #3
0
 def table_exists():
     return Master.table_exists()
Beispiel #4
0
 def is_master_mode():
     if not MasterTable.table_exists():
         print("Master table does not exists!")
         return True
     return MasterHelper.is_master_mode()