From f1c048951eedb249416c7e3fcce4df034969a4df Mon Sep 17 00:00:00 2001 From: Ross Spencer Date: Fri, 7 Jun 2019 14:58:33 +0200 Subject: [PATCH 1/2] Create a mechanism to provide a custom FILEID Enable mets-reader-writer to output a FILEID for a METS document that isn't automatically generated using another component provided to the FSENTRY constructor. --- metsrw/fsentry.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/metsrw/fsentry.py b/metsrw/fsentry.py index 6ca5107..4ea82ba 100644 --- a/metsrw/fsentry.py +++ b/metsrw/fsentry.py @@ -52,6 +52,12 @@ class FSEntry(DependencyPossessor): populate FLocat @xlink:href :param str label: Label in the structMap. If not provided, will be populated with the basename of path + :param str fileid: Provides a mechanism to assign a FILEID to an FSENTRY + when a pointer file is being created, so when a METS file is being + written for an package-file-type, i.e. an AIP. The FILE ID is an XML + NC (Non-colonized) name and so callers must understand the restricted + character-set of that type to use it properly. There is currently no + validation on this attribute on generation. :param str use: Use for the fileGrp. Items with identical uses will be grouped together. :param str type: Type of FSEntry this is. This will appear in the structMap. @@ -112,6 +118,7 @@ class FSEntry(DependencyPossessor): def __init__( self, path=None, + fileid=None, label=None, use="original", type=u"Item", @@ -138,6 +145,7 @@ def __init__( self.path = path if label is None and path is not None: label = os.path.basename(path) + self._fileid = fileid self.label = label self.use = use self.type = six.text_type(type) @@ -204,6 +212,8 @@ def file_id(self): "No FILEID: File %s does not have file_uuid set" % self.path ) if self.is_aip: + if self._fileid: + return self._fileid return os.path.splitext(os.path.basename(self.path))[0] return utils.FILE_ID_PREFIX + self.file_uuid From 9ab6410b876c95bd9323e1d3dad8cfdfd792c726 Mon Sep 17 00:00:00 2001 From: Ross Spencer Date: Thu, 13 Jun 2019 20:41:04 +0200 Subject: [PATCH 2/2] Increment version --- docs/conf.py | 4 ++-- metsrw/__init__.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index baac2b3..9d6e065 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -51,9 +51,9 @@ # built documents. # # The short X.Y version. -version = "0.3.8" +version = "0.3.9" # The full version, including alpha/beta/rc tags. -release = "0.3.8" +release = "0.3.9" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/metsrw/__init__.py b/metsrw/__init__.py index 920c006..35ba950 100644 --- a/metsrw/__init__.py +++ b/metsrw/__init__.py @@ -43,7 +43,7 @@ LOGGER = logging.getLogger(__name__) LOGGER.addHandler(logging.NullHandler()) -__version__ = "0.3.8" +__version__ = "0.3.9" __all__ = [ "Agent",