@classmethod
def get_all_latest(cls):
fbsync = FindbadNodeRecordSync.get_by(hostname="global")
- return cls.query.filter_by(round=fbsync.round)
+ if fbsync:
+ return cls.query.filter_by(round=fbsync.round)
+ else:
+ return []
@classmethod
def get_latest_by(cls, **kwargs):
@classmethod
def get_all_latest(cls):
fbsync = FindbadPCURecordSync.get_by(plc_pcuid=0)
- print "round: ", fbsync.round
- return cls.query.filter_by(round=fbsync.round)
+ if fbsync:
+ return cls.query.filter_by(round=fbsync.round)
+ else:
+ return []
@classmethod
def get_latest_by(cls, **kwargs):