本文整理匯總了Python中DCC.set_metadata方法的典型用法代碼示例。如果您正苦於以下問題:Python DCC.set_metadata方法的具體用法?Python DCC.set_metadata怎麽用?Python DCC.set_metadata使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DCC
的用法示例。
在下文中一共展示了DCC.set_metadata方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: fix_objact
# 需要導入模塊: import DCC [as 別名]
# 或者: from DCC import set_metadata [as 別名]
def fix_objact(s, fd, handle, set, **kwargs):
ask_flag = kwargs.get('Ask',True)
if not check_fd_sel(fd, set):
return
for obj_act in set['ObjAct']:
if not obj_act['Action']:
pass
if Match.parse(obj_act['Criteria'], fd):
if obj_act['Action']['Action'] == 'SetOwner':
nu = DCC.prop_get(s, obj_act['Action']['Owner'], InfoSet = 'User')
print('??? Change Owner from [', fd['owner-userid'], ',', fd['owner-username'], '] to [',
nu['owner-userid'], ',', nu['owner-username'], ']', sep = '', end = '')
if ask_flag == False or MyUtil.get_yn(': (Y/N)? '):
DCC.change_owner(s, handle, obj_act['Action']['Owner'])
elif obj_act['Action']['Action'] == 'AddKeyword':
print('??? Add Keyword "', obj_act['Action']['Keyword'], '" to "', fd['keywords'].strip(), '"', sep = '', end = '')
if ask_flag == False or MyUtil.get_yn(': (Y/N)? '):
kw = obj_act['Action']['Keyword'] + fd['keywords'].strip(' ')
DCC.set_metadata(s, handle, Keywords = kw)
elif obj_act['Action']['Action'] == 'DelKeyword':
print('??? Remove Keyword "', obj_act['Action']['Keyword'], '" from "', fd['keywords'], '"', sep = '', end = '')
if ask_flag == False or MyUtil.get_yn(': (Y/N)? '):
kw = fd['keywords'].strip(' ').replace(obj_act['Action']['Keyword'], '')
DCC.set_metadata(s, handle, Keywords = kw)
elif obj_act['Action']['Action'] == 'RepTitle':
print('??? Change Title to "', obj_act['Action']['Title'], '" from "', fd['title'], '"', sep = '', end = '')
if ask_flag == False or MyUtil.get_yn(': (Y/N)? '):
DCC.set_metadata(s, handle, Title = obj_act['Action']['Title'])
elif obj_act['Action']['Action'] == 'RepTmtNum':
print('??? Change TmtNum to "', obj_act['Action']['TmtNum'], '" from "', fd['tmtnum'], '"', sep = '', end = '')
if ask_flag == False or MyUtil.get_yn(': (Y/N)? '):
DCC.set_metadata(s, handle, Summary = obj_act['Action']['TmtNum'])
pass
elif obj_act['Action']['Action'] == 'Message':
print(obj_act['Action']['Message'])
else:
print('Error in PERM.fix_objact: ObjAct Action not recognized:', obj_act['Action']['Action'])
示例2: print
# 需要導入模塊: import DCC [as 別名]
# 或者: from DCC import set_metadata [as 別名]
fd = DCC.prop_get(s, dcc_doc, InfoSet = 'DocBasic')
fd['permissions'] = DCC.prop_get(s, dcc_doc, InfoSet = 'Perms')
fd['versions'] = DCC.prop_get(s, dcc_doc, InfoSet = 'Versions')
print('\n############## ', dcc_doc, '##############')
if dcc_doc in docmodlist:
DocMod.print_report(docmodreport, docmatch[dcc_doc])
print('\n')
DCC.print_doc_basic(fd)
print('\n\t DCC View URL: ',Tree.url_view(fd['handle']),'\n')
print('*** [', dcc_doc, '] is recorded as published in Document Module')
if not 'TMTPublished' in fd['keywords']:
print('*** WARNING: Document in Published Collection, but TMTPublished keyword is not set')
# print('Checking flag_update = ',flag_update)
if flag_update and MyUtil.get_yn('Change DCC Keyword to add TMTPublished (Y/N)? '):
DCC.set_metadata(s,fd['handle'],Keywords = fd['keywords'] + ' TMTPublished')
docmod_title = docmatch[dcc_doc].get('dccDocTitle', 'No Attribute Value Assigned')
docmod_type = docmatch[dcc_doc].get('DocType', 'No Attribute Value Assigned')
docmod_short = docmatch[dcc_doc].get('dccShortTitle', 'No Attribute Value Assigned')
docmod_no = docmatch[dcc_doc].get('dccDocNo', 'No Attribute Value Assigned')
docmod_rev = docmatch[dcc_doc].get('dccDocRev', 'No Attribute Value Assigned')
docmod_cadno = docmatch[dcc_doc].get('CADDocumentNo', '')
docmod_ver = DCC.get_handle(docmatch[dcc_doc]['dccDocVersionHyperlink'])
# if ICD then combing docmod title and short title
if '.ICD.' in docmod_no and not 'Drawing' in docmod_type:
docmod_title = docmod_short.strip() + ' ---- ' + docmod_title.strip()
if not fd['title'] == docmod_title:
print('*** WARNING: Titles do not match')