Ejemplo n.º 1
0
    def saveObjectToDB(self, args):
        # If it's a substatement, remove voided, authority, and id keys
        args['user'] = get_user_from_auth(self.auth)
        if self.__class__.__name__ == 'SubStatement':
            del args['voided']
            
            # If ID not given, created by models
            if 'statement_id' in args:
                del args['statement_id']
            
            if 'authority' in args:
                del args['authority']
            stmt = models.SubStatement(**args)
            stmt.save()
        else:
            stmt = models.statement(**args)
            stmt.save()

        if self.log_dict:
            self.log_dict['message'] = "Saved statement to database in %s.%s" % (__name__, self.saveObjectToDB.__name__)
            logger.info(msg=self.log_dict)
            self.log_dict['message'] = stmt.statement_id #stmt.object_return()
            logger.log(models.SystemAction.STMT_REF, msg=self.log_dict)            

        return stmt
Ejemplo n.º 2
0
 def _saveStatementToDB(self, args, sub):
     # pdb.set_trace()
     if sub:
         del args['voided']
         del args['statement_id']
         if 'authority' in args:
             del args['authority']
         stmt = models.SubStatement(**args)
         stmt.save()
     else:
         stmt = models.statement(**args)
         stmt.save()
     return stmt
Ejemplo n.º 3
0
 def _saveStatementToDB(self, args, sub):
     # pdb.set_trace()
     if sub:
         del args['voided']
         del args['statement_id']
         if 'authority' in args:
             del args['authority']
         stmt = models.SubStatement(**args)
         stmt.save()
     else:
         stmt = models.statement(**args)
         stmt.save()
     return stmt