Skip to content

Commit

Permalink
reenable log handler as sub-command removes existing ones
Browse files Browse the repository at this point in the history
  • Loading branch information
jsjiang committed Oct 24, 2023
1 parent 07be714 commit 6697719
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
15 changes: 13 additions & 2 deletions ezidapp/management/commands/check-ezid.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ def handle(self, *_, **opt):
log.info(f'Creating AKR shoulder: {prefix}, org_name: {org_name}')
shoulder, minter = self.check_create_sholuder_and_minter('ark', prefix, org_name)

# reenable log handler as sub-command removes existing handlers
impl.nog_sql.util.log_setup(__name__, opt.debug)

if not (shoulder.prefix == prefix and shoulder.type == 'ARK'
and shoulder.isSupershoulder == False
and shoulder.datacenter == None
Expand All @@ -81,6 +84,8 @@ def handle(self, *_, **opt):
datacenter_symbol = 'CDL.CDL'
log.info(f'Creating Datacite DOI shoulder: {prefix}, org_name: {org_name}')
shoulder, minter = self.check_create_sholuder_and_minter('doi', prefix, org_name, datacenter_symbol)

impl.nog_sql.util.log_setup(__name__, opt.debug)

if not (shoulder.prefix == prefix and shoulder.type == 'DOI'
and shoulder.datacenter.symbol == datacenter_symbol
Expand All @@ -97,6 +102,8 @@ def handle(self, *_, **opt):
log.info(f'Creating Crossref DOI shoulder: {prefix}, org_name: {org_name}')
shoulder, minter = self.check_create_sholuder_and_minter('doi', prefix, org_name, is_crossref=True)

impl.nog_sql.util.log_setup(__name__, opt.debug)

if not (shoulder.prefix == prefix and shoulder.type == 'DOI'
and shoulder.datacenter == None
and shoulder.isCrossref == True
Expand All @@ -123,11 +130,12 @@ def handle(self, *_, **opt):
password = 'apitest'
prefix = 'ark:/99999/fk88'
self.test_shoulder_mint_cmd(prefix)
impl.nog_sql.util.log_setup(__name__, opt.debug)

self.grant_user_access_to_shoulder(username, prefix)
shoulder, id_created, text = impl.client_util.mint_identifers(base_url, username, password, prefix, record_1)
if id_created is not None:
log.info(f'#### OK mint_id on {shoulder}, ID created: {id_created}')
print(f'#### OK mint_id on {shoulder}, ID created: {id_created}')
update_data = {
'_status': 'reserved',
}
Expand All @@ -138,17 +146,20 @@ def handle(self, *_, **opt):

else:
log.error(f'#### ERROR mint_id on {shoulder}')
print(f'#### ERROR mint_id on {shoulder}')




prefix = 'doi:10.5072/FK7'
self.test_shoulder_mint_cmd(prefix)
impl.nog_sql.util.log_setup(__name__, opt.debug)

self.grant_user_access_to_shoulder(username, prefix)

prefix = 'doi:10.31223/FK3'
self.test_shoulder_mint_cmd(prefix)
impl.nog_sql.util.log_setup(__name__, opt.debug)

self.grant_user_access_to_shoulder(username, prefix)


Expand Down
1 change: 0 additions & 1 deletion impl/client_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ def post_data(url, user_name, password, data):


def mint_identifers(base_url, user_name, password, shoulder, data):
print(data)
url = f'{base_url}/shoulder/{shoulder}'
http_success, status_code, text, err_msg = post_data(url, user_name, password, data)

Expand Down

0 comments on commit 6697719

Please sign in to comment.