def create_system_metadata(pid, size, checksum, algorithm=None, format_id=None, access_policy=None, replication_policy=None, submitter=None, owner=None, orig_mn=None, auth_mn=None): sysmeta = dataoneTypes.systemMetadata() sysmeta.serialVersion = 1 sysmeta.identifier = pid sysmeta.size = size sysmeta.checksum = dataoneTypes.checksum(checksum) sysmeta.dateUploaded = datetime.datetime.utcnow() sysmeta.dateSysMetadataModified = datetime.datetime.utcnow() print "utils CONFIGURATION:", id(configuration), configuration if algorithm is not None: sysmeta.checksum.algorithm = algorithm else: sysmeta.checksum.algorithm = configuration.checksum_alg if format_id is not None: sysmeta.formatId = format_id else: sysmeta.formatId = configuration.format if submitter is not None: sysmeta.submitter = submitter else: sysmeta.submitter = configuration.submitter if owner is not None: sysmeta.rightsHolder = owner else: sysmeta.rightsHolder = configuration.owner if orig_mn is not None: sysmeta.originmn = orig_mn else: sysmeta.originmn = configuration.orig_mn if auth_mn is not None: sysmeta.authoritativemn = auth_mn else: sysmeta.authoritativemn = configuration.auth_mn if access_policy is not None: sysmeta.accessPolicy = access_policy.to_pyxb() else: sysmeta.accessPolicy = access_control_module.access_control().to_pyxb() if replication_policy is not None: sysmeta.replicationPolicy = replication_policy.to_pyxb() else: sysmeta.replicationPolicy = \ replication_policy_module.replication_policy().to_pyxb() return sysmeta
def __init__(self): Module.__init__(self) self.replication_policy = replication_policy()