Mercurial > p > roundup > code
annotate scripts/schema_diagram.py @ 8478:ed4ef394d5d6
doc: initial attempt to document setup of pgp support for email.
Used an AI assistant to help write this. Basic gpg commands seem to
work, but I have not tested this totally. Docs basically follow the
setup used for pgp testing in the test suite.
It looks like roundup accepts signed emails as well as encrypted
and signed emails. But it does not generate signed emails.
Also it looks like there is no PGP support for alternate email
addresses. Only primary addresses can do PGP emails.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sat, 15 Nov 2025 16:59:24 -0500 |
| parents | 23b8e6067f7c |
| children | 9c3ec0a5c7fc |
| rev | line source |
|---|---|
| 1166 | 1 #! /usr/bin/python |
| 2 # | |
| 3 # Schema diagram generator contributed by Stefan Seefeld of the fresco | |
| 4 # project http://www.fresco.org/. | |
| 5 # | |
| 6 # It generates a 'dot file' that is then fed into the 'dot' | |
| 7 # tool (http://www.graphviz.org) to generate a graph: | |
| 8 # | |
| 9 # %> ./schema.py | |
| 10 # %> dot -Tps schema.dot -o schema.ps | |
| 11 # %> gv schema.ps | |
| 12 # | |
|
5376
64b05e24dbd8
Python 3 preparation: convert print to a function.
Joseph Myers <jsm@polyomino.org.uk>
parents:
1166
diff
changeset
|
13 from __future__ import print_function |
| 1166 | 14 import sys |
| 15 import roundup.instance | |
| 16 | |
| 17 # open the instance | |
| 18 instance = roundup.instance.open(sys.argv[1]) | |
| 19 db = instance.open() | |
| 20 | |
| 21 # diagram preamble | |
|
5376
64b05e24dbd8
Python 3 preparation: convert print to a function.
Joseph Myers <jsm@polyomino.org.uk>
parents:
1166
diff
changeset
|
22 print('digraph schema {') |
|
64b05e24dbd8
Python 3 preparation: convert print to a function.
Joseph Myers <jsm@polyomino.org.uk>
parents:
1166
diff
changeset
|
23 print('size="8,6"') |
|
64b05e24dbd8
Python 3 preparation: convert print to a function.
Joseph Myers <jsm@polyomino.org.uk>
parents:
1166
diff
changeset
|
24 print('node [shape="record" bgcolor="#ffe4c4" style=filled]') |
|
64b05e24dbd8
Python 3 preparation: convert print to a function.
Joseph Myers <jsm@polyomino.org.uk>
parents:
1166
diff
changeset
|
25 print('edge [taillabel="1" headlabel="1" dir=back arrowtail=ediamond]') |
| 1166 | 26 |
| 27 # get all the classes | |
|
5395
23b8e6067f7c
Python 3 preparation: update calls to dict methods.
Joseph Myers <jsm@polyomino.org.uk>
parents:
5376
diff
changeset
|
28 types = list(db.classes.keys()) |
| 1166 | 29 |
| 30 # one record node per class | |
| 31 for i in range(len(types)): | |
|
5376
64b05e24dbd8
Python 3 preparation: convert print to a function.
Joseph Myers <jsm@polyomino.org.uk>
parents:
1166
diff
changeset
|
32 print('node%d [label=\"{%s|}"]'%(i, types[i])) |
| 1166 | 33 |
| 34 # now draw in the relations | |
| 35 for name in db.classes.keys(): | |
| 36 type = db.classes[name] | |
| 37 attributes = type.getprops() | |
| 38 for a in attributes.keys(): | |
| 39 attribute = attributes[a] | |
| 40 if isinstance(attribute, roundup.hyperdb.Link): | |
|
5376
64b05e24dbd8
Python 3 preparation: convert print to a function.
Joseph Myers <jsm@polyomino.org.uk>
parents:
1166
diff
changeset
|
41 print('node%d -> node%d [label=%s]'%(types.index(name), |
| 1166 | 42 types.index(attribute.classname), |
|
5376
64b05e24dbd8
Python 3 preparation: convert print to a function.
Joseph Myers <jsm@polyomino.org.uk>
parents:
1166
diff
changeset
|
43 a)) |
| 1166 | 44 elif isinstance(attribute, roundup.hyperdb.Multilink): |
|
5376
64b05e24dbd8
Python 3 preparation: convert print to a function.
Joseph Myers <jsm@polyomino.org.uk>
parents:
1166
diff
changeset
|
45 print('node%d -> node%d [taillabel="*" label=%s]'%(types.index(name), |
| 1166 | 46 types.index(attribute.classname), |
|
5376
64b05e24dbd8
Python 3 preparation: convert print to a function.
Joseph Myers <jsm@polyomino.org.uk>
parents:
1166
diff
changeset
|
47 a)) |
| 1166 | 48 # all done |
|
5376
64b05e24dbd8
Python 3 preparation: convert print to a function.
Joseph Myers <jsm@polyomino.org.uk>
parents:
1166
diff
changeset
|
49 print('}') |
