-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdm_published.py
More file actions
executable file
·92 lines (76 loc) · 2.83 KB
/
dm_published.py
File metadata and controls
executable file
·92 lines (76 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env python3
# external modules
import DocMod
import os
import json
# my modules
import DCC
import Config as CF
# This code takes a search criteria, defined in "docinfo", and searches
# the DOORS document module (as stored in TraceTree) to find matches.
# It prints a report on all files found based on the list of attributes
# in "docmodreport".
# In setting search criteria it is possible to look for undefined
# attributes by using '_UNASSIGNED' as the matching criteria.
if os.path.isfile(CF.tracetreefilepath + CF.docmod_dict_file):
print('Found existing DocMod file: ', CF.docmod_dict_file)
else:
print('Creating DocMod file: ', CF.docmod_dict_file)
DocMod.create_docmod_file(CF.docmod_dict_file)
# Open the document module
fh = open(CF.tracetreefilepath + CF.docmod_dict_file,'r')
dm = json.load(fh)
fh.close()
# construct reflist to determine the search criteria
reflist = {}
docinfo = {}
# docinfo['dccDocNo'] = 'TMT.CTR.ICD.13.003'
# docinfo['dccDocStatus'] = 'LATEST'
# docinfo['CRNumbers'] = '_UNASSIGNED'
docinfo['TMTPublished'] = 'True'
reflist['ICD'] = docinfo
# print(reflist)
## Here are other example reflists commented out
# docinfo['dccDocStatus'] = 'LATEST'
# docinfo['dccDocTitle'] = 'Observatory Architecture Document (OAD)'
# docinfo['dccDocNo'] = 'TMT.SEN.DRD.05.002'
# docinfo['WIP-ParentDocumentNo'] = ''
#
# reflist['AD1'] = docinfo
#
# docinfo = {}
# docinfo['dccDocStatus'] = 'LATEST'
# docinfo['dccDocHandleNo'] = '7842'
#
# reflist['AD2'] = docinfo
#
# docinfo = {}
# docinfo['dccDocStatus'] = 'LATEST'
# docinfo['dccDocVersionHyperlink'] = 'https://docushare.tmt.org/docushare/dsweb/Get/Version-49415'
#
# reflist['AD3'] = docinfo
# construct document module report list
docmodreport = []
docmodreport.append('dccDocTitle')
docmodreport.append('dccDocNo')
docmodreport.append('dccDocRev')
docmodreport.append('DocType')
docmodreport.append('dccDocHandleHyperlink')
docmodreport.append('dccDocVersionHyperlink')
docmodreport.append('dccDocSignedApproved')
docmodreport.append('TMTPublished')
docmodreport.append('dccStatusCheckDate')
docmodreport.append('WIP-ParentDocumentNo')
docmodreport.append('CRNumbers')
s = DCC.login(CF.dcc_url + CF.dcc_login)
for ref in reflist.items():
print('looking for ', ref[0], ref[1])
for doc in dm.items():
if DocMod.is_in_dict(ref[1],doc[1]):
print('Found Document Module Object #:', doc[0])
DocMod.print_report(docmodreport, doc[1])
# The following code prints all DCC information on the found files
# fd = DCC.prop_get(s, DCC.get_handle(doc[1]['dccDocHandleHyperlink']), InfoSet = 'DocBasic')
# fd['permissions'] = DCC.prop_get(s, DCC.get_handle(doc[1]['dccDocHandleHyperlink']), InfoSet = 'Perms')
# DCC.print_doc_basic(fd)
# DCC.print_perms(fd['permissions'])