Make markpages using new DB/Class structure
Update markpages and RedFamWorker-Code to use the new sqlalchemy based DB ORM Interface
This commit is contained in:
@@ -87,6 +87,9 @@ class MarkPagesBot( CurrentPageBot ): # sets 'current_page' on each treat()
|
|||||||
for redfam in self.redfams:
|
for redfam in self.redfams:
|
||||||
redfam.update_status()
|
redfam.update_status()
|
||||||
|
|
||||||
|
RedFamWorker.flush_db_cache()
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def redfams(self):
|
def redfams(self):
|
||||||
"""
|
"""
|
||||||
@@ -168,7 +171,7 @@ class MarkPagesBot( CurrentPageBot ): # sets 'current_page' on each treat()
|
|||||||
save_ret = self.put_current( self.new_text, summary=summary )
|
save_ret = self.put_current( self.new_text, summary=summary )
|
||||||
|
|
||||||
# Status
|
# Status
|
||||||
if add_ret is None or add_ret and save_ret:
|
if add_ret is None or ( add_ret and save_ret ):
|
||||||
self.current_page.redfam.article_add_status(
|
self.current_page.redfam.article_add_status(
|
||||||
"marked",
|
"marked",
|
||||||
title=self.current_page.title(withNamespace=False))
|
title=self.current_page.title(withNamespace=False))
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ class RedFam( MysqlRedFam ):
|
|||||||
", red_page_id=" + repr( self.redpageid ) + \
|
", red_page_id=" + repr( self.redpageid ) + \
|
||||||
", status=" + repr( self.status ) + \
|
", status=" + repr( self.status ) + \
|
||||||
", fam_hash=" + repr( self.famhash ) + \
|
", fam_hash=" + repr( self.famhash ) + \
|
||||||
|
", articlesStatus=" + repr( self.articlesStatus ) + \
|
||||||
" )"
|
" )"
|
||||||
|
|
||||||
return __repr
|
return __repr
|
||||||
@@ -456,38 +457,10 @@ 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
|
||||||
"""
|
"""
|
||||||
def __init__( self, mysql_data ):
|
def __init__( self ):
|
||||||
|
|
||||||
#~ articlesList = []
|
|
||||||
|
|
||||||
#~ for key in sorted( mysql_data.keys() ):
|
|
||||||
#~ if 'article' in key and 'status' not in key and mysql_data[ key ]:
|
|
||||||
#~ articlesList.append( mysql_data[ key ] )
|
|
||||||
|
|
||||||
#~ # Preset article status list with empty sets for existing articles
|
|
||||||
#~ self._article_status = [set() for x in range(0, len(articlesList))]
|
|
||||||
|
|
||||||
#~ super().__init__( articlesList, mysql_data[ 'beginning' ],
|
|
||||||
#~ mysql_data[ 'ending' ], mysql_data[ 'redpageid' ],
|
|
||||||
#~ mysql_data[ 'status' ], mysql_data[ 'famhash' ],
|
|
||||||
#~ mysql_data[ 'heading' ] )
|
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
# #~ self._mysql.data = mysql_data
|
|
||||||
|
|
||||||
#~ # Set up article status
|
|
||||||
#~ index = 0
|
|
||||||
#~ for article in self.articlesList:
|
|
||||||
#~ raw_status = mysql_data[ "article" + str(index) + "_status" ]
|
|
||||||
#~ if not raw_status:
|
|
||||||
#~ raw_status = str()
|
|
||||||
#~ self._article_parse_status( raw_status, index )
|
|
||||||
#~ index += 1
|
|
||||||
|
|
||||||
# Get related RedPage-Information
|
|
||||||
self.redpageid = mysql_data[ 'pageid' ]
|
|
||||||
self.redpagetitle = mysql_data[ 'pagetitle' ]
|
|
||||||
|
|
||||||
# Make sure locale is set to 'de_DE.UTF-8' to prevent problems
|
# Make sure locale is set to 'de_DE.UTF-8' to prevent problems
|
||||||
# with wrong month abreviations in strptime
|
# with wrong month abreviations in strptime
|
||||||
locale.setlocale(locale.LC_ALL, 'de_DE.UTF-8')
|
locale.setlocale(locale.LC_ALL, 'de_DE.UTF-8')
|
||||||
|
|||||||
Reference in New Issue
Block a user