We need to save the red_fam section heading in database for generating section links since format is not consistent
This commit is contained in:
14
mysql_red.py
14
mysql_red.py
@@ -150,17 +150,17 @@ class MYSQL_RED_FAM( MYSQL_RED ):
|
||||
else:
|
||||
return False
|
||||
|
||||
def add_fam( self, articlesList, red_page_id, beginning, ending=None, status=0 ):
|
||||
def add_fam( self, articlesList, heading, red_page_id, beginning, ending=None, status=0 ):
|
||||
|
||||
cursor = type( self ).connection.cursor()
|
||||
|
||||
query = 'INSERT INTO `red_families` ( fam_hash, red_page_id, beginning, ending, status, article0, article1, article2, article3, article4, article5, article6, article7 ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? );'
|
||||
data = [ str( self.__fam_hash ), red_page_id, beginning, ending, status ]
|
||||
query = 'INSERT INTO `red_families` ( fam_hash, red_page_id, beginning, ending, status, heading, article0, article1, article2, article3, article4, article5, article6, article7 ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? );'
|
||||
data = [ str( self.__fam_hash ), red_page_id, beginning, ending, status, heading ]
|
||||
|
||||
for article in articlesList:
|
||||
data.append( str( article ) )
|
||||
|
||||
while len( data ) < 13:
|
||||
while len( data ) < 14:
|
||||
data.append( None )
|
||||
|
||||
data = tuple( data )
|
||||
@@ -171,7 +171,7 @@ class MYSQL_RED_FAM( MYSQL_RED ):
|
||||
|
||||
self.data = self.get_fam()
|
||||
|
||||
def update_fam( self, red_page_id, beginning, ending, status ):
|
||||
def update_fam( self, red_page_id, heading, beginning, ending, status ):
|
||||
"""
|
||||
Updates the red fam row in MySQL-Database for given fam_hash
|
||||
|
||||
@@ -183,8 +183,8 @@ class MYSQL_RED_FAM( MYSQL_RED ):
|
||||
|
||||
cursor = type( self ).connection.cursor()
|
||||
|
||||
query = 'UPDATE `red_families` SET `red_page_id` = ?, `beginning` = ?, `ending` = ?, `status`= ? WHERE `fam_hash` = ?;'
|
||||
data = ( int(red_page_id ), beginning, ending, int( status ), self.__fam_hash )
|
||||
query = 'UPDATE `red_families` SET `red_page_id` = ?, `heading` = ?, `beginning` = ?, `ending` = ?, `status`= ? WHERE `fam_hash` = ?;'
|
||||
data = ( int(red_page_id ), str( heading ), beginning, ending, int( status ), self.__fam_hash )
|
||||
|
||||
cursor.execute( query, data)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user