scout/adapter/mongo/institute.py
def add_institute(self, institute_obj):
        """Add a institute to the database

            Args:
                institute_obj(Institute)
        """
        internal_id = institute_obj['internal_id']
        display_name = institute_obj['internal_id']

        # Check if institute already exists
        if self.institute(institute_id=internal_id):
            raise IntegrityError("Institute {0} already exists in database"
                                 .format(display_name))

        LOG.info("Adding institute with internal_id: {0} and "
                    "display_name: {1}".format(internal_id,
                                               display_name))

        insert_info = self.institute_collection.insert_one(institute_obj)
        ##TODO check if insert info was ok
        LOG.info("Institute saved")
def add_institute(self, institute_obj):
        internal_id = institute_obj['internal_id']
        display_name = institute_obj['internal_id']

        # Check if institute already exists
        if self.institute(institute_id=internal_id):
            raise IntegrityError("Institute {0} already exists in database"
                                 .format(display_name))

        LOG.info("Adding institute with internal_id: {0} and "
                    "display_name: {1}".format(internal_id,
                                               display_name))

        insert_info = self.institute_collection.insert_one(institute_obj)
        ##TODO check if insert info was ok
        LOG.info("Institute saved")
def add_institute ( self , institute_obj ) : internal_id = institute_obj [ 'internal_id' ] display_name = institute_obj [ 'internal_id' ] # Check if institute already exists if self . institute ( institute_id = internal_id ) : raise IntegrityError ( "Institute {0} already exists in database" . format ( display_name ) ) LOG . info ( "Adding institute with internal_id: {0} and " "display_name: {1}" . format ( internal_id , display_name ) ) insert_info = self . institute_collection . insert_one ( institute_obj ) ##TODO check if insert info was ok LOG . info ( "Institute saved" )
Add a institute to the database

            Args:
                institute_obj(Institute)
Add a institute to the database