Start Implementing of RedFamWorker
This commit is contained in:
25
redfam.py
25
redfam.py
@@ -398,8 +398,31 @@ class RedFamWorker( RedFam ):
|
||||
Handles working with redundance families stored in database
|
||||
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 ):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user