Update mysql db if anything of re_fam changes
This commit is contained in:
14
red_fam.py
14
red_fam.py
@@ -97,9 +97,8 @@ class RED_FAM_PARSER( RED_FAM ):
|
||||
# Check status changes
|
||||
self.status()
|
||||
|
||||
# Since status change means something has changed, update database
|
||||
if( self._status != self.__mysql.data[ 'status' ] ):
|
||||
self.__mysql.update_fam( self._red_page_id, self._beginning, self._ending, self._status )
|
||||
# Triggers db update if anything changed
|
||||
self.changed()
|
||||
|
||||
def __handle_db( self ):
|
||||
"""
|
||||
@@ -186,6 +185,15 @@ class RED_FAM_PARSER( RED_FAM ):
|
||||
self._status = 1
|
||||
else:
|
||||
self._status = 2
|
||||
|
||||
def changed( self ):
|
||||
"""
|
||||
Checks wether anything has changed and maybe triggers db update
|
||||
"""
|
||||
|
||||
# Since status change means something has changed, update database
|
||||
if( self._status != self.__mysql.data[ 'status' ] or self._beginning != self.__mysql.data[ 'beginning' ] or self._ending != self.__mysql.data[ 'ending' ] or self._red_page_id != self.__mysql.data[ 'red_page_id' ] ):
|
||||
self.__mysql.update_fam( self._red_page_id, self._beginning, self._ending, self._status )
|
||||
|
||||
class RED_FAM_WORKER( RED_FAM ):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user