File: design.html

package info (click to toggle)
roundup 1.2.1-10%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 4,764 kB
  • ctags: 3,756
  • sloc: python: 30,296; sh: 1,497; perl: 23; makefile: 22
file content (1929 lines) | stat: -rw-r--r-- 88,007 bytes parent folder | download | duplicates (2)
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
<title>Roundup - An Issue-Tracking System for Knowledge Workers</title>
<meta name="authors" content="Ka-Ping Yee (original)  Richard Jones (implementation)" />
<style type="text/css">

/*
:Author: David Goodger
:Contact: goodger@users.sourceforge.net
:Date: $Date$
:Revision: $Revision$
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.

See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/

/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
  border: 0 }

table.borderless td, table.borderless th {
  /* Override padding for "table.docutils td" with "! important".
     The right padding separates the table cells. */
  padding: 0 0.5em 0 0 ! important }

.first {
  /* Override more specific margin styles with "! important". */
  margin-top: 0 ! important }

.last, .with-subtitle {
  margin-bottom: 0 ! important }

.hidden {
  display: none }

a.toc-backref {
  text-decoration: none ;
  color: black }

blockquote.epigraph {
  margin: 2em 5em ; }

dl.docutils dd {
  margin-bottom: 0.5em }

/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
  font-weight: bold }
*/

div.abstract {
  margin: 2em 5em }

div.abstract p.topic-title {
  font-weight: bold ;
  text-align: center }

div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
  margin: 2em ;
  border: medium outset ;
  padding: 1em }

div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
  font-weight: bold ;
  font-family: sans-serif }

div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title {
  color: red ;
  font-weight: bold ;
  font-family: sans-serif }

/* Uncomment (and remove this text!) to get reduced vertical space in
   compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
  margin-bottom: 0.5em }

div.compound .compound-last, div.compound .compound-middle {
  margin-top: 0.5em }
*/

div.dedication {
  margin: 2em 5em ;
  text-align: center ;
  font-style: italic }

div.dedication p.topic-title {
  font-weight: bold ;
  font-style: normal }

div.figure {
  margin-left: 2em ;
  margin-right: 2em }

div.footer, div.header {
  clear: both;
  font-size: smaller }

div.line-block {
  display: block ;
  margin-top: 1em ;
  margin-bottom: 1em }

div.line-block div.line-block {
  margin-top: 0 ;
  margin-bottom: 0 ;
  margin-left: 1.5em }

div.sidebar {
  margin-left: 1em ;
  border: medium outset ;
  padding: 1em ;
  background-color: #ffffee ;
  width: 40% ;
  float: right ;
  clear: right }

div.sidebar p.rubric {
  font-family: sans-serif ;
  font-size: medium }

div.system-messages {
  margin: 5em }

div.system-messages h1 {
  color: red }

div.system-message {
  border: medium outset ;
  padding: 1em }

div.system-message p.system-message-title {
  color: red ;
  font-weight: bold }

div.topic {
  margin: 2em }

h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
  margin-top: 0.4em }

h1.title {
  text-align: center }

h2.subtitle {
  text-align: center }

hr.docutils {
  width: 75% }

img.align-left {
  clear: left }

img.align-right {
  clear: right }

ol.simple, ul.simple {
  margin-bottom: 1em }

ol.arabic {
  list-style: decimal }

ol.loweralpha {
  list-style: lower-alpha }

ol.upperalpha {
  list-style: upper-alpha }

ol.lowerroman {
  list-style: lower-roman }

ol.upperroman {
  list-style: upper-roman }

p.attribution {
  text-align: right ;
  margin-left: 50% }

p.caption {
  font-style: italic }

p.credits {
  font-style: italic ;
  font-size: smaller }

p.label {
  white-space: nowrap }

p.rubric {
  font-weight: bold ;
  font-size: larger ;
  color: maroon ;
  text-align: center }

p.sidebar-title {
  font-family: sans-serif ;
  font-weight: bold ;
  font-size: larger }

p.sidebar-subtitle {
  font-family: sans-serif ;
  font-weight: bold }

p.topic-title {
  font-weight: bold }

pre.address {
  margin-bottom: 0 ;
  margin-top: 0 ;
  font-family: serif ;
  font-size: 100% }

pre.literal-block, pre.doctest-block {
  margin-left: 2em ;
  margin-right: 2em ;
  background-color: #eeeeee }

span.classifier {
  font-family: sans-serif ;
  font-style: oblique }

span.classifier-delimiter {
  font-family: sans-serif ;
  font-weight: bold }

span.interpreted {
  font-family: sans-serif }

span.option {
  white-space: nowrap }

span.pre {
  white-space: pre }

span.problematic {
  color: red }

span.section-subtitle {
  /* font-size relative to parent (h1..h6 element) */
  font-size: 80% }

table.citation {
  border-left: solid 1px gray;
  margin-left: 1px }

table.docinfo {
  margin: 2em 4em }

table.docutils {
  margin-top: 0.5em ;
  margin-bottom: 0.5em }

table.footnote {
  border-left: solid 1px black;
  margin-left: 1px }

table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
  padding-left: 0.5em ;
  padding-right: 0.5em ;
  vertical-align: top }

table.docutils th.field-name, table.docinfo th.docinfo-name {
  font-weight: bold ;
  text-align: left ;
  white-space: nowrap ;
  padding-left: 0 }

h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
  font-size: 100% }

tt.docutils {
  background-color: #eeeeee }

ul.auto-toc {
  list-style-type: none }

</style>
</head>
<body>
<div class="document" id="roundup-an-issue-tracking-system-for-knowledge-workers">
<h1 class="title">Roundup - An Issue-Tracking System for Knowledge Workers</h1>
<table class="docinfo" frame="void" rules="none">
<col class="docinfo-name" />
<col class="docinfo-content" />
<tbody valign="top">
<tr><th class="docinfo-name">Authors:</th>
<td>Ka-Ping Yee (original)
<br />Richard Jones (implementation)</td></tr>
</tbody>
</table>
<div class="contents topic">
<p class="topic-title first"><a id="contents" name="contents">Contents</a></p>
<ul class="simple">
<li><a class="reference" href="#introduction" id="id2" name="id2">Introduction</a></li>
<li><a class="reference" href="#the-layer-cake" id="id3" name="id3">The Layer Cake</a></li>
<li><a class="reference" href="#hyperdatabase" id="id4" name="id4">Hyperdatabase</a><ul>
<li><a class="reference" href="#dates-and-date-arithmetic" id="id5" name="id5">Dates and Date Arithmetic</a></li>
<li><a class="reference" href="#items-and-classes" id="id6" name="id6">Items and Classes</a></li>
<li><a class="reference" href="#identifiers-and-designators" id="id7" name="id7">Identifiers and Designators</a></li>
<li><a class="reference" href="#property-names-and-types" id="id8" name="id8">Property Names and Types</a></li>
<li><a class="reference" href="#hyperdb-interface-specification" id="id9" name="id9">Hyperdb Interface Specification</a></li>
<li><a class="reference" href="#hyperdatabase-implementations" id="id10" name="id10">Hyperdatabase Implementations</a></li>
<li><a class="reference" href="#application-example" id="id11" name="id11">Application Example</a></li>
</ul>
</li>
<li><a class="reference" href="#roundup-database" id="id12" name="id12">Roundup Database</a><ul>
<li><a class="reference" href="#reserved-classes" id="id13" name="id13">Reserved Classes</a><ul>
<li><a class="reference" href="#users" id="id14" name="id14">Users</a></li>
<li><a class="reference" href="#messages" id="id15" name="id15">Messages</a></li>
<li><a class="reference" href="#files" id="id16" name="id16">Files</a></li>
</ul>
</li>
<li><a class="reference" href="#issue-classes" id="id17" name="id17">Issue Classes</a></li>
<li><a class="reference" href="#roundupdb-interface-specification" id="id18" name="id18">Roundupdb Interface Specification</a></li>
<li><a class="reference" href="#default-schema" id="id19" name="id19">Default Schema</a></li>
</ul>
</li>
<li><a class="reference" href="#detector-interface" id="id20" name="id20">Detector Interface</a><ul>
<li><a class="reference" href="#detector-interface-specification" id="id21" name="id21">Detector Interface Specification</a></li>
<li><a class="reference" href="#detector-example" id="id22" name="id22">Detector Example</a></li>
</ul>
</li>
<li><a class="reference" href="#command-interface" id="id23" name="id23">Command Interface</a><ul>
<li><a class="reference" href="#command-interface-specification" id="id24" name="id24">Command Interface Specification</a></li>
<li><a class="reference" href="#usage-example" id="id25" name="id25">Usage Example</a></li>
</ul>
</li>
<li><a class="reference" href="#e-mail-user-interface" id="id26" name="id26">E-mail User Interface</a><ul>
<li><a class="reference" href="#message-processing" id="id27" name="id27">Message Processing</a></li>
<li><a class="reference" href="#nosy-lists" id="id28" name="id28">Nosy Lists</a></li>
<li><a class="reference" href="#setting-properties" id="id29" name="id29">Setting Properties</a></li>
</ul>
</li>
<li><a class="reference" href="#web-user-interface" id="id30" name="id30">Web User Interface</a><ul>
<li><a class="reference" href="#views-and-view-specifiers" id="id31" name="id31">Views and View Specifiers</a></li>
<li><a class="reference" href="#displaying-properties" id="id32" name="id32">Displaying Properties</a></li>
<li><a class="reference" href="#index-views" id="id33" name="id33">Index Views</a><ul>
<li><a class="reference" href="#index-view-specifiers" id="id34" name="id34">Index View Specifiers</a></li>
<li><a class="reference" href="#index-section" id="id35" name="id35">Index Section</a></li>
<li><a class="reference" href="#sorting" id="id36" name="id36">Sorting</a></li>
</ul>
</li>
<li><a class="reference" href="#issue-views" id="id37" name="id37">Issue Views</a><ul>
<li><a class="reference" href="#issue-view-specifiers" id="id38" name="id38">Issue View Specifiers</a></li>
<li><a class="reference" href="#editor-section" id="id39" name="id39">Editor Section</a></li>
<li><a class="reference" href="#spool-section" id="id40" name="id40">Spool Section</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference" href="#access-control" id="id41" name="id41">Access Control</a><ul>
<li><a class="reference" href="#access-control-interface-specification" id="id42" name="id42">Access Control Interface Specification</a></li>
<li><a class="reference" href="#authentication-of-users" id="id43" name="id43">Authentication of Users</a></li>
<li><a class="reference" href="#anonymous-users" id="id44" name="id44">Anonymous Users</a></li>
<li><a class="reference" href="#use-cases" id="id45" name="id45">Use Cases</a></li>
</ul>
</li>
<li><a class="reference" href="#deployment-scenarios" id="id46" name="id46">Deployment Scenarios</a></li>
<li><a class="reference" href="#acknowledgements" id="id47" name="id47">Acknowledgements</a></li>
<li><a class="reference" href="#changes-to-this-document" id="id48" name="id48">Changes to this document</a></li>
</ul>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id2" id="introduction" name="introduction">Introduction</a></h1>
<p>This document presents a description of the components of the Roundup
system and specifies their interfaces and behaviour in sufficient detail
to guide an implementation. For the philosophy and rationale behind the
Roundup design, see the first-round Software Carpentry <a class="reference" href="spec.html">submission for
Roundup</a>. This document fleshes out that design as well as specifying
interfaces so that the components can be developed separately.</p>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id3" id="the-layer-cake" name="the-layer-cake">The Layer Cake</a></h1>
<p>Lots of software design documents come with a picture of a cake.
Everybody seems to like them.  I also like cakes (i think they are
tasty).  So I, too, shall include a picture of a cake here:</p>
<pre class="literal-block">
 ________________________________________________________________
| E-mail Client |  Web Browser  |  Detector Scripts  |   Shell   |
|---------------+---------------+--------------------+-----------|
|  E-mail User  |   Web User    |     Detector       |  Command  |
|----------------------------------------------------------------|
|                    Roundup Database Layer                      |
|----------------------------------------------------------------|
|                     Hyperdatabase Layer                        |
|----------------------------------------------------------------|
|                        Storage Layer                           |
 ----------------------------------------------------------------
</pre>
<p>The colourful parts of the cake are part of our system; the faint grey
parts of the cake are external components.</p>
<p>I will now proceed to forgo all table manners and eat from the bottom of
the cake to the top.  You may want to stand back a bit so you don't get
covered in crumbs.</p>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id4" id="hyperdatabase" name="hyperdatabase">Hyperdatabase</a></h1>
<p>The lowest-level component to be implemented is the hyperdatabase. The
hyperdatabase is a flexible data store that can hold configurable data
in records which we call items.</p>
<p>The hyperdatabase is implemented on top of the storage layer, an
external module for storing its data. The &quot;batteries-includes&quot; distribution
implements the hyperdatabase on the standard anydbm module.  The storage
layer could be a third-party RDBMS; for a low-maintenance solution,
implementing the hyperdatabase on the SQLite RDBMS is suggested.</p>
<div class="section">
<h2><a class="toc-backref" href="#id5" id="dates-and-date-arithmetic" name="dates-and-date-arithmetic">Dates and Date Arithmetic</a></h2>
<p>Before we get into the hyperdatabase itself, we need a way of handling
dates.  The hyperdatabase module provides Timestamp objects for
representing date-and-time stamps and Interval objects for representing
date-and-time intervals.</p>
<p>As strings, date-and-time stamps are specified with the date in
international standard format (<tt class="docutils literal"><span class="pre">yyyy-mm-dd</span></tt>) joined to the time
(<tt class="docutils literal"><span class="pre">hh:mm:ss</span></tt>) by a period &quot;<tt class="docutils literal"><span class="pre">.</span></tt>&quot;.  Dates in this form can be easily
compared and are fairly readable when printed.  An example of a valid
stamp is &quot;<tt class="docutils literal"><span class="pre">2000-06-24.13:03:59</span></tt>&quot;. We'll call this the &quot;full date
format&quot;.  When Timestamp objects are printed as strings, they appear in
the full date format with the time always given in GMT.  The full date
format is always exactly 19 characters long.</p>
<p>For user input, some partial forms are also permitted: the whole time or
just the seconds may be omitted; and the whole date may be omitted or
just the year may be omitted.  If the time is given, the time is
interpreted in the user's local time zone. The Date constructor takes
care of these conversions. In the following examples, suppose that
<tt class="docutils literal"><span class="pre">yyyy</span></tt> is the current year, <tt class="docutils literal"><span class="pre">mm</span></tt> is the current month, and <tt class="docutils literal"><span class="pre">dd</span></tt> is
the current day of the month; and suppose that the user is on Eastern
Standard Time.</p>
<ul class="simple">
<li>&quot;2000-04-17&quot; means &lt;Date 2000-04-17.00:00:00&gt;</li>
<li>&quot;01-25&quot; means &lt;Date yyyy-01-25.00:00:00&gt;</li>
<li>&quot;2000-04-17.03:45&quot; means &lt;Date 2000-04-17.08:45:00&gt;</li>
<li>&quot;08-13.22:13&quot; means &lt;Date yyyy-08-14.03:13:00&gt;</li>
<li>&quot;11-07.09:32:43&quot; means &lt;Date yyyy-11-07.14:32:43&gt;</li>
<li>&quot;14:25&quot; means</li>
<li>&lt;Date yyyy-mm-dd.19:25:00&gt;</li>
<li>&quot;8:47:11&quot; means</li>
<li>&lt;Date yyyy-mm-dd.13:47:11&gt;</li>
<li>the special date &quot;.&quot; means &quot;right now&quot;</li>
</ul>
<p>Date intervals are specified using the suffixes &quot;y&quot;, &quot;m&quot;, and &quot;d&quot;.  The
suffix &quot;w&quot; (for &quot;week&quot;) means 7 days. Time intervals are specified in
hh:mm:ss format (the seconds may be omitted, but the hours and minutes
may not).</p>
<ul class="simple">
<li>&quot;3y&quot; means three years</li>
<li>&quot;2y 1m&quot; means two years and one month</li>
<li>&quot;1m 25d&quot; means one month and 25 days</li>
<li>&quot;2w 3d&quot; means two weeks and three days</li>
<li>&quot;1d 2:50&quot; means one day, two hours, and 50 minutes</li>
<li>&quot;14:00&quot; means 14 hours</li>
<li>&quot;0:04:33&quot; means four minutes and 33 seconds</li>
</ul>
<p>The Date class should understand simple date expressions of the form
<em>stamp</em> <tt class="docutils literal"><span class="pre">+</span></tt> <em>interval</em> and <em>stamp</em> <tt class="docutils literal"><span class="pre">-</span></tt> <em>interval</em>. When adding or
subtracting intervals involving months or years, the components are
handled separately.  For example, when evaluating &quot;<tt class="docutils literal"><span class="pre">2000-06-25</span> <span class="pre">+</span> <span class="pre">1m</span>
<span class="pre">10d</span></tt>&quot;, we first add one month to get 2000-07-25, then add 10 days to
get 2000-08-04 (rather than trying to decide whether 1m 10d means 38 or
40 or 41 days).</p>
<p>Here is an outline of the Date and Interval classes:</p>
<pre class="literal-block">
class Date:
    def __init__(self, spec, offset):
        &quot;&quot;&quot;Construct a date given a specification and a time zone
        offset.

        'spec' is a full date or a partial form, with an optional
        added or subtracted interval.  'offset' is the local time
        zone offset from GMT in hours.
        &quot;&quot;&quot;

    def __add__(self, interval):
        &quot;&quot;&quot;Add an interval to this date to produce another date.&quot;&quot;&quot;

    def __sub__(self, interval):
        &quot;&quot;&quot;Subtract an interval from this date to produce another
        date.
        &quot;&quot;&quot;

    def __cmp__(self, other):
        &quot;&quot;&quot;Compare this date to another date.&quot;&quot;&quot;

    def __str__(self):
        &quot;&quot;&quot;Return this date as a string in the yyyy-mm-dd.hh:mm:ss
        format.
        &quot;&quot;&quot;

    def local(self, offset):
        &quot;&quot;&quot;Return this date as yyyy-mm-dd.hh:mm:ss in a local time
        zone.
        &quot;&quot;&quot;

class Interval:
    def __init__(self, spec):
        &quot;&quot;&quot;Construct an interval given a specification.&quot;&quot;&quot;

    def __cmp__(self, other):
        &quot;&quot;&quot;Compare this interval to another interval.&quot;&quot;&quot;

    def __str__(self):
        &quot;&quot;&quot;Return this interval as a string.&quot;&quot;&quot;
</pre>
<p>Here are some examples of how these classes would behave in practice.
For the following examples, assume that we are on Eastern Standard Time
and the current local time is 19:34:02 on 25 June 2000:</p>
<pre class="literal-block">
&gt;&gt;&gt; Date(&quot;.&quot;)
&lt;Date 2000-06-26.00:34:02&gt;
&gt;&gt;&gt; _.local(-5)
&quot;2000-06-25.19:34:02&quot;
&gt;&gt;&gt; Date(&quot;. + 2d&quot;)
&lt;Date 2000-06-28.00:34:02&gt;
&gt;&gt;&gt; Date(&quot;1997-04-17&quot;, -5)
&lt;Date 1997-04-17.00:00:00&gt;
&gt;&gt;&gt; Date(&quot;01-25&quot;, -5)
&lt;Date 2000-01-25.00:00:00&gt;
&gt;&gt;&gt; Date(&quot;08-13.22:13&quot;, -5)
&lt;Date 2000-08-14.03:13:00&gt;
&gt;&gt;&gt; Date(&quot;14:25&quot;, -5)
&lt;Date 2000-06-25.19:25:00&gt;
&gt;&gt;&gt; Interval(&quot;  3w  1  d  2:00&quot;)
&lt;Interval 22d 2:00&gt;
&gt;&gt;&gt; Date(&quot;. + 2d&quot;) - Interval(&quot;3w&quot;)
&lt;Date 2000-06-07.00:34:02&gt;
</pre>
</div>
<div class="section">
<h2><a class="toc-backref" href="#id6" id="items-and-classes" name="items-and-classes">Items and Classes</a></h2>
<p>Items contain data in properties.  To Python, these properties are
presented as the key-value pairs of a dictionary. Each item belongs to a
class which defines the names and types of its properties.  The database
permits the creation and modification of classes as well as items.</p>
</div>
<div class="section">
<h2><a class="toc-backref" href="#id7" id="identifiers-and-designators" name="identifiers-and-designators">Identifiers and Designators</a></h2>
<p>Each item has a numeric identifier which is unique among items in its
class.  The items are numbered sequentially within each class in order
of creation, starting from 1. The designator for an item is a way to
identify an item in the database, and consists of the name of the item's
class concatenated with the item's numeric identifier.</p>
<p>For example, if &quot;spam&quot; and &quot;eggs&quot; are classes, the first item created in
class &quot;spam&quot; has id 1 and designator &quot;spam1&quot;. The first item created in
class &quot;eggs&quot; also has id 1 but has the distinct designator &quot;eggs1&quot;. Item
designators are conventionally enclosed in square brackets when
mentioned in plain text.  This permits a casual mention of, say,
&quot;[patch37]&quot; in an e-mail message to be turned into an active hyperlink.</p>
</div>
<div class="section">
<h2><a class="toc-backref" href="#id8" id="property-names-and-types" name="property-names-and-types">Property Names and Types</a></h2>
<p>Property names must begin with a letter.</p>
<p>A property may be one of five basic types:</p>
<ul class="simple">
<li>String properties are for storing arbitrary-length strings.</li>
<li>Boolean properties are for storing true/false, or yes/no values.</li>
<li>Number properties are for storing numeric values.</li>
<li>Date properties store date-and-time stamps. Their values are Timestamp
objects.</li>
<li>A Link property refers to a single other item selected from a
specified class.  The class is part of the property; the value is an
integer, the id of the chosen item.</li>
<li>A Multilink property refers to possibly many items in a specified
class.  The value is a list of integers.</li>
</ul>
<p><em>None</em> is also a permitted value for any of these property types.  An
attempt to store None into a Multilink property stores an empty list.</p>
<p>A property that is not specified will return as None from a <em>get</em>
operation.</p>
</div>
<div class="section">
<h2><a class="toc-backref" href="#id9" id="hyperdb-interface-specification" name="hyperdb-interface-specification">Hyperdb Interface Specification</a></h2>
<p>TODO: replace the Interface Specifications with links to the pydoc</p>
<p>The hyperdb module provides property objects to designate the different
kinds of properties.  These objects are used when specifying what
properties belong in classes:</p>
<pre class="literal-block">
class String:
    def __init__(self, indexme='no'):
        &quot;&quot;&quot;An object designating a String property.&quot;&quot;&quot;

class Boolean:
    def __init__(self):
        &quot;&quot;&quot;An object designating a Boolean property.&quot;&quot;&quot;

class Number:
    def __init__(self):
        &quot;&quot;&quot;An object designating a Number property.&quot;&quot;&quot;

class Date:
    def __init__(self):
        &quot;&quot;&quot;An object designating a Date property.&quot;&quot;&quot;

class Link:
    def __init__(self, classname, do_journal='yes'):
        &quot;&quot;&quot;An object designating a Link property that links to
        items in a specified class.

        If the do_journal argument is not 'yes' then changes to
        the property are not journalled in the linked item.
        &quot;&quot;&quot;

class Multilink:
    def __init__(self, classname, do_journal='yes'):
        &quot;&quot;&quot;An object designating a Multilink property that links
        to items in a specified class.

        If the do_journal argument is not 'yes' then changes to
        the property are not journalled in the linked item(s).
        &quot;&quot;&quot;
</pre>
<p>Here is the interface provided by the hyperdatabase:</p>
<pre class="literal-block">
class Database:
    &quot;&quot;&quot;A database for storing records containing flexible data
    types.
    &quot;&quot;&quot;

    def __init__(self, config, journaltag=None):
        &quot;&quot;&quot;Open a hyperdatabase given a specifier to some storage.

        The 'storagelocator' is obtained from config.DATABASE. The
        meaning of 'storagelocator' depends on the particular
        implementation of the hyperdatabase.  It could be a file
        name, a directory path, a socket descriptor for a connection
        to a database over the network, etc.

        The 'journaltag' is a token that will be attached to the
        journal entries for any edits done on the database.  If
        'journaltag' is None, the database is opened in read-only
        mode: the Class.create(), Class.set(), Class.retire(), and
        Class.restore() methods are disabled.
        &quot;&quot;&quot;

    def __getattr__(self, classname):
        &quot;&quot;&quot;A convenient way of calling self.getclass(classname).&quot;&quot;&quot;

    def getclasses(self):
        &quot;&quot;&quot;Return a list of the names of all existing classes.&quot;&quot;&quot;

    def getclass(self, classname):
        &quot;&quot;&quot;Get the Class object representing a particular class.

        If 'classname' is not a valid class name, a KeyError is
        raised.
        &quot;&quot;&quot;

class Class:
    &quot;&quot;&quot;The handle to a particular class of items in a hyperdatabase.
    &quot;&quot;&quot;

    def __init__(self, db, classname, **properties):
        &quot;&quot;&quot;Create a new class with a given name and property
        specification.

        'classname' must not collide with the name of an existing
        class, or a ValueError is raised.  The keyword arguments in
        'properties' must map names to property objects, or a
        TypeError is raised.

        A proxied reference to the database is available as the
        'db' attribute on instances. For example, in
        'IssueClass.send_message', the following is used to lookup
        users, messages and files::

            users = self.db.user
            messages = self.db.msg
            files = self.db.file
        &quot;&quot;&quot;

    # Editing items:

    def create(self, **propvalues):
        &quot;&quot;&quot;Create a new item of this class and return its id.

        The keyword arguments in 'propvalues' map property names to
        values. The values of arguments must be acceptable for the
        types of their corresponding properties or a TypeError is
        raised.  If this class has a key property, it must be
        present and its value must not collide with other key
        strings or a ValueError is raised.  Any other properties on
        this class that are missing from the 'propvalues' dictionary
        are set to None.  If an id in a link or multilink property
        does not refer to a valid item, an IndexError is raised.
        &quot;&quot;&quot;

    def get(self, itemid, propname):
        &quot;&quot;&quot;Get the value of a property on an existing item of this
        class.

        'itemid' must be the id of an existing item of this class or
        an IndexError is raised.  'propname' must be the name of a
        property of this class or a KeyError is raised.
        &quot;&quot;&quot;

    def set(self, itemid, **propvalues):
        &quot;&quot;&quot;Modify a property on an existing item of this class.

        'itemid' must be the id of an existing item of this class or
        an IndexError is raised.  Each key in 'propvalues' must be
        the name of a property of this class or a KeyError is
        raised.  All values in 'propvalues' must be acceptable types
        for their corresponding properties or a TypeError is raised.
        If the value of the key property is set, it must not collide
        with other key strings or a ValueError is raised.  If the
        value of a Link or Multilink property contains an invalid
        item id, a ValueError is raised.
        &quot;&quot;&quot;

    def retire(self, itemid):
        &quot;&quot;&quot;Retire an item.

        The properties on the item remain available from the get()
        method, and the item's id is never reused.  Retired items
        are not returned by the find(), list(), or lookup() methods,
        and other items may reuse the values of their key
        properties.
        &quot;&quot;&quot;

    def restore(self, nodeid):
    '''Restore a retired node.

    Make node available for all operations like it was before
    retirement.
    '''

    def history(self, itemid):
        &quot;&quot;&quot;Retrieve the journal of edits on a particular item.

        'itemid' must be the id of an existing item of this class or
        an IndexError is raised.

        The returned list contains tuples of the form

            (date, tag, action, params)

        'date' is a Timestamp object specifying the time of the
        change and 'tag' is the journaltag specified when the
        database was opened. 'action' may be:

            'create' or 'set' -- 'params' is a dictionary of
                property values
            'link' or 'unlink' -- 'params' is (classname, itemid,
                propname)
            'retire' -- 'params' is None
        &quot;&quot;&quot;

    # Locating items:

    def setkey(self, propname):
        &quot;&quot;&quot;Select a String property of this class to be the key
        property.

        'propname' must be the name of a String property of this
        class or None, or a TypeError is raised.  The values of the
        key property on all existing items must be unique or a
        ValueError is raised.
        &quot;&quot;&quot;

    def getkey(self):
        &quot;&quot;&quot;Return the name of the key property for this class or
        None.
        &quot;&quot;&quot;

    def lookup(self, keyvalue):
        &quot;&quot;&quot;Locate a particular item by its key property and return
        its id.

        If this class has no key property, a TypeError is raised.
        If the 'keyvalue' matches one of the values for the key
        property among the items in this class, the matching item's
        id is returned; otherwise a KeyError is raised.
        &quot;&quot;&quot;

    def find(self, **propspec):
        &quot;&quot;&quot;Get the ids of items in this class which link to the
        given items.

        'propspec' consists of keyword args propname=itemid or
                   propname={&lt;itemid 1&gt;:1, &lt;itemid 2&gt;: 1, ...}
        'propname' must be the name of a property in this class,
                   or a KeyError is raised.  That property must
                   be a Link or Multilink property, or a TypeError
                   is raised.

        Any item in this class whose 'propname' property links to
        any of the itemids will be returned. Examples::

            db.issue.find(messages='1')
            db.issue.find(messages={'1':1,'3':1}, files={'7':1})
        &quot;&quot;&quot;

    def filter(self, search_matches, filterspec, sort, group):
        &quot;&quot;&quot;Return a list of the ids of the active nodes in this class that
        match the 'filter' spec, sorted by the group spec and then the
        sort spec.

        &quot;filterspec&quot; is {propname: value(s)}

        &quot;sort&quot; and &quot;group&quot; are [(dir, prop), ...] where dir is '+', '-'
        or None and prop is a prop name or None. Note that for
        backward-compatibility reasons a single (dir, prop) tuple is
        also allowed.

        &quot;search_matches&quot; is {nodeid: marker}

        The filter must match all properties specificed. If the property
        value to match is a list:

        1. String properties must match all elements in the list, and
        2. Other properties must match any of the elements in the list.

        The propname in filterspec and prop in a sort/group spec may be
        transitive, i.e., it may contain properties of the form
        link.link.link.name, e.g. you can search for all issues where
        a message was added by a certain user in the last week with a
        filterspec of
        {'messages.author' : '42', 'messages.creation' : '.-1w;'}
        &quot;&quot;&quot;

    def list(self):
        &quot;&quot;&quot;Return a list of the ids of the active items in this
        class.
        &quot;&quot;&quot;

    def count(self):
        &quot;&quot;&quot;Get the number of items in this class.

        If the returned integer is 'numitems', the ids of all the
        items in this class run from 1 to numitems, and numitems+1
        will be the id of the next item to be created in this class.
        &quot;&quot;&quot;

    # Manipulating properties:

    def getprops(self):
        &quot;&quot;&quot;Return a dictionary mapping property names to property
        objects.
        &quot;&quot;&quot;

    def addprop(self, **properties):
        &quot;&quot;&quot;Add properties to this class.

        The keyword arguments in 'properties' must map names to
        property objects, or a TypeError is raised.  None of the
        keys in 'properties' may collide with the names of existing
        properties, or a ValueError is raised before any properties
        have been added.
        &quot;&quot;&quot;

    def getitem(self, itemid, cache=1):
        &quot;&quot;&quot; Return a Item convenience wrapper for the item.

        'itemid' must be the id of an existing item of this class or
        an IndexError is raised.

        'cache' indicates whether the transaction cache should be
        queried for the item. If the item has been modified and you
        need to determine what its values prior to modification are,
        you need to set cache=0.
        &quot;&quot;&quot;

class Item:
    &quot;&quot;&quot; A convenience wrapper for the given item. It provides a
    mapping interface to a single item's properties
    &quot;&quot;&quot;
</pre>
</div>
<div class="section">
<h2><a class="toc-backref" href="#id10" id="hyperdatabase-implementations" name="hyperdatabase-implementations">Hyperdatabase Implementations</a></h2>
<p>Hyperdatabase implementations exist to create the interface described in
the <a class="reference" href="#hyperdb-interface-specification">hyperdb interface specification</a> over an existing storage
mechanism. Examples are relational databases, *dbm key-value databases,
and so on.</p>
<p>Several implementations are provided - they belong in the
<tt class="docutils literal"><span class="pre">roundup.backends</span></tt> package.</p>
</div>
<div class="section">
<h2><a class="toc-backref" href="#id11" id="application-example" name="application-example">Application Example</a></h2>
<p>Here is an example of how the hyperdatabase module would work in
practice:</p>
<pre class="literal-block">
&gt;&gt;&gt; import hyperdb
&gt;&gt;&gt; db = hyperdb.Database(&quot;foo.db&quot;, &quot;ping&quot;)
&gt;&gt;&gt; db
&lt;hyperdb.Database &quot;foo.db&quot; opened by &quot;ping&quot;&gt;
&gt;&gt;&gt; hyperdb.Class(db, &quot;status&quot;, name=hyperdb.String())
&lt;hyperdb.Class &quot;status&quot;&gt;
&gt;&gt;&gt; _.setkey(&quot;name&quot;)
&gt;&gt;&gt; db.status.create(name=&quot;unread&quot;)
1
&gt;&gt;&gt; db.status.create(name=&quot;in-progress&quot;)
2
&gt;&gt;&gt; db.status.create(name=&quot;testing&quot;)
3
&gt;&gt;&gt; db.status.create(name=&quot;resolved&quot;)
4
&gt;&gt;&gt; db.status.count()
4
&gt;&gt;&gt; db.status.list()
[1, 2, 3, 4]
&gt;&gt;&gt; db.status.lookup(&quot;in-progress&quot;)
2
&gt;&gt;&gt; db.status.retire(3)
&gt;&gt;&gt; db.status.list()
[1, 2, 4]
&gt;&gt;&gt; hyperdb.Class(db, &quot;issue&quot;, title=hyperdb.String(), status=hyperdb.Link(&quot;status&quot;))
&lt;hyperdb.Class &quot;issue&quot;&gt;
&gt;&gt;&gt; db.issue.create(title=&quot;spam&quot;, status=1)
1
&gt;&gt;&gt; db.issue.create(title=&quot;eggs&quot;, status=2)
2
&gt;&gt;&gt; db.issue.create(title=&quot;ham&quot;, status=4)
3
&gt;&gt;&gt; db.issue.create(title=&quot;arguments&quot;, status=2)
4
&gt;&gt;&gt; db.issue.create(title=&quot;abuse&quot;, status=1)
5
&gt;&gt;&gt; hyperdb.Class(db, &quot;user&quot;, username=hyperdb.Key(),
... password=hyperdb.String())
&lt;hyperdb.Class &quot;user&quot;&gt;
&gt;&gt;&gt; db.issue.addprop(fixer=hyperdb.Link(&quot;user&quot;))
&gt;&gt;&gt; db.issue.getprops()
{&quot;title&quot;: &lt;hyperdb.String&gt;, &quot;status&quot;: &lt;hyperdb.Link to &quot;status&quot;&gt;,
 &quot;user&quot;: &lt;hyperdb.Link to &quot;user&quot;&gt;}
&gt;&gt;&gt; db.issue.set(5, status=2)
&gt;&gt;&gt; db.issue.get(5, &quot;status&quot;)
2
&gt;&gt;&gt; db.status.get(2, &quot;name&quot;)
&quot;in-progress&quot;
&gt;&gt;&gt; db.issue.get(5, &quot;title&quot;)
&quot;abuse&quot;
&gt;&gt;&gt; db.issue.find(&quot;status&quot;, db.status.lookup(&quot;in-progress&quot;))
[2, 4, 5]
&gt;&gt;&gt; db.issue.history(5)
[(&lt;Date 2000-06-28.19:09:43&gt;, &quot;ping&quot;, &quot;create&quot;, {&quot;title&quot;: &quot;abuse&quot;,
&quot;status&quot;: 1}),
 (&lt;Date 2000-06-28.19:11:04&gt;, &quot;ping&quot;, &quot;set&quot;, {&quot;status&quot;: 2})]
&gt;&gt;&gt; db.status.history(1)
[(&lt;Date 2000-06-28.19:09:43&gt;, &quot;ping&quot;, &quot;link&quot;, (&quot;issue&quot;, 5, &quot;status&quot;)),
 (&lt;Date 2000-06-28.19:11:04&gt;, &quot;ping&quot;, &quot;unlink&quot;, (&quot;issue&quot;, 5, &quot;status&quot;))]
&gt;&gt;&gt; db.status.history(2)
[(&lt;Date 2000-06-28.19:11:04&gt;, &quot;ping&quot;, &quot;link&quot;, (&quot;issue&quot;, 5, &quot;status&quot;))]
</pre>
<p>For the purposes of journalling, when a Multilink property is set to a
new list of items, the hyperdatabase compares the old list to the new
list. The journal records &quot;unlink&quot; events for all the items that appear
in the old list but not the new list, and &quot;link&quot; events for all the
items that appear in the new list but not in the old list.</p>
</div>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id12" id="roundup-database" name="roundup-database">Roundup Database</a></h1>
<p>The Roundup database layer is implemented on top of the hyperdatabase
and mediates calls to the database. Some of the classes in the Roundup
database are considered issue classes. The Roundup database layer adds
detectors and user items, and on issues it provides mail spools, nosy
lists, and superseders.</p>
<div class="section">
<h2><a class="toc-backref" href="#id13" id="reserved-classes" name="reserved-classes">Reserved Classes</a></h2>
<p>Internal to this layer we reserve three special classes of items that
are not issues.</p>
<div class="section">
<h3><a class="toc-backref" href="#id14" id="users" name="users">Users</a></h3>
<p>Users are stored in the hyperdatabase as items of class &quot;user&quot;.  The
&quot;user&quot; class has the definition:</p>
<pre class="literal-block">
hyperdb.Class(db, &quot;user&quot;, username=hyperdb.String(),
                          password=hyperdb.String(),
                          address=hyperdb.String())
db.user.setkey(&quot;username&quot;)
</pre>
</div>
<div class="section">
<h3><a class="toc-backref" href="#id15" id="messages" name="messages">Messages</a></h3>
<p>E-mail messages are represented by hyperdatabase items of class &quot;msg&quot;.
The actual text content of the messages is stored in separate files.
(There's no advantage to be gained by stuffing them into the
hyperdatabase, and if messages are stored in ordinary text files, they
can be grepped from the command line.)  The text of a message is saved
in a file named after the message item designator (e.g. &quot;msg23&quot;) for the
sake of the command interface (see below).  Attachments are stored
separately and associated with &quot;file&quot; items. The &quot;msg&quot; class has the
definition:</p>
<pre class="literal-block">
hyperdb.Class(db, &quot;msg&quot;, author=hyperdb.Link(&quot;user&quot;),
                         recipients=hyperdb.Multilink(&quot;user&quot;),
                         date=hyperdb.Date(),
                         summary=hyperdb.String(),
                         files=hyperdb.Multilink(&quot;file&quot;))
</pre>
<p>The &quot;author&quot; property indicates the author of the message (a &quot;user&quot; item
must exist in the hyperdatabase for any messages that are stored in the
system). The &quot;summary&quot; property contains a summary of the message for
display in a message index.</p>
</div>
<div class="section">
<h3><a class="toc-backref" href="#id16" id="files" name="files">Files</a></h3>
<p>Submitted files are represented by hyperdatabase items of class &quot;file&quot;.
Like e-mail messages, the file content is stored in files outside the
database, named after the file item designator (e.g. &quot;file17&quot;). The
&quot;file&quot; class has the definition:</p>
<pre class="literal-block">
hyperdb.Class(db, &quot;file&quot;, user=hyperdb.Link(&quot;user&quot;),
                          name=hyperdb.String(),
                          type=hyperdb.String())
</pre>
<p>The &quot;user&quot; property indicates the user who submitted the file, the
&quot;name&quot; property holds the original name of the file, and the &quot;type&quot;
property holds the MIME type of the file as received.</p>
</div>
</div>
<div class="section">
<h2><a class="toc-backref" href="#id17" id="issue-classes" name="issue-classes">Issue Classes</a></h2>
<p>All issues have the following standard properties:</p>
<table border="1" class="docutils">
<colgroup>
<col width="30%" />
<col width="70%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">Property</th>
<th class="head">Definition</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>title</td>
<td>hyperdb.String()</td>
</tr>
<tr><td>messages</td>
<td>hyperdb.Multilink(&quot;msg&quot;)</td>
</tr>
<tr><td>files</td>
<td>hyperdb.Multilink(&quot;file&quot;)</td>
</tr>
<tr><td>nosy</td>
<td>hyperdb.Multilink(&quot;user&quot;)</td>
</tr>
<tr><td>superseder</td>
<td>hyperdb.Multilink(&quot;issue&quot;)</td>
</tr>
</tbody>
</table>
<p>Also, two Date properties named &quot;creation&quot; and &quot;activity&quot; are fabricated
by the Roundup database layer. Two user Link properties, &quot;creator&quot; and
&quot;actor&quot; are also fabricated. By &quot;fabricated&quot; we mean that no such
properties are actually stored in the hyperdatabase, but when properties
on issues are requested, the &quot;creation&quot;/&quot;creator&quot; and &quot;activity&quot;/&quot;actor&quot;
properties are made available. The value of the &quot;creation&quot;/&quot;creator&quot;
properties relate to issue creation, and the value of the &quot;activity&quot;/
&quot;actor&quot; properties relate to the last editing of any property on the issue
(equivalently, these are the dates on the first and last records in the
issue's journal).</p>
</div>
<div class="section">
<h2><a class="toc-backref" href="#id18" id="roundupdb-interface-specification" name="roundupdb-interface-specification">Roundupdb Interface Specification</a></h2>
<p>The interface to a Roundup database delegates most method calls to the
hyperdatabase, except for the following changes and additional methods:</p>
<pre class="literal-block">
class Database:
    def getuid(self):
        &quot;&quot;&quot;Return the id of the &quot;user&quot; item associated with the user
        that owns this connection to the hyperdatabase.&quot;&quot;&quot;

class Class:
    # Overridden methods:

    def create(self, **propvalues):
    def set(self, **propvalues):
    def retire(self, itemid):
        &quot;&quot;&quot;These operations trigger detectors and can be vetoed.
        Attempts to modify the &quot;creation&quot;, &quot;creator&quot;, &quot;activity&quot;
        properties or &quot;actor&quot; cause a KeyError.
        &quot;&quot;&quot;

class IssueClass(Class):
    # Overridden methods:

    def __init__(self, db, classname, **properties):
        &quot;&quot;&quot;The newly-created class automatically includes the
        &quot;messages&quot;, &quot;files&quot;, &quot;nosy&quot;, and &quot;superseder&quot; properties.
        If the 'properties' dictionary attempts to specify any of
        these properties or a &quot;creation&quot;, &quot;creator&quot;, &quot;activity&quot; or
        &quot;actor&quot; property, a ValueError is raised.&quot;&quot;&quot;

    def get(self, itemid, propname):
    def getprops(self):
        &quot;&quot;&quot;In addition to the actual properties on the item, these
        methods provide the &quot;creation&quot;, &quot;creator&quot;, &quot;activity&quot; and
        &quot;actor&quot; properties.&quot;&quot;&quot;

    # New methods:

    def addmessage(self, itemid, summary, text):
        &quot;&quot;&quot;Add a message to an issue's mail spool.

        A new &quot;msg&quot; item is constructed using the current date, the
        user that owns the database connection as the author, and
        the specified summary text.  The &quot;files&quot; and &quot;recipients&quot;
        fields are left empty.  The given text is saved as the body
        of the message and the item is appended to the &quot;messages&quot;
        field of the specified issue.
        &quot;&quot;&quot;

    def nosymessage(self, itemid, msgid):
        &quot;&quot;&quot;Send a message to the members of an issue's nosy list.

        The message is sent only to users on the nosy list who are
        not already on the &quot;recipients&quot; list for the message.  These
        users are then added to the message's &quot;recipients&quot; list.
        &quot;&quot;&quot;
</pre>
</div>
<div class="section">
<h2><a class="toc-backref" href="#id19" id="default-schema" name="default-schema">Default Schema</a></h2>
<p>The default schema included with Roundup turns it into a typical
software bug tracker.  The database is set up like this:</p>
<pre class="literal-block">
pri = Class(db, &quot;priority&quot;, name=hyperdb.String(),
            order=hyperdb.String())
pri.setkey(&quot;name&quot;)
pri.create(name=&quot;critical&quot;, order=&quot;1&quot;)
pri.create(name=&quot;urgent&quot;, order=&quot;2&quot;)
pri.create(name=&quot;bug&quot;, order=&quot;3&quot;)
pri.create(name=&quot;feature&quot;, order=&quot;4&quot;)
pri.create(name=&quot;wish&quot;, order=&quot;5&quot;)

stat = Class(db, &quot;status&quot;, name=hyperdb.String(),
             order=hyperdb.String())
stat.setkey(&quot;name&quot;)
stat.create(name=&quot;unread&quot;, order=&quot;1&quot;)
stat.create(name=&quot;deferred&quot;, order=&quot;2&quot;)
stat.create(name=&quot;chatting&quot;, order=&quot;3&quot;)
stat.create(name=&quot;need-eg&quot;, order=&quot;4&quot;)
stat.create(name=&quot;in-progress&quot;, order=&quot;5&quot;)
stat.create(name=&quot;testing&quot;, order=&quot;6&quot;)
stat.create(name=&quot;done-cbb&quot;, order=&quot;7&quot;)
stat.create(name=&quot;resolved&quot;, order=&quot;8&quot;)

Class(db, &quot;keyword&quot;, name=hyperdb.String())

Class(db, &quot;issue&quot;, fixer=hyperdb.Multilink(&quot;user&quot;),
                   topic=hyperdb.Multilink(&quot;keyword&quot;),
                   priority=hyperdb.Link(&quot;priority&quot;),
                   status=hyperdb.Link(&quot;status&quot;))
</pre>
<p>(The &quot;order&quot; property hasn't been explained yet.  It gets used by the
Web user interface for sorting.)</p>
<p>The above isn't as pretty-looking as the schema specification in the
first-stage submission, but it could be made just as easy with the
addition of a convenience function like Choice for setting up the
&quot;priority&quot; and &quot;status&quot; classes:</p>
<pre class="literal-block">
def Choice(name, *options):
    cl = Class(db, name, name=hyperdb.String(),
               order=hyperdb.String())
    for i in range(len(options)):
        cl.create(name=option[i], order=i)
    return hyperdb.Link(name)
</pre>
</div>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id20" id="detector-interface" name="detector-interface">Detector Interface</a></h1>
<p>Detectors are Python functions that are triggered on certain kinds of
events.  The definitions of the functions live in Python modules placed
in a directory set aside for this purpose.  Importing the Roundup
database module also imports all the modules in this directory, and the
<tt class="docutils literal"><span class="pre">init()</span></tt> function of each module is called when a database is opened
to provide it a chance to register its detectors.</p>
<p>There are two kinds of detectors:</p>
<ol class="arabic simple">
<li>an auditor is triggered just before modifying an item</li>
<li>a reactor is triggered just after an item has been modified</li>
</ol>
<p>When the Roundup database is about to perform a <tt class="docutils literal"><span class="pre">create()</span></tt>, <tt class="docutils literal"><span class="pre">set()</span></tt>,
<tt class="docutils literal"><span class="pre">retire()</span></tt>, or <tt class="docutils literal"><span class="pre">restore</span></tt> operation, it first calls any <em>auditors</em>
that have been registered for that operation on that class. Any auditor
may raise a <em>Reject</em> exception to abort the operation.</p>
<p>If none of the auditors raises an exception, the database proceeds to
carry out the operation.  After it's done, it then calls all of the
<em>reactors</em> that have been registered for the operation.</p>
<div class="section">
<h2><a class="toc-backref" href="#id21" id="detector-interface-specification" name="detector-interface-specification">Detector Interface Specification</a></h2>
<p>The <tt class="docutils literal"><span class="pre">audit()</span></tt> and <tt class="docutils literal"><span class="pre">react()</span></tt> methods register detectors on a given
class of items:</p>
<pre class="literal-block">
class Class:
    def audit(self, event, detector, priority=100):
        &quot;&quot;&quot;Register an auditor on this class.

        'event' should be one of &quot;create&quot;, &quot;set&quot;, &quot;retire&quot;, or
        &quot;restore&quot;. 'detector' should be a function accepting four
        arguments. Detectors are called in priority order, execution
        order is undefined for detectors with the same priority.
        &quot;&quot;&quot;

    def react(self, event, detector, priority=100):
        &quot;&quot;&quot;Register a reactor on this class.

        'event' should be one of &quot;create&quot;, &quot;set&quot;, &quot;retire&quot;, or
        &quot;restore&quot;. 'detector' should be a function accepting four
        arguments. Detectors are called in priority order, execution
        order is undefined for detectors with the same priority.
        &quot;&quot;&quot;
</pre>
<p>Auditors are called with the arguments:</p>
<pre class="literal-block">
audit(db, cl, itemid, newdata)
</pre>
<p>where <tt class="docutils literal"><span class="pre">db</span></tt> is the database, <tt class="docutils literal"><span class="pre">cl</span></tt> is an instance of Class or
IssueClass within the database, and <tt class="docutils literal"><span class="pre">newdata</span></tt> is a dictionary mapping
property names to values.</p>
<p>For a <tt class="docutils literal"><span class="pre">create()</span></tt> operation, the <tt class="docutils literal"><span class="pre">itemid</span></tt> argument is None and
newdata contains all of the initial property values with which the item
is about to be created.</p>
<p>For a <tt class="docutils literal"><span class="pre">set()</span></tt> operation, newdata contains only the names and values of
properties that are about to be changed.</p>
<p>For a <tt class="docutils literal"><span class="pre">retire()</span></tt> or <tt class="docutils literal"><span class="pre">restore()</span></tt> operation, newdata is None.</p>
<p>Reactors are called with the arguments:</p>
<pre class="literal-block">
react(db, cl, itemid, olddata)
</pre>
<p>where <tt class="docutils literal"><span class="pre">db</span></tt> is the database, <tt class="docutils literal"><span class="pre">cl</span></tt> is an instance of Class or
IssueClass within the database, and <tt class="docutils literal"><span class="pre">olddata</span></tt> is a dictionary mapping
property names to values.</p>
<p>For a <tt class="docutils literal"><span class="pre">create()</span></tt> operation, the <tt class="docutils literal"><span class="pre">itemid</span></tt> argument is the id of the
newly-created item and <tt class="docutils literal"><span class="pre">olddata</span></tt> is None.</p>
<p>For a <tt class="docutils literal"><span class="pre">set()</span></tt> operation, <tt class="docutils literal"><span class="pre">olddata</span></tt> contains the names and previous
values of properties that were changed.</p>
<p>For a <tt class="docutils literal"><span class="pre">retire()</span></tt> or <tt class="docutils literal"><span class="pre">restore()</span></tt> operation, <tt class="docutils literal"><span class="pre">itemid</span></tt> is the id of
the retired or restored item and <tt class="docutils literal"><span class="pre">olddata</span></tt> is None.</p>
</div>
<div class="section">
<h2><a class="toc-backref" href="#id22" id="detector-example" name="detector-example">Detector Example</a></h2>
<p>Here is an example of detectors written for a hypothetical
project-management application, where users can signal approval of a
project by adding themselves to an &quot;approvals&quot; list, and a project
proceeds when it has three approvals:</p>
<pre class="literal-block">
# Permit users only to add themselves to the &quot;approvals&quot; list.

def check_approvals(db, cl, id, newdata):
    if newdata.has_key(&quot;approvals&quot;):
        if cl.get(id, &quot;status&quot;) == db.status.lookup(&quot;approved&quot;):
            raise Reject, &quot;You can't modify the approvals list &quot; \
                &quot;for a project that has already been approved.&quot;
        old = cl.get(id, &quot;approvals&quot;)
        new = newdata[&quot;approvals&quot;]
        for uid in old:
            if uid not in new and uid != db.getuid():
                raise Reject, &quot;You can't remove other users from &quot; \
                    &quot;the approvals list; you can only remove &quot; \
                    &quot;yourself.&quot;
        for uid in new:
            if uid not in old and uid != db.getuid():
                raise Reject, &quot;You can't add other users to the &quot; \
                    &quot;approvals list; you can only add yourself.&quot;

# When three people have approved a project, change its status from
# &quot;pending&quot; to &quot;approved&quot;.

def approve_project(db, cl, id, olddata):
    if (olddata.has_key(&quot;approvals&quot;) and
        len(cl.get(id, &quot;approvals&quot;)) == 3):
        if cl.get(id, &quot;status&quot;) == db.status.lookup(&quot;pending&quot;):
            cl.set(id, status=db.status.lookup(&quot;approved&quot;))

def init(db):
    db.project.audit(&quot;set&quot;, check_approval)
    db.project.react(&quot;set&quot;, approve_project)
</pre>
<p>Here is another example of a detector that can allow or prevent the
creation of new items.  In this scenario, patches for a software project
are submitted by sending in e-mail with an attached file, and we want to
ensure that there are text/plain attachments on the message.  The
maintainer of the package can then apply the patch by setting its status
to &quot;applied&quot;:</p>
<pre class="literal-block">
# Only accept attempts to create new patches that come with patch
# files.

def check_new_patch(db, cl, id, newdata):
    if not newdata[&quot;files&quot;]:
        raise Reject, &quot;You can't submit a new patch without &quot; \
                      &quot;attaching a patch file.&quot;
    for fileid in newdata[&quot;files&quot;]:
        if db.file.get(fileid, &quot;type&quot;) != &quot;text/plain&quot;:
            raise Reject, &quot;Submitted patch files must be &quot; \
                          &quot;text/plain.&quot;

# When the status is changed from &quot;approved&quot; to &quot;applied&quot;, apply the
# patch.

def apply_patch(db, cl, id, olddata):
    if (cl.get(id, &quot;status&quot;) == db.status.lookup(&quot;applied&quot;) and
        olddata[&quot;status&quot;] == db.status.lookup(&quot;approved&quot;)):
        # ...apply the patch...

def init(db):
    db.patch.audit(&quot;create&quot;, check_new_patch)
    db.patch.react(&quot;set&quot;, apply_patch)
</pre>
</div>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id23" id="command-interface" name="command-interface">Command Interface</a></h1>
<p>The command interface is a very simple and minimal interface, intended
only for quick searches and checks from the shell prompt. (Anything more
interesting can simply be written in Python using the Roundup database
module.)</p>
<div class="section">
<h2><a class="toc-backref" href="#id24" id="command-interface-specification" name="command-interface-specification">Command Interface Specification</a></h2>
<p>A single command, roundup, provides basic access to the hyperdatabase
from the command line:</p>
<pre class="literal-block">
roundup-admin help
roundup-admin get [-list] designator[, designator,...] propname
roundup-admin set designator[, designator,...] propname=value ...
roundup-admin find [-list] classname propname=value ...
</pre>
<p>See <tt class="docutils literal"><span class="pre">roundup-admin</span> <span class="pre">help</span> <span class="pre">commands</span></tt> for a complete list of commands.</p>
<p>Property values are represented as strings in command arguments and in
the printed results:</p>
<ul class="simple">
<li>Strings are, well, strings.</li>
<li>Numbers are displayed the same as strings.</li>
<li>Booleans are displayed as 'Yes' or 'No'.</li>
<li>Date values are printed in the full date format in the local time
zone, and accepted in the full format or any of the partial formats
explained above.</li>
<li>Link values are printed as item designators.  When given as an
argument, item designators and key strings are both accepted.</li>
<li>Multilink values are printed as lists of item designators joined by
commas.  When given as an argument, item designators and key strings
are both accepted; an empty string, a single item, or a list of items
joined by commas is accepted.</li>
</ul>
<p>When multiple items are specified to the roundup get or roundup set
commands, the specified properties are retrieved or set on all the
listed items.</p>
<p>When multiple results are returned by the roundup get or roundup find
commands, they are printed one per line (default) or joined by commas
(with the -list) option.</p>
</div>
<div class="section">
<h2><a class="toc-backref" href="#id25" id="usage-example" name="usage-example">Usage Example</a></h2>
<p>To find all messages regarding in-progress issues that contain the word
&quot;spam&quot;, for example, you could execute the following command from the
directory where the database dumps its files:</p>
<pre class="literal-block">
shell% for issue in `roundup find issue status=in-progress`; do
&gt; grep -l spam `roundup get $issue messages`
&gt; done
msg23
msg49
msg50
msg61
shell%
</pre>
<p>Or, using the -list option, this can be written as a single command:</p>
<pre class="literal-block">
shell% grep -l spam `roundup get \
    \`roundup find -list issue status=in-progress\` messages`
msg23
msg49
msg50
msg61
shell%
</pre>
</div>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id26" id="e-mail-user-interface" name="e-mail-user-interface">E-mail User Interface</a></h1>
<p>The Roundup system must be assigned an e-mail address at which to
receive mail.  Messages should be piped to the Roundup mail-handling
script by the mail delivery system (e.g. using an alias beginning with
&quot;|&quot; for sendmail).</p>
<div class="section">
<h2><a class="toc-backref" href="#id27" id="message-processing" name="message-processing">Message Processing</a></h2>
<p>Incoming messages are examined for multiple parts. In a multipart/mixed
message or part, each subpart is extracted and examined.  In a
multipart/alternative message or part, we look for a text/plain subpart
and ignore the other parts.  The text/plain subparts are assembled to
form the textual body of the message, to be stored in the file
associated with a &quot;msg&quot; class item. Any parts of other types are each
stored in separate files and given &quot;file&quot; class items that are linked to
the &quot;msg&quot; item.</p>
<p>The &quot;summary&quot; property on message items is taken from the first
non-quoting section in the message body. The message body is divided
into sections by blank lines. Sections where the second and all
subsequent lines begin with a &quot;&gt;&quot; or &quot;|&quot; character are considered
&quot;quoting sections&quot;.  The first line of the first non-quoting section
becomes the summary of the message.</p>
<p>All of the addresses in the To: and Cc: headers of the incoming message
are looked up among the user items, and the corresponding users are
placed in the &quot;recipients&quot; property on the new &quot;msg&quot; item.  The address
in the From: header similarly determines the &quot;author&quot; property of the
new &quot;msg&quot; item. The default handling for addresses that don't have
corresponding users is to create new users with no passwords and a
username equal to the address.  (The web interface does not permit
logins for users with no passwords.)  If we prefer to reject mail from
outside sources, we can simply register an auditor on the &quot;user&quot; class
that prevents the creation of user items with no passwords.</p>
<p>The subject line of the incoming message is examined to determine
whether the message is an attempt to create a new issue or to discuss an
existing issue.  A designator enclosed in square brackets is sought as
the first thing on the subject line (after skipping any &quot;Fwd:&quot; or &quot;Re:&quot;
prefixes).</p>
<p>If an issue designator (class name and id number) is found there, the
newly created &quot;msg&quot; item is added to the &quot;messages&quot; property for that
issue, and any new &quot;file&quot; items are added to the &quot;files&quot; property for
the issue.</p>
<p>If just an issue class name is found there, we attempt to create a new
issue of that class with its &quot;messages&quot; property initialized to contain
the new &quot;msg&quot; item and its &quot;files&quot; property initialized to contain any
new &quot;file&quot; items.</p>
<p>Both cases may trigger detectors (in the first case we are calling the
set() method to add the message to the issue's spool; in the second case
we are calling the create() method to create a new item).  If an auditor
raises an exception, the original message is bounced back to the sender
with the explanatory message given in the exception.</p>
</div>
<div class="section">
<h2><a class="toc-backref" href="#id28" id="nosy-lists" name="nosy-lists">Nosy Lists</a></h2>
<p>A standard detector is provided that watches for additions to the
&quot;messages&quot; property.  When a new message is added, the detector sends it
to all the users on the &quot;nosy&quot; list for the issue that are not already
on the &quot;recipients&quot; list of the message.  Those users are then appended
to the &quot;recipients&quot; property on the message, so multiple copies of a
message are never sent to the same user.  The journal recorded by the
hyperdatabase on the &quot;recipients&quot; property then provides a log of when
the message was sent to whom.</p>
</div>
<div class="section">
<h2><a class="toc-backref" href="#id29" id="setting-properties" name="setting-properties">Setting Properties</a></h2>
<p>The e-mail interface also provides a simple way to set properties on
issues.  At the end of the subject line, <tt class="docutils literal"><span class="pre">propname=value</span></tt> pairs can be
specified in square brackets, using the same conventions as for the
roundup <tt class="docutils literal"><span class="pre">set</span></tt> shell command.</p>
</div>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id30" id="web-user-interface" name="web-user-interface">Web User Interface</a></h1>
<p>The web interface is provided by a CGI script that can be run under any
web server.  A simple web server can easily be built on the standard
CGIHTTPServer module, and should also be included in the distribution
for quick out-of-the-box deployment.</p>
<p>The user interface is constructed from a number of template files
containing mostly HTML.  Among the HTML tags in templates are
interspersed some nonstandard tags, which we use as placeholders to be
replaced by properties and their values.</p>
<div class="section">
<h2><a class="toc-backref" href="#id31" id="views-and-view-specifiers" name="views-and-view-specifiers">Views and View Specifiers</a></h2>
<p>There are two main kinds of views: <em>index</em> views and <em>issue</em> views. An
index view displays a list of issues of a particular class, optionally
sorted and filtered as requested.  An issue view presents the properties
of a particular issue for editing and displays the message spool for the
issue.</p>
<p>A view specifier is a string that specifies all the options needed to
construct a particular view. It goes after the URL to the Roundup CGI
script or the web server to form the complete URL to a view.  When the
result of selecting a link or submitting a form takes the user to a new
view, the Web browser should be redirected to a canonical location
containing a complete view specifier so that the view can be bookmarked.</p>
</div>
<div class="section">
<h2><a class="toc-backref" href="#id32" id="displaying-properties" name="displaying-properties">Displaying Properties</a></h2>
<p>Properties appear in the user interface in three contexts: in indices,
in editors, and as search filters.  For each type of property, there are
several display possibilities.  For example, in an index view, a string
property may just be printed as a plain string, but in an editor view,
that property should be displayed in an editable field.</p>
<p>The display of a property is handled by functions in the
<tt class="docutils literal"><span class="pre">cgi.templating</span></tt> module.</p>
<p>Displayer functions are triggered by <tt class="docutils literal"><span class="pre">tal:content</span></tt> or <tt class="docutils literal"><span class="pre">tal:replace</span></tt>
tag attributes in templates.  The value of the attribute provides an
expression for calling the displayer function. For example, the
occurrence of:</p>
<pre class="literal-block">
tal:content=&quot;context/status/plain&quot;
</pre>
<p>in a template triggers a call to:</p>
<pre class="literal-block">
context['status'].plain()
</pre>
<p>where the context would be an item of the &quot;issue&quot; class.  The displayer
functions can accept extra arguments to further specify details about
the widgets that should be generated.</p>
<p>Some of the standard displayer functions include:</p>
<table border="1" class="docutils">
<colgroup>
<col width="13%" />
<col width="87%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">Function</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>plain</td>
<td>display a String property directly;
display a Date property in a specified time zone with an
option to omit the time from the date stamp; for a Link or
Multilink property, display the key strings of the linked
items (or the ids if the linked class has no key property)</td>
</tr>
<tr><td>field</td>
<td>display a property like the plain displayer above, but in a
text field to be edited</td>
</tr>
<tr><td>menu</td>
<td>for a Link property, display a menu of the available choices</td>
</tr>
</tbody>
</table>
<p>See the <a class="reference" href="customizing.html">customisation</a> documentation for the complete list.</p>
</div>
<div class="section">
<h2><a class="toc-backref" href="#id33" id="index-views" name="index-views">Index Views</a></h2>
<p>An index view contains two sections: a filter section and an index
section. The filter section provides some widgets for selecting which
issues appear in the index.  The index section is a table of issues.</p>
<div class="section">
<h3><a class="toc-backref" href="#id34" id="index-view-specifiers" name="index-view-specifiers">Index View Specifiers</a></h3>
<p>An index view specifier looks like this (whitespace has been added for
clarity):</p>
<pre class="literal-block">
/issue?status=unread,in-progress,resolved&amp;
    topic=security,ui&amp;
    :group=priority,-status&amp;
    :sort=-activity&amp;
    :filters=status,topic&amp;
    :columns=title,status,fixer
</pre>
<p>The index view is determined by two parts of the specifier: the layout
part and the filter part. The layout part consists of the query
parameters that begin with colons, and it determines the way that the
properties of selected items are displayed. The filter part consists of
all the other query parameters, and it determines the criteria by which
items are selected for display.</p>
<p>The filter part is interactively manipulated with the form widgets
displayed in the filter section.  The layout part is interactively
manipulated by clicking on the column headings in the table.</p>
<p>The filter part selects the union of the sets of issues with values
matching any specified Link properties and the intersection of the sets
of issues with values matching any specified Multilink properties.</p>
<p>The example specifies an index of &quot;issue&quot; items. Only issues with a
&quot;status&quot; of either &quot;unread&quot; or &quot;in-progres&quot; or &quot;resolved&quot; are displayed,
and only issues with &quot;topic&quot; values including both &quot;security&quot; and &quot;ui&quot;
are displayed.  The items are grouped by priority arranged in ascending
order and in descending order by status; and within groups, sorted by
activity, arranged in descending order. The filter section shows
filters for the &quot;status&quot; and &quot;topic&quot; properties, and the table includes
columns for the &quot;title&quot;, &quot;status&quot;, and &quot;fixer&quot; properties.</p>
<p>Associated with each issue class is a default layout specifier.  The
layout specifier in the above example is the default layout to be
provided with the default bug-tracker schema described above in section
4.4.</p>
</div>
<div class="section">
<h3><a class="toc-backref" href="#id35" id="index-section" name="index-section">Index Section</a></h3>
<p>The template for an index section describes one row of the index table.
Fragments protected by a <tt class="docutils literal"><span class="pre">tal:condition=&quot;request/show/&lt;property&gt;&quot;</span></tt> are
included or omitted depending on whether the view specifier requests a
column for a particular property. The table cells are filled by the
<tt class="docutils literal"><span class="pre">tal:content=&quot;context/&lt;property&gt;&quot;</span></tt> directive, which displays the value
of the property.</p>
<p>Here's a simple example of an index template:</p>
<pre class="literal-block">
&lt;tr&gt;
  &lt;td tal:condition=&quot;request/show/title&quot;
      tal:content=&quot;contex/title&quot;&gt;&lt;/td&gt;
  &lt;td tal:condition=&quot;request/show/status&quot;
      tal:content=&quot;contex/status&quot;&gt;&lt;/td&gt;
  &lt;td tal:condition=&quot;request/show/fixer&quot;
      tal:content=&quot;contex/fixer&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;
</pre>
</div>
<div class="section">
<h3><a class="toc-backref" href="#id36" id="sorting" name="sorting">Sorting</a></h3>
<p>String and Date values are sorted in the natural way. Link properties
are sorted according to the value of the &quot;order&quot; property on the linked
items if it is present; or otherwise on the key string of the linked
items; or finally on the item ids.  Multilink properties are sorted
according to how many links are present.</p>
</div>
</div>
<div class="section">
<h2><a class="toc-backref" href="#id37" id="issue-views" name="issue-views">Issue Views</a></h2>
<p>An issue view contains an editor section and a spool section. At the top
of an issue view, links to superseding and superseded issues are always
displayed.</p>
<div class="section">
<h3><a class="toc-backref" href="#id38" id="issue-view-specifiers" name="issue-view-specifiers">Issue View Specifiers</a></h3>
<p>An issue view specifier is simply the issue's designator:</p>
<pre class="literal-block">
/patch23
</pre>
</div>
<div class="section">
<h3><a class="toc-backref" href="#id39" id="editor-section" name="editor-section">Editor Section</a></h3>
<p>The editor section is generated from a template containing
<tt class="docutils literal"><span class="pre">tal:content=&quot;context/&lt;property&gt;/&lt;widget&gt;&quot;</span></tt> directives to insert the
appropriate widgets for editing properties.</p>
<p>Here's an example of a basic editor template:</p>
<pre class="literal-block">
&lt;table&gt;
&lt;tr&gt;
    &lt;td colspan=2
        tal:content=&quot;python:context.title.field(size='60')&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
    &lt;td tal:content=&quot;context/fixer/field&quot;&gt;&lt;/td&gt;
    &lt;td tal:content=&quot;context/status/menu&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
    &lt;td tal:content=&quot;context/nosy/field&quot;&gt;&lt;/td&gt;
    &lt;td tal:content=&quot;context/priority/menu&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
    &lt;td colspan=2&gt;
      &lt;textarea name=&quot;:note&quot; rows=5 cols=60&gt;&lt;/textarea&gt;
    &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
</pre>
<p>As shown in the example, the editor template can also include a &quot;:note&quot;
field, which is a text area for entering a note to go along with a
change.</p>
<p>When a change is submitted, the system automatically generates a message
describing the changed properties. The message displays all of the
property values on the issue and indicates which ones have changed. An
example of such a message might be this:</p>
<pre class="literal-block">
title: Polly Parrot is dead
priority: critical
status: unread -&gt; in-progress
fixer: (none)
keywords: parrot,plumage,perch,nailed,dead
</pre>
<p>If a note is given in the &quot;:note&quot; field, the note is appended to the
description.  The message is then added to the issue's message spool
(thus triggering the standard detector to react by sending out this
message to the nosy list).</p>
</div>
<div class="section">
<h3><a class="toc-backref" href="#id40" id="spool-section" name="spool-section">Spool Section</a></h3>
<p>The spool section lists messages in the issue's &quot;messages&quot; property.
The index of messages displays the &quot;date&quot;, &quot;author&quot;, and &quot;summary&quot;
properties on the message items, and selecting a message takes you to
its content.</p>
</div>
</div>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id41" id="access-control" name="access-control">Access Control</a></h1>
<p>At each point that requires an action to be performed, the security
mechanisms are asked if the current user has permission. This permission
is defined as a Permission.</p>
<p>Individual assignment of Permission to user is unwieldy. The concept of
a Role, which encompasses several Permissions and may be assigned to
many Users, is quite well developed in many projects. Roundup will take
this path, and allow the multiple assignment of Roles to Users, and
multiple Permissions to Roles. These definitions are not persistent -
they're defined when the application initialises.</p>
<p>There will be three levels of Permission. The Class level permissions
define logical permissions associated with all items of a particular
class (or all classes). The Item level permissions define logical
permissions associated with specific items by way of their user-linked
properties. The Property level permissions define logical permissions
associated with a specific property of an item.</p>
<div class="section">
<h2><a class="toc-backref" href="#id42" id="access-control-interface-specification" name="access-control-interface-specification">Access Control Interface Specification</a></h2>
<p>The security module defines:</p>
<pre class="literal-block">
class Permission:
    ''' Defines a Permission with the attributes
        - name
        - description
        - klass (optional)
        - properties (optional)
        - check function (optional)

        The klass may be unset, indicating that this permission is
        not locked to a particular hyperdb class. There may be
        multiple Permissions for the same name for different
        classes.

        If property names are set, permission is restricted to those
        properties only.

        If check function is set, permission is granted only when
        the function returns value interpreted as boolean true.
        The function is called with arguments db, userid, itemid.
    '''

class Role:
    ''' Defines a Role with the attributes
        - name
        - description
        - permissions
    '''

class Security:
    def __init__(self, db):
        ''' Initialise the permission and role stores, and add in
            the base roles (for admin user).
        '''

    def getPermission(self, permission, classname=None, properties=None,
            check=None):
        ''' Find the Permission exactly matching the name, class,
            properties list and check function.

            Raise ValueError if there is no exact match.
        '''

    def hasPermission(self, permission, userid, classname=None,
            property=None, itemid=None):
        ''' Look through all the Roles, and hence Permissions, and
            see if &quot;permission&quot; exists given the constraints of
            classname, property and itemid.

            If classname is specified (and only classname) then the
            search will match if there is *any* Permission for that
            classname, even if the Permission has additional
            constraints.

            If property is specified, the Permission matched must have
            either no properties listed or the property must appear in
            the list.

            If itemid is specified, the Permission matched must have
            either no check function defined or the check function,
            when invoked, must return a True value.

            Note that this functionality is actually implemented by the
            Permission.test() method.
        '''

    def addPermission(self, **propspec):
        ''' Create a new Permission with the properties defined in
            'propspec'. See the Permission class for the possible
            keyword args.
        '''

    def addRole(self, **propspec):
        ''' Create a new Role with the properties defined in
            'propspec'
        '''

    def addPermissionToRole(self, rolename, permission):
        ''' Add the permission to the role's permission list.

            'rolename' is the name of the role to add permission to.
        '''
</pre>
<p>Modules such as <tt class="docutils literal"><span class="pre">cgi/client.py</span></tt> and <tt class="docutils literal"><span class="pre">mailgw.py</span></tt> define their own
permissions like so (this example is <tt class="docutils literal"><span class="pre">cgi/client.py</span></tt>):</p>
<pre class="literal-block">
def initialiseSecurity(security):
    ''' Create some Permissions and Roles on the security object

        This function is directly invoked by
        security.Security.__init__() as a part of the Security
        object instantiation.
    '''
    p = security.addPermission(name=&quot;Web Registration&quot;,
        description=&quot;Anonymous users may register through the web&quot;)
    security.addToRole('Anonymous', p)
</pre>
<p>Detectors may also define roles in their init() function:</p>
<pre class="literal-block">
def init(db):
    # register an auditor that checks that a user has the &quot;May
    # Resolve&quot; Permission before allowing them to set an issue
    # status to &quot;resolved&quot;
    db.issue.audit('set', checkresolvedok)
    p = db.security.addPermission(name=&quot;May Resolve&quot;, klass=&quot;issue&quot;)
    security.addToRole('Manager', p)
</pre>
<p>The tracker dbinit module then has in <tt class="docutils literal"><span class="pre">open()</span></tt>:</p>
<pre class="literal-block">
# open the database - it must be modified to init the Security class
# from security.py as db.security
db = Database(config, name)

# add some extra permissions and associate them with roles
ei = db.security.addPermission(name=&quot;Edit&quot;, klass=&quot;issue&quot;,
                description=&quot;User is allowed to edit issues&quot;)
db.security.addPermissionToRole('User', ei)
ai = db.security.addPermission(name=&quot;View&quot;, klass=&quot;issue&quot;,
                description=&quot;User is allowed to access issues&quot;)
db.security.addPermissionToRole('User', ai)
</pre>
<p>In the dbinit <tt class="docutils literal"><span class="pre">init()</span></tt>:</p>
<pre class="literal-block">
# create the two default users
user.create(username=&quot;admin&quot;, password=Password(adminpw),
            address=config.ADMIN_EMAIL, roles='Admin')
user.create(username=&quot;anonymous&quot;, roles='Anonymous')
</pre>
<p>Then in the code that matters, calls to <tt class="docutils literal"><span class="pre">hasPermission</span></tt> and
<tt class="docutils literal"><span class="pre">hasItemPermission</span></tt> are made to determine if the user has permission
to perform some action:</p>
<pre class="literal-block">
if db.security.hasPermission('issue', 'Edit', userid):
    # all ok

if db.security.hasItemPermission('issue', itemid,
                                 assignedto=userid):
    # all ok
</pre>
<p>Code in the core will make use of these methods, as should code in
auditors in custom templates. The HTML templating may access the access
controls through the <em>user</em> attribute of the <em>request</em> variable. It
exposes a <tt class="docutils literal"><span class="pre">hasPermission()</span></tt> method:</p>
<pre class="literal-block">
tal:condition=&quot;python:request.user.hasPermission('Edit', 'issue')&quot;
</pre>
<p>or, if the <em>context</em> is <em>issue</em>, then the following is the same:</p>
<pre class="literal-block">
tal:condition=&quot;python:request.user.hasPermission('Edit')&quot;
</pre>
</div>
<div class="section">
<h2><a class="toc-backref" href="#id43" id="authentication-of-users" name="authentication-of-users">Authentication of Users</a></h2>
<p>Users must be authenticated correctly for the above controls to work.
This is not done in the current mail gateway at all. Use of digital
signing of messages could alleviate this problem.</p>
<p>The exact mechanism of registering the digital signature should be
flexible, with perhaps a level of trust. Users who supply their
signature through their first message into the tracker should be at a
lower level of trust to those who supply their signature to an admin for
submission to their user details.</p>
</div>
<div class="section">
<h2><a class="toc-backref" href="#id44" id="anonymous-users" name="anonymous-users">Anonymous Users</a></h2>
<p>The &quot;anonymous&quot; user must always exist, and defines the access
permissions for anonymous users. Unknown users accessing Roundup through
the web or email interfaces will be logged in as the &quot;anonymous&quot; user.</p>
</div>
<div class="section">
<h2><a class="toc-backref" href="#id45" id="use-cases" name="use-cases">Use Cases</a></h2>
<dl class="docutils">
<dt>public - end users can submit bugs, request new features, request</dt>
<dd>support
The Users would be given the default &quot;User&quot; Role which gives &quot;View&quot;
and &quot;Edit&quot; Permission to the &quot;issue&quot; class.</dd>
<dt>developer - developers can fix bugs, implement new features, provide</dt>
<dd>support
A new Role &quot;Developer&quot; is created with the Permission &quot;Fixer&quot; which
is checked for in custom auditors that see whether the issue is
being resolved with a particular resolution (&quot;fixed&quot;, &quot;implemented&quot;,
&quot;supported&quot;) and allows that resolution only if the permission is
available.</dd>
<dt>manager - approvers/managers can approve new features and signoff bug</dt>
<dd>fixes
A new Role &quot;Manager&quot; is created with the Permission &quot;Signoff&quot; which
is checked for in custom auditors that see whether the issue status
is being changed similar to the developer example. admin -
administrators can add users and set user's roles The existing Role
&quot;Admin&quot; has the Permissions &quot;Edit&quot; for all classes (including
&quot;user&quot;) and &quot;Web Roles&quot; which allow the desired actions.</dd>
<dt>system - automated request handlers running various report/escalation</dt>
<dd>scripts
A combination of existing and new Roles, Permissions and auditors
could be used here.</dd>
<dt>privacy - issues that are only visible to some users</dt>
<dd>A new property is added to the issue which marks the user or group
of users who are allowed to view and edit the issue. An auditor will
check for edit access, and the template user object can check for
view access.</dd>
</dl>
</div>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id46" id="deployment-scenarios" name="deployment-scenarios">Deployment Scenarios</a></h1>
<p>The design described above should be general enough to permit the use of
Roundup for bug tracking, managing projects, managing patches, or
holding discussions.  By using items of multiple types, one could deploy
a system that maintains requirement specifications, catalogs bugs, and
manages submitted patches, where patches could be linked to the bugs and
requirements they address.</p>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id47" id="acknowledgements" name="acknowledgements">Acknowledgements</a></h1>
<p>My thanks are due to Christy Heyl for reviewing and contributing
suggestions to this paper and motivating me to get it done, and to Jesse
Vincent, Mark Miller, Christopher Simons, Jeff Dunmall, Wayne Gramlich,
and Dean Tribble for their assistance with the first-round submission.</p>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id48" id="changes-to-this-document" name="changes-to-this-document">Changes to this document</a></h1>
<ul class="simple">
<li>Added Boolean and Number types</li>
<li>Added section Hyperdatabase Implementations</li>
<li>&quot;Item&quot; has been renamed to &quot;Issue&quot; to account for the more specific
nature of the Class.</li>
<li>New Templating</li>
<li>Access Controls</li>
<li>Added &quot;actor&quot; property</li>
</ul>
<hr class="docutils" />
<p>Back to <a class="reference" href="index.html">Table of Contents</a></p>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2006-10-04.

</div>
</body>
</html>