def createSIP(path, UUID=None, sip_type='SIP'): """ Create a new SIP object for a SIP at the given path. :param str path: The current path of the SIP on disk. Can contain variables; see the documentation for ReplacementDict for supported names. :param str UUID: The UUID to be created for the SIP. If not specified, a new UUID will be generated using the version 4 scheme. :param str sip_type: A string representing the type of the SIP. Defaults to "SIP". The other value typically used is "AIC". :returns str: The UUID for the created SIP. """ if UUID is None: UUID = str(uuid.uuid4()) print("Creating SIP:", UUID, "-", path) sip = SIP(uuid=UUID, currentpath=path, sip_type=sip_type) sip.save() return UUID
def createSIP(path, UUID=None, sip_type="SIP", diruuids=False, printfn=print): """ Create a new SIP object for a SIP at the given path. :param str path: The current path of the SIP on disk. Can contain variables; see the documentation for ReplacementDict for supported names. :param str UUID: The UUID to be created for the SIP. If not specified, a new UUID will be generated using the version 4 scheme. :param str sip_type: A string representing the type of the SIP. Defaults to "SIP". The other value typically used is "AIC". :param str diruuids: A boolean indicating whether the SIP should have UUIDs assigned to all of its subdirectories. This param is relevant in filesystem_ajax/views.py and clientScripts/createSIPfromTransferObjects.py. :returns str: The UUID for the created SIP. """ if UUID is None: UUID = str(uuid.uuid4()) printfn("Creating SIP:", UUID, "-", path) sip = SIP(uuid=UUID, currentpath=path, sip_type=sip_type, diruuids=diruuids) sip.save() return UUID