Start Implementing of RedFamWorker

This commit is contained in:
2015-09-19 20:51:21 +02:00
parent dbcfe8f106
commit 6992f82f02

View File

@@ -398,7 +398,30 @@ class RedFamWorker( RedFam ):
Handles working with redundance families stored in database Handles working with redundance families stored in database
where discussion is finished where discussion is finished
""" """
pass def __init__( self, mysql_data ):
articlesList = []
for key in sorted( mysql_data.keys() ):
if 'article' in key and mysql_data[ key ]:
articlesList.append( mysql_data[ key ] )
super().__init__( articlesList, mysql_data[ 'beginning' ],
mysql_data[ 'ending' ], mysql_data[ 'red_page_id' ],
mysql_data[ 'status' ], mysql_data[ 'fam_hash' ],
mysql_data[ 'heading' ] )
@classmethod
def list_by_status( cls, status ):
"""
Lists red_fams stored in db by given status
"""
mysql = MysqlRedFam()
for fam in mysql.get_by_status( status ):
try:
print( cls( fam ) )
except RedFamHashError:
print(fam)
raise
class RedFamError( Exception ): class RedFamError( Exception ):