Updating Document Groups (Python)

Updating Document Groups (Python)
 1ot = impact.gui.output_toolbox
 2db = impact.active_database
 3
 4ot.clear()
 5docs = db.documents
 6
 7if docs.isNone():
 8    ot.add("No document support in the database")
 9else:
10    ot.add("Document support is enabled in this database")
11    settings = db.settings.document_settings
12
13    # find a document group and update its properties
14    groupName = "GroupA"
15    group = None
16    try:
17        group = settings.groups.item(groupName)
18    except Exception as exc:
19        pass
20    impact.gui.output_toolbox.add(f"Failed to create object via settings.groups.item(): {exc}")
21
22    if not group.isNone():
23
24        # set some IDocumentGroup properties
25        group.name = "Images"
26        group.default_extensions = "jpg;jpeg;png;bmp;"
27        group.allow_all_extensions = False
28
29        # call DoUpdate to apply the changes permanently
30        if group.do_update():
31
32            ot.add("Successfully updated document group " + groupName)
33
34        else:
35
36            ot.add("Failed to update document group " + groupName)
37
38    else:
39
40        ot.add("Unable to find document group " + groupName)