(self, rdb)
This will edit a reaction with the supplied information
This will edit a reaction with the supplied information
This will edit a reaction with the supplied information
def editReaction(self, rdb):
        ''' This will edit a reaction with the supplied information '''
        # Encrypt User Input
        if self.config['CRYPTO_ENABLED']:
            crypto = Fernet(self.config['CRYPTO_KEY'])
            try:
                self.data = crypto.encrypt(json.dumps(self.data))
            except:
                return False
            self.encrypted = True

        reactdata = {
            'name': self.name,
            'rtype': self.rtype,
            'uid': self.uid,
            'trigger': self.trigger,
            'frequency': self.frequency,
            'lastrun': self.lastrun,
            'data': self.data,
            'encrypted' : self.encrypted
        }
        results = r.table('reactions').get(self.rid).update(reactdata).run(rdb)
        if results['replaced'] == 1:
            qdata = {}
            qdata['item'] = reactdata
            qdata['action'] = 'edit'
            qdata['type'] = 'reaction'
            qdata['item']['rid'] = self.rid
            q1 = r.table('dc1queue').insert(qdata).run(rdb)
            q2 = r.table('dc2queue').insert(qdata).run(rdb)
            return "edit true"
        else:
            return "edit failed"
def editReaction ( self , rdb ) : # Encrypt User Input if self . config [ 'CRYPTO_ENABLED' ] : crypto = Fernet ( self . config [ 'CRYPTO_KEY' ] ) try : self . data = crypto . encrypt ( json . dumps ( self . data ) ) except : return False self . encrypted = True reactdata = { 'name' : self . name , 'rtype' : self . rtype , 'uid' : self . uid , 'trigger' : self . trigger , 'frequency' : self . frequency , 'lastrun' : self . lastrun , 'data' : self . data , 'encrypted' : self . encrypted } results = r . table ( 'reactions' ) . get ( self . rid ) . update ( reactdata ) . run ( rdb ) if results [ 'replaced' ] == 1 : qdata = { } qdata [ 'item' ] = reactdata qdata [ 'action' ] = 'edit' qdata [ 'type' ] = 'reaction' qdata [ 'item' ] [ 'rid' ] = self . rid q1 = r . table ( 'dc1queue' ) . insert ( qdata ) . run ( rdb ) q2 = r . table ( 'dc2queue' ) . insert ( qdata ) . run ( rdb ) return "edit true" else : return "edit failed"