-
- # if auth records for this hrn dont exist, create it
- if not AuthHierarchy.auth_exists(hrn):
+ urn = hrn_to_urn(hrn, 'authority')
+ # make sure parent exists
+ parent_hrn = get_authority(hrn)
+ if not parent_hrn:
+ parent_hrn = hrn
+ if not parent_hrn == hrn:
+ self.create_top_level_auth_records(parent_hrn)
+
+ # create the authority if it doesnt already exist
+ if not AuthHierarchy.auth_exists(urn):