Add generator wrapper to fetch RedFams by status and ending

Related Task: [https://fs.golderweb.de/index.php?do=details&task_id=26 FS#26]
This commit is contained in:
2016-03-02 17:06:46 +01:00
parent ad088126e7
commit b271a0b0b1

View File

@@ -467,6 +467,19 @@ class RedFamWorker( RedFam ):
print(fam)
raise
@classmethod
def gen_by_status_and_ending( cls, status, ending ):
"""
Yield red_fams stored in db by given status which have an ending after
given one
"""
mysql = MysqlRedFam()
for fam in mysql.get_by_status_and_ending( status, ending ):
try:
yield cls( fam )
except RedFamHashError:
print(fam)
raise
class RedFamError( Exception ):
"""