def delete(cls, item_id):
        '''


        :param item_id:

        '''
        to_delete = Session.query(cls.m).get(item_id)
        if to_delete is not None:
            Session.delete(to_delete)
            Session.commit()
示例#2
0
 def delete_doi(cls, identifier):
     '''
     Delete the record with a given DOI.
     :param identifier: the DOI string
     :return: True if a record was deleted, False if not
     '''
     to_delete = cls.read_doi(identifier)
     if to_delete is not None:
         Session.delete(to_delete)
         Session.commit()
         return True
     else:
         return False
示例#3
0
 def delete_package(cls, package_id):
     '''
     Delete the record associated with a given package.
     :param package_id: the id of the package
     :return: True if a record was deleted, False if not
     '''
     to_delete = cls.read_package(package_id)
     if to_delete is not None:
         Session.delete(to_delete)
         Session.commit()
         return True
     else:
         return False
示例#4
0
 def delete(self, commit=True):
     session = Session()
     session.delete(self)
     if commit:
         session.commit()
示例#5
0
文件: lib.py 项目: okfn/ckanext-doi
def delete_doi(package_id):
    """Delete the doi associated with a package_id"""
    doi = Session.query(DOI).filter(DOI.package_id == package_id).first()
    Session.delete(doi)
    Session.commit()