def update_metadata(self, metadata, update_flag=True): """update_flag tells whether to update EZID with the metadata (otherwise this will be picked up later by a separate updater) """ md2 = ezid.validate_metadata(metadata) with db.DBCursor() as c: params = (json.dumps(md2), False, self.identifier) c.execute(update_metadata_sql, params) self.up_to_date = False self.metadata = md2 if update_flag: self.sync_metadata() return
def mint(metadata, test=False): """mint a DOI using the test or UMMS prefix and set the landing page to the virtualbrain landing page for the DOI returns the DOI object, not the identifier """ if test: dp = ezid.test_prefix auth = test_auth else: dp = umms_doi_prefix auth = umms_auth identifier = ezid.mint(base_lp_url, metadata, dp, auth) md2 = ezid.validate_metadata(metadata) with db.DBCursor() as c: params = (identifier, json.dumps(md2), base_lp_url, True) c.execute(insert_sql, params) d = DOI(identifier) landing_page = '%s/lp/%s' % (base_lp_url, d.identifier) d.update_landing_page(landing_page) return d