Checking for Database Documents

Checking for Database Documents
 1ot = impact.gui.output_toolbox
 2db = impact.active_database
 3
 4ot.clear()
 5
 6docs = db.documents
 7
 8if docs is None:
 9    ot.add("No document support in the database")
10else:
11    ot.add("Document support is enabled in this database")
12
13    if db.settings.project_documents:
14        ot.add("Projects have associated documents")
15
16    if db.settings.layer_documents:
17        ot.add("layers have associated documents")
18
19    if db.settings.site_documents:
20        ot.add("Sites have associated documents")
21
22    if db.settings.customer_documents:
23        ot.add("Customers have associated documents")
24
25    if db.settings.contact_documents:
26        ot.add("Contacts have associated documents")
27
28    if db.settings.other_documents:
29        ot.add("Other documents can be stored")
30
31    if db.documents_blobbed:
32        ot.add("Documents are stored as BLOBs")
33    else:
34        ot.add("Documents are stored as files")
35
36    provider = db.settings.document_provider
37
38    ot.add("Document Provider: " + str(provider.name))
39    ot.add("  Guid: " + str(provider.guid))
40    ot.add("  version: " + str(provider.version))
41    ot.add("  Extenders: " + str(provider.extender_count))
42
43    for i in range(1, provider.extender_count  + 1):
44        extender = provider.extender(i)
45
46        ot.add("    Document Extender: " + str(extender.name))
47        ot.add("      Guid: " + str(extender.guid))
48        ot.add("      version: " + str(extender.version))
49
50    ot.add(str(provider.document_count(ipDocumentStatus.dsNormal)) + " normal documents currently in the database")
51    ot.add(str(provider.document_count(ipDocumentStatus.dsDeleted)) + " deleted documents currently in the database")
52    ot.add(str(provider.document_count(ipDocumentStatus.dsDataPurged)) + " documents with purged data currently in the database")
53
54
55