def convertOrgUnitIDtoPath(orgUnitId, cd):
if GM.Globals[GM.MAP_ORGUNIT_ID_TO_NAME] is None:
GM.Globals[GM.MAP_ORGUNIT_ID_TO_NAME] = {}
orgUnitPath = None
else:
orgUnitPath = GM.Globals[GM.MAP_ORGUNIT_ID_TO_NAME].get(orgUnitId)
if not orgUnitPath:
if cd is None:
cd = buildGAPIObject(API.DIRECTORY)
try:
orgUnitPath = callGAPI(cd.orgunits(), u'get',
throw_reasons=[GAPI.INVALID_ORGUNIT, GAPI.ORGUNIT_NOT_FOUND, GAPI.BACKEND_ERROR, GAPI.BAD_REQUEST, GAPI.INVALID_CUSTOMER_ID, GAPI.LOGIN_REQUIRED],
customerId=GC.Values[GC.CUSTOMER_ID], orgUnitPath=orgUnitId, fields=u'orgUnitPath')[u'orgUnitPath']
except (GAPI.invalidOrgunit, GAPI.orgunitNotFound, GAPI.backendError, GAPI.badRequest, GAPI.invalidCustomerId, GAPI.loginRequired):
orgUnitPath = orgUnitId
GM.Globals[GM.MAP_ORGUNIT_ID_TO_NAME][orgUnitId] = orgUnitPath
return orgUnitPath
评论列表
文章目录