Request information about reddisc page for redfams
To generate links to related reddisc it is necessary to get at least the Title of the related reddisc page. As saving the same data in db is worse, we retreive it via join from red_pages table Related Task: [https://fs.golderweb.de/index.php?do=details&task_id=26 FS#26]
This commit is contained in:
@@ -353,10 +353,14 @@ article7 ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? );'
|
|||||||
|
|
||||||
cursor = type( self ).connection.cursor( mysqldb.DictCursor )
|
cursor = type( self ).connection.cursor( mysqldb.DictCursor )
|
||||||
|
|
||||||
cursor.execute(
|
cursor.execute( (
|
||||||
'SELECT * FROM `{prefix}_red_families` WHERE `status` = ? AND'.
|
'SELECT * ' +
|
||||||
format(prefix=type( self ).db_table_prefix) +
|
'FROM `{prefix}_red_families` `F` ' +
|
||||||
'`ending` >= ?;', ( status, ending ) )
|
'INNER JOIN `{prefix}_red_pages` `P` ' +
|
||||||
|
'ON `F`.`status` = ? ' +
|
||||||
|
'AND `F`.`ending` >= ? '
|
||||||
|
'AND `F`.`red_page_id` = `P`.`page_id`;').format(
|
||||||
|
prefix=type( self ).db_table_prefix), ( status, ending ) )
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
res = cursor.fetchmany( 1000 )
|
res = cursor.fetchmany( 1000 )
|
||||||
|
|||||||
@@ -117,8 +117,8 @@ class RedFam:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# On archived red_fams do not delete possibly existing ending
|
# On archived red_fams do not delete possibly existing ending
|
||||||
if( not self._ending and self._status > 1
|
if( not self._ending and self._status > 1 and
|
||||||
and self._mysql.data[ 'ending' ] ):
|
self._mysql.data[ 'ending' ] ):
|
||||||
|
|
||||||
self._ending = self._mysql.data[ 'ending' ]
|
self._ending = self._mysql.data[ 'ending' ]
|
||||||
|
|
||||||
@@ -447,6 +447,14 @@ class RedFamWorker( RedFam ):
|
|||||||
|
|
||||||
self._mysql.data = mysql_data
|
self._mysql.data = mysql_data
|
||||||
|
|
||||||
|
# Get related RedPage-Information
|
||||||
|
self.redpageid = mysql_data[ 'page_id' ]
|
||||||
|
self.redpagetitle = mysql_data[ 'page_title' ]
|
||||||
|
|
||||||
|
# Make sure locale is set to 'de_DE.UTF-8' to prevent problems
|
||||||
|
# with wrong month abreviations in strptime
|
||||||
|
locale.setlocale(locale.LC_ALL, 'de_DE.UTF-8')
|
||||||
|
|
||||||
def update_status( self ):
|
def update_status( self ):
|
||||||
"""
|
"""
|
||||||
Sets status to 3 when worked on
|
Sets status to 3 when worked on
|
||||||
@@ -481,6 +489,7 @@ class RedFamWorker( RedFam ):
|
|||||||
print(fam)
|
print(fam)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
class RedFamError( Exception ):
|
class RedFamError( Exception ):
|
||||||
"""
|
"""
|
||||||
Base class for all Errors of RedFam-Module
|
Base class for all Errors of RedFam-Module
|
||||||
|
|||||||
Reference in New Issue
Block a user