Mercurial > p > roundup > code
annotate doc/customizing.txt @ 1674:0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
| author | Jean Jordaan <neaj@users.sourceforge.net> |
|---|---|
| date | Mon, 23 Jun 2003 07:58:38 +0000 |
| parents | ab6db4c6770d |
| children | e2caeaa34ed4 |
| rev | line source |
|---|---|
|
1215
f83efa574177
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1214
diff
changeset
|
1 =================== |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2 Customising Roundup |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3 =================== |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
4 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
5 :Version: $Revision: 1.89 $ |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
6 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
7 .. This document borrows from the ZopeBook section on ZPT. The original is at: |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
8 http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx |
|
686
c52122f38c9b
Documentation cleanup, added info for potential (and current) developers
Richard Jones <richard@users.sourceforge.net>
parents:
684
diff
changeset
|
9 |
|
c52122f38c9b
Documentation cleanup, added info for potential (and current) developers
Richard Jones <richard@users.sourceforge.net>
parents:
684
diff
changeset
|
10 .. contents:: |
| 1125 | 11 :depth: 1 |
|
686
c52122f38c9b
Documentation cleanup, added info for potential (and current) developers
Richard Jones <richard@users.sourceforge.net>
parents:
684
diff
changeset
|
12 |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
13 What You Can Do |
| 1098 | 14 =============== |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
15 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
16 Before you get too far, it's probably worth having a quick read of the Roundup |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
17 `design documentation`_. |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
18 |
| 935 | 19 Customisation of Roundup can take one of five forms: |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
20 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
21 1. `tracker configuration`_ file changes |
|
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
22 2. database, or `tracker schema`_ changes |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
23 3. "definition" class `database content`_ changes |
|
909
ef9c759c243e
Fix to hasPermission, thanks Stefan Seefeld.
Richard Jones <richard@users.sourceforge.net>
parents:
907
diff
changeset
|
24 4. behavioural changes, through detectors_ |
| 935 | 25 5. `access controls`_ |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
26 6. change the `web interface`_ |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
27 |
|
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
28 The third case is special because it takes two distinctly different forms |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
29 depending upon whether the tracker has been initialised or not. The other two |
|
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
30 may be done at any time, before or after tracker initialisation. Yes, this |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
31 includes adding or removing properties from classes. |
|
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
32 |
|
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
33 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
34 Trackers in a Nutshell |
| 1098 | 35 ====================== |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
36 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
37 Trackers have the following structure: |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
38 |
| 1098 | 39 =================== ======================================================== |
| 40 Tracker File Description | |
| 41 =================== ======================================================== | |
| 42 config.py Holds the basic `tracker configuration`_ | |
| 43 dbinit.py Holds the `tracker schema`_ | |
| 44 interfaces.py Defines the Web and E-Mail interfaces for the tracker | |
| 45 select_db.py Selects the database back-end for the tracker | |
| 46 db/ Holds the tracker's database | |
| 47 db/files/ Holds the tracker's upload files and messages | |
| 48 detectors/ Auditors and reactors for this tracker | |
| 49 html/ Web interface templates, images and style sheets | |
| 50 =================== ======================================================== | |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
51 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
52 Tracker Configuration |
| 1098 | 53 ===================== |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
54 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
55 The ``config.py`` located in your tracker home contains the basic |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
56 configuration for the web and e-mail components of roundup's interfaces. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
57 As the name suggests, this file is a Python module. This means that any |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
58 valid python expression may be used in the file. Mostly though, you'll |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
59 be setting the configuration variables to string values. Python string |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
60 values must be quoted with either single or double quotes:: |
|
1245
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
61 |
|
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
62 'this is a string' |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
63 "this is also a string - use it when the value has 'single quotes'" |
|
1245
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
64 this is not a string - it's not quoted |
|
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
65 |
|
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
66 Python strings may use formatting that's almost identical to C string |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
67 formatting. The ``%`` operator is used to perform the formatting, like |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
68 so:: |
|
1245
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
69 |
|
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
70 'roundup-admin@%s'%MAIL_DOMAIN |
|
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
71 |
|
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
72 this will create a string ``'roundup-admin@tracker.domain.example'`` if |
|
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
73 MAIL_DOMAIN is set to ``'tracker.domain.example'``. |
|
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
74 |
|
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
75 You'll also note some values are set to:: |
|
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
76 |
|
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
77 os.path.join(TRACKER_HOME, 'db') |
|
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
78 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
79 or similar. This creates a new string which holds the path to the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
80 ``'db'`` directory in the TRACKER_HOME directory. This is just a |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
81 convenience so if the TRACKER_HOME changes you don't have to edit |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
82 multiple valoues. |
|
1245
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
83 |
|
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
84 The configuration variables available are: |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
85 |
|
1096
fa7df238e2d4
More cleaning up of configuration, and the "instance" -> "tracker" renaming.
Richard Jones <richard@users.sourceforge.net>
parents:
1091
diff
changeset
|
86 **TRACKER_HOME** - ``os.path.split(__file__)[0]`` |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
87 The tracker home directory. The above default code will automatically |
|
1245
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
88 determine the tracker home for you, so you can just leave it alone. |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
89 |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
90 **MAILHOST** - ``'localhost'`` |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
91 The SMTP mail host that roundup will use to send e-mail. |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
92 |
|
1648
496f8f741e26
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1638
diff
changeset
|
93 **MAILUSER** - ``()`` |
|
1614
137b26174a0c
oops, forgot to document the SMTP changes
Richard Jones <richard@users.sourceforge.net>
parents:
1602
diff
changeset
|
94 If your SMTP mail host requires a username and password for access, then |
|
137b26174a0c
oops, forgot to document the SMTP changes
Richard Jones <richard@users.sourceforge.net>
parents:
1602
diff
changeset
|
95 specify them here. eg. ``MAILUSER = ('username', 'password')`` |
|
137b26174a0c
oops, forgot to document the SMTP changes
Richard Jones <richard@users.sourceforge.net>
parents:
1602
diff
changeset
|
96 |
|
1648
496f8f741e26
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1638
diff
changeset
|
97 **MAILHOST_TLS** - ``'no'`` |
|
1614
137b26174a0c
oops, forgot to document the SMTP changes
Richard Jones <richard@users.sourceforge.net>
parents:
1602
diff
changeset
|
98 If your SMTP mail host provides or requires TLS (Transport Layer |
|
137b26174a0c
oops, forgot to document the SMTP changes
Richard Jones <richard@users.sourceforge.net>
parents:
1602
diff
changeset
|
99 Security) then set ``MAILHOST_TLS = 'yes'`` |
|
137b26174a0c
oops, forgot to document the SMTP changes
Richard Jones <richard@users.sourceforge.net>
parents:
1602
diff
changeset
|
100 |
|
1648
496f8f741e26
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1638
diff
changeset
|
101 **MAILHOST_TLS_KEYFILE** - ``''`` |
|
1614
137b26174a0c
oops, forgot to document the SMTP changes
Richard Jones <richard@users.sourceforge.net>
parents:
1602
diff
changeset
|
102 If you're using TLS, you may also set MAILHOST_TLS_KEYFILE to the name of |
|
137b26174a0c
oops, forgot to document the SMTP changes
Richard Jones <richard@users.sourceforge.net>
parents:
1602
diff
changeset
|
103 a PEM formatted file that contains your private key. |
|
137b26174a0c
oops, forgot to document the SMTP changes
Richard Jones <richard@users.sourceforge.net>
parents:
1602
diff
changeset
|
104 |
|
1648
496f8f741e26
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1638
diff
changeset
|
105 **MAILHOST_TLS_CERTFILE** - ``''`` |
|
1614
137b26174a0c
oops, forgot to document the SMTP changes
Richard Jones <richard@users.sourceforge.net>
parents:
1602
diff
changeset
|
106 If you're using TLS and have specified a MAILHOST_TLS_KEYFILE, you may |
|
137b26174a0c
oops, forgot to document the SMTP changes
Richard Jones <richard@users.sourceforge.net>
parents:
1602
diff
changeset
|
107 also set MAILHOST_TLS_CERTFILE to the name of a PEM formatted certificate |
|
137b26174a0c
oops, forgot to document the SMTP changes
Richard Jones <richard@users.sourceforge.net>
parents:
1602
diff
changeset
|
108 chain file. |
|
137b26174a0c
oops, forgot to document the SMTP changes
Richard Jones <richard@users.sourceforge.net>
parents:
1602
diff
changeset
|
109 |
|
1245
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
110 **MAIL_DOMAIN** - ``'tracker.domain.example'`` |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
111 The domain name used for email addresses. |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
112 |
|
1096
fa7df238e2d4
More cleaning up of configuration, and the "instance" -> "tracker" renaming.
Richard Jones <richard@users.sourceforge.net>
parents:
1091
diff
changeset
|
113 **DATABASE** - ``os.path.join(TRACKER_HOME, 'db')`` |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
114 This is the directory that the database is going to be stored in. By default |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
115 it is in the tracker home. |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
116 |
|
1096
fa7df238e2d4
More cleaning up of configuration, and the "instance" -> "tracker" renaming.
Richard Jones <richard@users.sourceforge.net>
parents:
1091
diff
changeset
|
117 **TEMPLATES** - ``os.path.join(TRACKER_HOME, 'html')`` |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
118 This is the directory that the HTML templates reside in. By default they are |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
119 in the tracker home. |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
120 |
|
1096
fa7df238e2d4
More cleaning up of configuration, and the "instance" -> "tracker" renaming.
Richard Jones <richard@users.sourceforge.net>
parents:
1091
diff
changeset
|
121 **TRACKER_NAME** - ``'Roundup issue tracker'`` |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
122 A descriptive name for your roundup tracker. This is sent out in e-mails and |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
123 appears in the heading of CGI pages. |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
124 |
|
1096
fa7df238e2d4
More cleaning up of configuration, and the "instance" -> "tracker" renaming.
Richard Jones <richard@users.sourceforge.net>
parents:
1091
diff
changeset
|
125 **TRACKER_EMAIL** - ``'issue_tracker@%s'%MAIL_DOMAIN`` |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
126 The email address that e-mail sent to roundup should go to. Think of it as the |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
127 tracker's personal e-mail address. |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
128 |
|
1360
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
129 **TRACKER_WEB** - ``'http://tracker.example/cgi-bin/roundup.cgi/bugs/'`` |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
130 The web address that the tracker is viewable at. This will be included in |
|
1360
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
131 information sent to users of the tracker. The URL **must** include the |
|
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
132 cgi-bin part or anything else that is required to get to the home page of |
|
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
133 the tracker. You **must** include a trailing '/' in the URL. |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
134 |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
135 **ADMIN_EMAIL** - ``'roundup-admin@%s'%MAIL_DOMAIN`` |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
136 The email address that roundup will complain to if it runs into trouble. |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
137 |
|
1360
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
138 **EMAIL_FROM_TAG** - ``''`` |
|
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
139 Additional text to include in the "name" part of the ``From:`` address used |
|
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
140 in nosy messages. If the sending user is "Foo Bar", the ``From:`` line is |
|
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
141 usually:: |
| 1560 | 142 |
| 143 "Foo Bar" <issue_tracker@tracker.example> | |
|
1360
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
144 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
145 The EMAIL_FROM_TAG goes inside the "Foo Bar" quotes like so:: |
|
1360
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
146 |
|
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
147 "Foo Bar EMAIL_FROM_TAG" <issue_tracker@tracker.example> |
|
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
148 |
|
1602
a3442208867f
mention MESSAGES_TO_AUTHOR "new" setting [SF#724518]
Richard Jones <richard@users.sourceforge.net>
parents:
1570
diff
changeset
|
149 **MESSAGES_TO_AUTHOR** - ``'new'``, ``'yes'`` or``'no'`` |
|
a3442208867f
mention MESSAGES_TO_AUTHOR "new" setting [SF#724518]
Richard Jones <richard@users.sourceforge.net>
parents:
1570
diff
changeset
|
150 Send nosy messages to the author of the message? |
|
a3442208867f
mention MESSAGES_TO_AUTHOR "new" setting [SF#724518]
Richard Jones <richard@users.sourceforge.net>
parents:
1570
diff
changeset
|
151 If 'new' is used, then the author will only be sent the message when the |
|
a3442208867f
mention MESSAGES_TO_AUTHOR "new" setting [SF#724518]
Richard Jones <richard@users.sourceforge.net>
parents:
1570
diff
changeset
|
152 message creates a new issue. If 'yes' then the author will always be sent |
|
a3442208867f
mention MESSAGES_TO_AUTHOR "new" setting [SF#724518]
Richard Jones <richard@users.sourceforge.net>
parents:
1570
diff
changeset
|
153 a copy of the message they wrote. |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
154 |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
155 **ADD_AUTHOR_TO_NOSY** - ``'new'``, ``'yes'`` or ``'no'`` |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
156 Does the author of a message get placed on the nosy list automatically? |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
157 If ``'new'`` is used, then the author will only be added when a message |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
158 creates a new issue. If ``'yes'``, then the author will be added on followups |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
159 too. If ``'no'``, they're never added to the nosy. |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
160 |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
161 **ADD_RECIPIENTS_TO_NOSY** - ``'new'``, ``'yes'`` or ``'no'`` |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
162 Do the recipients (To:, Cc:) of a message get placed on the nosy list? |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
163 If ``'new'`` is used, then the recipients will only be added when a message |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
164 creates a new issue. If ``'yes'``, then the recipients will be added on |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
165 followups too. If ``'no'``, they're never added to the nosy. |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
166 |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
167 **EMAIL_SIGNATURE_POSITION** - ``'top'``, ``'bottom'`` or ``'none'`` |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
168 Where to place the email signature in messages that Roundup generates. |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
169 |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
170 **EMAIL_KEEP_QUOTED_TEXT** - ``'yes'`` or ``'no'`` |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
171 Keep email citations. Citations are the part of e-mail which the sender has |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
172 quoted in their reply to previous e-mail. |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
173 |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
174 **EMAIL_LEAVE_BODY_UNCHANGED** - ``'no'`` |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
175 Preserve the email body as is. Enabiling this will cause the entire message |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
176 body to be stored, including all citations and signatures. It should be |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
177 either ``'yes'`` or ``'no'``. |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
178 |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
179 **MAIL_DEFAULT_CLASS** - ``'issue'`` or ``''`` |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
180 Default class to use in the mailgw if one isn't supplied in email |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
181 subjects. To disable, comment out the variable below or leave it blank. |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
182 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
183 The default config.py is given below - as you |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
184 can see, the MAIL_DOMAIN must be edited before any interaction with the |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
185 tracker is attempted.:: |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
186 |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
187 # roundup home is this package's directory |
|
1096
fa7df238e2d4
More cleaning up of configuration, and the "instance" -> "tracker" renaming.
Richard Jones <richard@users.sourceforge.net>
parents:
1091
diff
changeset
|
188 TRACKER_HOME=os.path.split(__file__)[0] |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
189 |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
190 # The SMTP mail host that roundup will use to send mail |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
191 MAILHOST = 'localhost' |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
192 |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
193 # The domain name used for email addresses. |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
194 MAIL_DOMAIN = 'your.tracker.email.domain.example' |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
195 |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
196 # This is the directory that the database is going to be stored in |
|
1096
fa7df238e2d4
More cleaning up of configuration, and the "instance" -> "tracker" renaming.
Richard Jones <richard@users.sourceforge.net>
parents:
1091
diff
changeset
|
197 DATABASE = os.path.join(TRACKER_HOME, 'db') |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
198 |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
199 # This is the directory that the HTML templates reside in |
|
1096
fa7df238e2d4
More cleaning up of configuration, and the "instance" -> "tracker" renaming.
Richard Jones <richard@users.sourceforge.net>
parents:
1091
diff
changeset
|
200 TEMPLATES = os.path.join(TRACKER_HOME, 'html') |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
201 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
202 # A descriptive name for your roundup tracker |
|
1096
fa7df238e2d4
More cleaning up of configuration, and the "instance" -> "tracker" renaming.
Richard Jones <richard@users.sourceforge.net>
parents:
1091
diff
changeset
|
203 TRACKER_NAME = 'Roundup issue tracker' |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
204 |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
205 # The email address that mail to roundup should go to |
|
1096
fa7df238e2d4
More cleaning up of configuration, and the "instance" -> "tracker" renaming.
Richard Jones <richard@users.sourceforge.net>
parents:
1091
diff
changeset
|
206 TRACKER_EMAIL = 'issue_tracker@%s'%MAIL_DOMAIN |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
207 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
208 # The web address that the tracker is viewable at. This will be |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
209 # included in information sent to users of the tracker. The URL MUST |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
210 # include the cgi-bin part or anything else that is required to get |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
211 # to the home page of the tracker. You MUST include a trailing '/' |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
212 # in the URL. |
|
1360
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
213 TRACKER_WEB = 'http://tracker.example/cgi-bin/roundup.cgi/bugs/' |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
214 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
215 # The email address that roundup will complain to if it runs into |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
216 # trouble |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
217 ADMIN_EMAIL = 'roundup-admin@%s'%MAIL_DOMAIN |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
218 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
219 # Additional text to include in the "name" part of the From: address |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
220 # used in nosy messages. If the sending user is "Foo Bar", the From: |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
221 # line is usually: "Foo Bar" <issue_tracker@tracker.example> |
|
1360
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
222 # the EMAIL_FROM_TAG goes inside the "Foo Bar" quotes like so: |
|
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
223 # "Foo Bar EMAIL_FROM_TAG" <issue_tracker@tracker.example> |
|
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
224 EMAIL_FROM_TAG = "" |
|
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
225 |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
226 # Send nosy messages to the author of the message |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
227 MESSAGES_TO_AUTHOR = 'no' # either 'yes' or 'no' |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
228 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
229 # Does the author of a message get placed on the nosy list |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
230 # automatically? If 'new' is used, then the author will only be |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
231 # added when a message creates a new issue. If 'yes', then the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
232 # author will be added on followups too. If 'no', they're never |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
233 # added to the nosy. |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
234 ADD_AUTHOR_TO_NOSY = 'new' # one of 'yes', 'no', 'new' |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
235 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
236 # Do the recipients (To:, Cc:) of a message get placed on the nosy |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
237 # list? If 'new' is used, then the recipients will only be added |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
238 # when a message creates a new issue. If 'yes', then the recipients |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
239 # will be added on followups too. If 'no', they're never added to |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
240 # the nosy. |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
241 ADD_RECIPIENTS_TO_NOSY = 'new' # either 'yes', 'no', 'new' |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
242 |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
243 # Where to place the email signature |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
244 EMAIL_SIGNATURE_POSITION = 'bottom' # one of 'top', 'bottom', 'none' |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
245 |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
246 # Keep email citations |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
247 EMAIL_KEEP_QUOTED_TEXT = 'no' # either 'yes' or 'no' |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
248 |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
249 # Preserve the email body as is |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
250 EMAIL_LEAVE_BODY_UNCHANGED = 'no' # either 'yes' or 'no' |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
251 |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
252 # Default class to use in the mailgw if one isn't supplied in email |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
253 # subjects. To disable, comment out the variable below or leave it |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
254 # blank. Examples: |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
255 MAIL_DEFAULT_CLASS = 'issue' # use "issue" class by default |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
256 #MAIL_DEFAULT_CLASS = '' # disable (or just comment the var out) |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
257 |
|
1360
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
258 # |
|
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
259 # SECURITY DEFINITIONS |
|
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
260 # |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
261 # define the Roles that a user gets when they register with the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
262 # tracker these are a comma-separated string of role names (e.g. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
263 # 'Admin,User') |
|
1360
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
264 NEW_WEB_USER_ROLES = 'User' |
|
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
265 NEW_EMAIL_USER_ROLES = 'User' |
|
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
266 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
267 Tracker Schema |
| 1098 | 268 ============== |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
269 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
270 Note: if you modify the schema, you'll most likely need to edit the |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
271 `web interface`_ HTML template files and `detectors`_ to reflect |
|
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
272 your changes. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
273 |
| 1091 | 274 A tracker schema defines what data is stored in the tracker's database. |
| 275 Schemas are defined using Python code in the ``dbinit.py`` module of your | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
276 tracker. The "classic" schema looks like this (see below for the meaning |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
277 of ``'setkey'``):: |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
278 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
279 pri = Class(db, "priority", name=String(), order=String()) |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
280 pri.setkey("name") |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
281 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
282 stat = Class(db, "status", name=String(), order=String()) |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
283 stat.setkey("name") |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
284 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
285 keyword = Class(db, "keyword", name=String()) |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
286 keyword.setkey("name") |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
287 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
288 user = Class(db, "user", username=String(), organisation=String(), |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
289 password=String(), address=String(), realname=String(), |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
290 phone=String()) |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
291 user.setkey("username") |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
292 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
293 msg = FileClass(db, "msg", author=Link("user"), summary=String(), |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
294 date=Date(), recipients=Multilink("user"), |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
295 files=Multilink("file")) |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
296 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
297 file = FileClass(db, "file", name=String(), type=String()) |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
298 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
299 issue = IssueClass(db, "issue", topic=Multilink("keyword"), |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
300 status=Link("status"), assignedto=Link("user"), |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
301 priority=Link("priority")) |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
302 issue.setkey('title') |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
303 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
304 Classes and Properties - creating a new information store |
| 1098 | 305 --------------------------------------------------------- |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
306 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
307 In the tracker above, we've defined 7 classes of information: |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
308 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
309 priority |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
310 Defines the possible levels of urgency for issues. |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
311 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
312 status |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
313 Defines the possible states of processing the issue may be in. |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
314 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
315 keyword |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
316 Initially empty, will hold keywords useful for searching issues. |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
317 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
318 user |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
319 Initially holding the "admin" user, will eventually have an entry |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
320 for all users using roundup. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
321 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
322 msg |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
323 Initially empty, will hold all e-mail messages sent to or |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
324 generated by roundup. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
325 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
326 file |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
327 Initially empty, will hold all files attached to issues. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
328 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
329 issue |
| 1091 | 330 Initially empty, this is where the issue information is stored. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
331 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
332 We define the "priority" and "status" classes to allow two things: |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
333 reduction in the amount of information stored on the issue and more |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
334 powerful, accurate searching of issues by priority and status. By only |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
335 requiring a link on the issue (which is stored as a single number) we |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
336 reduce the chance that someone mis-types a priority or status - or |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
337 simply makes a new one up. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
338 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
339 |
| 1091 | 340 Class and Items |
| 1098 | 341 ~~~~~~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
342 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
343 A Class defines a particular class (or type) of data that will be stored |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
344 in the database. A class comprises one or more properties, which gives |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
345 the information about the class items. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
346 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
347 The actual data entered into the database, using ``class.create()``, are |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
348 called items. They have a special immutable property called ``'id'``. We |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
349 sometimes refer to this as the *itemid*. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
350 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
351 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
352 Properties |
| 1098 | 353 ~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
354 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
355 A Class is comprised of one or more properties of the following types: |
| 1091 | 356 |
| 357 * String properties are for storing arbitrary-length strings. | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
358 * Password properties are for storing encoded arbitrary-length strings. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
359 The default encoding is defined on the ``roundup.password.Password`` |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
360 class. |
| 1091 | 361 * Date properties store date-and-time stamps. Their values are Timestamp |
| 362 objects. | |
| 363 * Number properties store numeric values. | |
| 364 * Boolean properties store on/off, yes/no, true/false values. | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
365 * A Link property refers to a single other item selected from a |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
366 specified class. The class is part of the property; the value is an |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
367 integer, the id of the chosen item. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
368 * A Multilink property refers to possibly many items in a specified |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
369 class. The value is a list of integers. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
370 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
371 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
372 FileClass |
| 1098 | 373 ~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
374 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
375 FileClasses save their "content" attribute off in a separate file from |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
376 the rest of the database. This reduces the number of large entries in |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
377 the database, which generally makes databases more efficient, and also |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
378 allows us to use command-line tools to operate on the files. They are |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
379 stored in the files sub-directory of the ``'db'`` directory in your |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
380 tracker. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
381 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
382 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
383 IssueClass |
| 1098 | 384 ~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
385 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
386 IssueClasses automatically include the "messages", "files", "nosy", and |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
387 "superseder" properties. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
388 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
389 The messages and files properties list the links to the messages and |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
390 files related to the issue. The nosy property is a list of links to |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
391 users who wish to be informed of changes to the issue - they get "CC'ed" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
392 e-mails when messages are sent to or generated by the issue. The nosy |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
393 reactor (in the ``'detectors'`` directory) handles this action. The |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
394 superseder link indicates an issue which has superseded this one. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
395 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
396 They also have the dynamically generated "creation", "activity" and |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
397 "creator" properties. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
398 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
399 The value of the "creation" property is the date when an item was |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
400 created, and the value of the "activity" property is the date when any |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
401 property on the item was last edited (equivalently, these are the dates |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
402 on the first and last records in the item's journal). The "creator" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
403 property holds a link to the user that created the issue. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
404 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
405 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
406 setkey(property) |
| 1098 | 407 ~~~~~~~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
408 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
409 Select a String property of the class to be the key property. The key |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
410 property must be unique, and allows references to the items in the class |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
411 by the content of the key property. That is, we can refer to users by |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
412 their username: for example, let's say that there's an issue in roundup, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
413 issue 23. There's also a user, richard, who happens to be user 2. To |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
414 assign an issue to him, we could do either of:: |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
415 |
|
1570
93e0a565cee5
fix the "set" command usage statement
Richard Jones <richard@users.sourceforge.net>
parents:
1568
diff
changeset
|
416 roundup-admin set issue23 assignedto=2 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
417 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
418 or:: |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
419 |
|
1570
93e0a565cee5
fix the "set" command usage statement
Richard Jones <richard@users.sourceforge.net>
parents:
1568
diff
changeset
|
420 roundup-admin set issue23 assignedto=richard |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
421 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
422 Note, the same thing can be done in the web and e-mail interfaces. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
423 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
424 If a class does not have an "order" property, the key is also used to |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
425 sort instances of the class when it is rendered in the user interface. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
426 (If a class has no "order" property, sorting is by the labelproperty of |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
427 the class. This is computed, in order of precedence, as the key, the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
428 "name", the "title", or the first property alphabetically.) |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
429 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
430 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
431 create(information) |
| 1098 | 432 ~~~~~~~~~~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
433 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
434 Create an item in the database. This is generally used to create items |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
435 in the "definitional" classes like "priority" and "status". |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
436 |
|
684
5b23ff865f3a
added a "detectors" directory...
Richard Jones <richard@users.sourceforge.net>
parents:
673
diff
changeset
|
437 |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
438 Examples of adding to your schema |
| 1098 | 439 --------------------------------- |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
440 |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
441 TODO |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
442 |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
443 |
|
684
5b23ff865f3a
added a "detectors" directory...
Richard Jones <richard@users.sourceforge.net>
parents:
673
diff
changeset
|
444 Detectors - adding behaviour to your tracker |
| 1098 | 445 ============================================ |
|
909
ef9c759c243e
Fix to hasPermission, thanks Stefan Seefeld.
Richard Jones <richard@users.sourceforge.net>
parents:
907
diff
changeset
|
446 .. _detectors: |
|
684
5b23ff865f3a
added a "detectors" directory...
Richard Jones <richard@users.sourceforge.net>
parents:
673
diff
changeset
|
447 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
448 Detectors are initialised every time you open your tracker database, so |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
449 you're free to add and remove them any time, even after the database is |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
450 initialised via the "roundup-admin initialise" command. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
451 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
452 The detectors in your tracker fire *before* (**auditors**) and *after* |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
453 (**reactors**) changes to the contents of your database. They are Python |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
454 modules that sit in your tracker's ``detectors`` directory. You will |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
455 have some installed by default - have a look. You can write new |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
456 detectors or modify the existing ones. The existing detectors installed |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
457 for you are: |
|
907
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
458 |
|
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
459 **nosyreaction.py** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
460 This provides the automatic nosy list maintenance and email sending. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
461 The nosy reactor (``nosyreaction``) fires when new messages are added |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
462 to issues. The nosy auditor (``updatenosy``) fires when issues are |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
463 changed, and figures out what changes need to be made to the nosy list |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
464 (such as adding new authors, etc.) |
|
907
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
465 **statusauditor.py** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
466 This provides the ``chatty`` auditor which changes the issue status |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
467 from ``unread`` or ``closed`` to ``chatting`` if new messages appear. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
468 It also provides the ``presetunread`` auditor which pre-sets the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
469 status to ``unread`` on new items if the status isn't explicitly |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
470 defined. |
|
907
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
471 |
|
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
472 See the detectors section in the `design document`__ for details of the |
|
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
473 interface for detectors. |
|
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
474 |
|
909
ef9c759c243e
Fix to hasPermission, thanks Stefan Seefeld.
Richard Jones <richard@users.sourceforge.net>
parents:
907
diff
changeset
|
475 __ design.html |
|
907
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
476 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
477 Sample additional detectors that have been found useful will appear in |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
478 the ``'detectors'`` directory of the Roundup distribution. If you want |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
479 to use one, copy it to the ``'detectors'`` of your tracker instance: |
|
684
5b23ff865f3a
added a "detectors" directory...
Richard Jones <richard@users.sourceforge.net>
parents:
673
diff
changeset
|
480 |
|
907
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
481 **newissuecopy.py** |
|
684
5b23ff865f3a
added a "detectors" directory...
Richard Jones <richard@users.sourceforge.net>
parents:
673
diff
changeset
|
482 This detector sends an email to a team address whenever a new issue is |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
483 created. The address is hard-coded into the detector, so edit it |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
484 before you use it (look for the text 'team@team.host') or you'll get |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
485 email errors! |
|
684
5b23ff865f3a
added a "detectors" directory...
Richard Jones <richard@users.sourceforge.net>
parents:
673
diff
changeset
|
486 |
| 1100 | 487 The detector code:: |
| 488 | |
| 489 from roundup import roundupdb | |
| 490 | |
| 491 def newissuecopy(db, cl, nodeid, oldvalues): | |
| 492 ''' Copy a message about new issues to a team address. | |
| 493 ''' | |
| 494 # so use all the messages in the create | |
| 495 change_note = cl.generateCreateNote(nodeid) | |
| 496 | |
| 497 # send a copy to the nosy list | |
| 498 for msgid in cl.get(nodeid, 'messages'): | |
| 499 try: | |
| 500 # note: last arg must be a list | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
501 cl.send_message(nodeid, msgid, change_note, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
502 ['team@team.host']) |
| 1100 | 503 except roundupdb.MessageSendError, message: |
| 504 raise roundupdb.DetectorError, message | |
| 505 | |
| 506 def init(db): | |
| 507 db.issue.react('create', newissuecopy) | |
| 1091 | 508 |
|
684
5b23ff865f3a
added a "detectors" directory...
Richard Jones <richard@users.sourceforge.net>
parents:
673
diff
changeset
|
509 |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
510 Database Content |
| 1098 | 511 ================ |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
512 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
513 Note: if you modify the content of definitional classes, you'll most |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
514 likely need to edit the tracker `detectors`_ to reflect your |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
515 changes. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
516 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
517 Customisation of the special "definitional" classes (eg. status, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
518 priority, resolution, ...) may be done either before or after the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
519 tracker is initialised. The actual method of doing so is completely |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
520 different in each case though, so be careful to use the right one. |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
521 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
522 **Changing content before tracker initialisation** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
523 Edit the dbinit module in your tracker to alter the items created in |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
524 using the ``create()`` methods. |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
525 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
526 **Changing content after tracker initialisation** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
527 As the "admin" user, click on the "class list" link in the web |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
528 interface to bring up a list of all database classes. Click on the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
529 name of the class you wish to change the content of. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
530 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
531 You may also use the ``roundup-admin`` interface's create, set and |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
532 retire methods to add, alter or remove items from the classes in |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
533 question. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
534 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
535 See "`adding a new field to the classic schema`_" for an example that |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
536 requires database content changes. |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
537 |
|
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
538 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
539 Access Controls |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
540 =============== |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
541 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
542 A set of Permissions is built into the security module by default: |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
543 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
544 - Edit (everything) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
545 - View (everything) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
546 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
547 The default interfaces define: |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
548 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
549 - Web Registration |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
550 - Web Access |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
551 - Web Roles |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
552 - Email Registration |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
553 - Email Access |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
554 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
555 These are hooked into the default Roles: |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
556 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
557 - Admin (Edit everything, View everything, Web Roles) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
558 - User (Web Access, Email Access) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
559 - Anonymous (Web Registration, Email Registration) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
560 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
561 And finally, the "admin" user gets the "Admin" Role, and the "anonymous" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
562 user gets "Anonymous" assigned when the database is initialised on |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
563 installation. The two default schemas then define: |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
564 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
565 - Edit issue, View issue (both) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
566 - Edit file, View file (both) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
567 - Edit msg, View msg (both) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
568 - Edit support, View support (extended only) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
569 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
570 and assign those Permissions to the "User" Role. Put together, these |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
571 settings appear in the ``open()`` function of the tracker ``dbinit.py`` |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
572 (the following is taken from the "minimal" template's ``dbinit.py``):: |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
573 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
574 # |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
575 # SECURITY SETTINGS |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
576 # |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
577 # new permissions for this schema |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
578 for cl in ('user', ): |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
579 db.security.addPermission(name="Edit", klass=cl, |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
580 description="User is allowed to edit "+cl) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
581 db.security.addPermission(name="View", klass=cl, |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
582 description="User is allowed to access "+cl) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
583 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
584 # and give the regular users access to the web and email interface |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
585 p = db.security.getPermission('Web Access') |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
586 db.security.addPermissionToRole('User', p) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
587 p = db.security.getPermission('Email Access') |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
588 db.security.addPermissionToRole('User', p) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
589 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
590 # May users view other user information? Comment these lines out |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
591 # if you don't want them to |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
592 p = db.security.getPermission('View', 'user') |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
593 db.security.addPermissionToRole('User', p) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
594 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
595 # Assign the appropriate permissions to the anonymous user's |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
596 # Anonymous role. Choices here are: |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
597 # - Allow anonymous users to register through the web |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
598 p = db.security.getPermission('Web Registration') |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
599 db.security.addPermissionToRole('Anonymous', p) |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
600 # - Allow anonymous (new) users to register through the email |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
601 # gateway |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
602 p = db.security.getPermission('Email Registration') |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
603 db.security.addPermissionToRole('Anonymous', p) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
604 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
605 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
606 New User Roles |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
607 -------------- |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
608 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
609 New users are assigned the Roles defined in the config file as: |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
610 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
611 - NEW_WEB_USER_ROLES |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
612 - NEW_EMAIL_USER_ROLES |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
613 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
614 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
615 Changing Access Controls |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
616 ------------------------ |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
617 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
618 You may alter the configuration variables to change the Role that new |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
619 web or email users get, for example to not give them access to the web |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
620 interface if they register through email. |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
621 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
622 You may use the ``roundup-admin`` "``security``" command to display the |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
623 current Role and Permission configuration in your tracker. |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
624 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
625 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
626 Adding a new Permission |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
627 ~~~~~~~~~~~~~~~~~~~~~~~ |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
628 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
629 When adding a new Permission, you will need to: |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
630 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
631 1. add it to your tracker's dbinit so it is created |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
632 2. enable it for the Roles that should have it (verify with |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
633 "``roundup-admin security``") |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
634 3. add it to the relevant HTML interface templates |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
635 4. add it to the appropriate xxxPermission methods on in your tracker |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
636 interfaces module |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
637 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
638 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
639 Example Scenarios |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
640 ~~~~~~~~~~~~~~~~~ |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
641 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
642 **automatic registration of users in the e-mail gateway** |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
643 By giving the "anonymous" user the "Email Registration" Role, any |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
644 unidentified user will automatically be registered with the tracker |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
645 (with no password, so they won't be able to log in through the web |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
646 until an admin sets their password). Note: this is the default |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
647 behaviour in the tracker templates that ship with Roundup. |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
648 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
649 **anonymous access through the e-mail gateway** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
650 Give the "anonymous" user the "Email Access" and ("Edit", "issue") |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
651 Roles but do not not give them the "Email Registration" Role. This |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
652 means that when an unknown user sends email into the tracker, they're |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
653 automatically logged in as "anonymous". Since they don't have the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
654 "Email Registration" Role, they won't be automatically registered, but |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
655 since "anonymous" has permission to use the gateway, they'll still be |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
656 able to submit issues. Note that the Sender information - their email |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
657 address - will not be available - they're *anonymous*. |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
658 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
659 **only developers may be assigned issues** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
660 Create a new Permission called "Fixer" for the "issue" class. Create a |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
661 new Role "Developer" which has that Permission, and assign that to the |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
662 appropriate users. Filter the list of users available in the assignedto |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
663 list to include only those users. Enforce the Permission with an |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
664 auditor. See the example |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
665 `restricting the list of users that are assignable to a task`_. |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
666 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
667 **only managers may sign off issues as complete** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
668 Create a new Permission called "Closer" for the "issue" class. Create a |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
669 new Role "Manager" which has that Permission, and assign that to the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
670 appropriate users. In your web interface, only display the "resolved" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
671 issue state option when the user has the "Closer" Permissions. Enforce |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
672 the Permission with an auditor. This is very similar to the previous |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
673 example, except that the web interface check would look like:: |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
674 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
675 <option tal:condition="python:request.user.hasPermission('Closer')" |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
676 value="resolved">Resolved</option> |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
677 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
678 **don't give web access to users who register through email** |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
679 Create a new Role called "Email User" which has all the Permissions of |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
680 the normal "User" Role minus the "Web Access" Permission. This will |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
681 allow users to send in emails to the tracker, but not access the web |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
682 interface. |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
683 |
|
1317
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
684 **let some users edit the details of all users** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
685 Create a new Role called "User Admin" which has the Permission for |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
686 editing users:: |
|
1317
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
687 |
|
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
688 db.security.addRole(name='User Admin', description='Managing users') |
|
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
689 p = db.security.getPermission('Edit', 'user') |
|
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
690 db.security.addPermissionToRole('User Admin', p) |
|
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
691 |
|
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
692 and assign the Role to the users who need the permission. |
|
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
693 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
694 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
695 Web Interface |
| 1098 | 696 ============= |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
697 |
| 1125 | 698 .. contents:: |
| 699 :local: | |
| 700 :depth: 1 | |
| 701 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
702 The web interface is provided by the ``roundup.cgi.client`` module and |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
703 is used by ``roundup.cgi``, ``roundup-server`` and ``ZRoundup`` |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
704 (``ZRoundup`` is broken, until further notice). In all cases, we |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
705 determine which tracker is being accessed (the first part of the URL |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
706 path inside the scope of the CGI handler) and pass control on to the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
707 tracker ``interfaces.Client`` class - which uses the ``Client`` class |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
708 from ``roundup.cgi.client`` - which handles the rest of the access |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
709 through its ``main()`` method. This means that you can do pretty much |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
710 anything you want as a web interface to your tracker. |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
711 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
712 Repercussions of changing the tracker schema |
| 1098 | 713 --------------------------------------------- |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
714 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
715 If you choose to change the `tracker schema`_ you will need to ensure |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
716 the web interface knows about it: |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
717 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
718 1. Index, item and search pages for the relevant classes may need to |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
719 have properties added or removed, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
720 2. The "page" template may require links to be changed, as might the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
721 "home" page's content arguments. |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
722 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
723 How requests are processed |
| 1098 | 724 -------------------------- |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
725 |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
726 The basic processing of a web request proceeds as follows: |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
727 |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
728 1. figure out who we are, defaulting to the "anonymous" user |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
729 2. figure out what the request is for - we call this the "context" |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
730 3. handle any requested action (item edit, search, ...) |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
731 4. render the template requested by the context, resulting in HTML |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
732 output |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
733 |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
734 In some situations, exceptions occur: |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
735 |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
736 - HTTP Redirect (generally raised by an action) |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
737 - SendFile (generally raised by ``determine_context``) |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
738 here we serve up a FileClass "content" property |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
739 - SendStaticFile (generally raised by ``determine_context``) |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
740 here we serve up a file from the tracker "html" directory |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
741 - Unauthorised (generally raised by an action) |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
742 here the action is cancelled, the request is rendered and an error |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
743 message is displayed indicating that permission was not granted for |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
744 the action to take place |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
745 - NotFound (raised wherever it needs to be) |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
746 this exception percolates up to the CGI interface that called the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
747 client |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
748 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
749 Determining web context |
| 1098 | 750 ----------------------- |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
751 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
752 To determine the "context" of a request, we look at the URL and the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
753 special request variable ``:template``. The URL path after the tracker |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
754 identifier is examined. Typical URL paths look like: |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
755 |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
756 1. ``/tracker/issue`` |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
757 2. ``/tracker/issue1`` |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
758 3. ``/tracker/_file/style.css`` |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
759 4. ``/cgi-bin/roundup.cgi/tracker/file1`` |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
760 5. ``/cgi-bin/roundup.cgi/tracker/file1/kitten.png`` |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
761 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
762 where the "tracker identifier" is "tracker" in the above cases. That means |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
763 we're looking at "issue", "issue1", "_file/style.css", "file1" and |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
764 "file1/kitten.png" in the cases above. The path is generally only one |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
765 entry long - longer paths are handled differently. |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
766 |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
767 a. if there is no path, then we are in the "home" context. |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
768 b. if the path starts with "_file" (as in example 3, |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
769 "/tracker/_file/style.css"), then the additional path entry, |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
770 "style.css" specifies the filename of a static file we're to serve up |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
771 from the tracker "html" directory. Raises a SendStaticFile exception. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
772 c. if there is something in the path (as in example 1, "issue"), it |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
773 identifies the tracker class we're to display. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
774 d. if the path is an item designator (as in examples 2 and 4, "issue1" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
775 and "file1"), then we're to display a specific item. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
776 e. if the path starts with an item designator and is longer than one |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
777 entry (as in example 5, "file1/kitten.png"), then we're assumed to be |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
778 handling an item of a ``FileClass``, and the extra path information |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
779 gives the filename that the client is going to label the download |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
780 with (i.e. "file1/kitten.png" is nicer to download than "file1"). |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
781 This raises a ``SendFile`` exception. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
782 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
783 Both b. and e. stop before we bother to determine the template we're |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
784 going to use. That's because they don't actually use templates. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
785 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
786 The template used is specified by the ``:template`` CGI variable, which |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
787 defaults to: |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
788 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
789 - only classname suplied: "index" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
790 - full item designator supplied: "item" |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
791 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
792 |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
793 Performing actions in web requests |
| 1098 | 794 ---------------------------------- |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
795 |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
796 When a user requests a web page, they may optionally also request for an |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
797 action to take place. As described in `how requests are processed`_, the |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
798 action is performed before the requested page is generated. Actions are |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
799 triggered by using a ``:action`` CGI variable, where the value is one |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
800 of: |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
801 |
| 1125 | 802 **login** |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
803 Attempt to log a user in. |
|
1278
0c0494deb09f
doc for the retire action
Richard Jones <richard@users.sourceforge.net>
parents:
1270
diff
changeset
|
804 |
| 1125 | 805 **logout** |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
806 Log the user out - make them "anonymous". |
|
1278
0c0494deb09f
doc for the retire action
Richard Jones <richard@users.sourceforge.net>
parents:
1270
diff
changeset
|
807 |
| 1125 | 808 **register** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
809 Attempt to create a new user based on the contents of the form and then |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
810 log them in. |
|
1278
0c0494deb09f
doc for the retire action
Richard Jones <richard@users.sourceforge.net>
parents:
1270
diff
changeset
|
811 |
| 1125 | 812 **edit** |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
813 Perform an edit of an item in the database. There are some special form |
|
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
814 elements you may use: |
|
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
815 |
|
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
816 :link=designator:property and :multilink=designator:property |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
817 The value specifies an item designator and the property on that item |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
818 to which *this* item should be added, as a link or multilink. |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
819 :note |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
820 Create a message and attach it to the current item's "messages" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
821 property. |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
822 :file |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
823 Create a file and attach it to the current item's "files" property. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
824 Attach the file to the message created from the ``:note`` if it's |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
825 supplied. |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
826 :required=property,property,... |
|
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
827 The named properties are required to be filled in the form. |
|
1328
b4d4770658c1
allow multiple :remove and :add elements per property being edited
Richard Jones <richard@users.sourceforge.net>
parents:
1320
diff
changeset
|
828 :remove:<propname>=id(s) |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
829 The ids will be removed from the multilink property. You may have |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
830 multiple ``:remove:<propname>`` form elements for a single <propname>. |
|
1328
b4d4770658c1
allow multiple :remove and :add elements per property being edited
Richard Jones <richard@users.sourceforge.net>
parents:
1320
diff
changeset
|
831 :add:<propname>=id(s) |
|
b4d4770658c1
allow multiple :remove and :add elements per property being edited
Richard Jones <richard@users.sourceforge.net>
parents:
1320
diff
changeset
|
832 The ids will be added to the multilink property. You may have multiple |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
833 ``:add:<propname>`` form elements for a single <propname>. |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
834 |
| 1125 | 835 **new** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
836 Add a new item to the database. You may use the same special form |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
837 elements as in the "edit" action. |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
838 |
|
1278
0c0494deb09f
doc for the retire action
Richard Jones <richard@users.sourceforge.net>
parents:
1270
diff
changeset
|
839 **retire** |
|
0c0494deb09f
doc for the retire action
Richard Jones <richard@users.sourceforge.net>
parents:
1270
diff
changeset
|
840 Retire the item in the database. |
|
0c0494deb09f
doc for the retire action
Richard Jones <richard@users.sourceforge.net>
parents:
1270
diff
changeset
|
841 |
| 1125 | 842 **editCSV** |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
843 Performs an edit of all of a class' items in one go. See also the |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
844 *class*.csv templating method which generates the CSV data to be |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
845 edited, and the ``'_generic.index'`` template which uses both of these |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
846 features. |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
847 |
| 1125 | 848 **search** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
849 Mangle some of the form variables: |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
850 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
851 - Set the form ":filter" variable based on the values of the filter |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
852 variables - if they're set to anything other than "dontcare" then add |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
853 them to :filter. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
854 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
855 - Also handle the ":queryname" variable and save off the query to the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
856 user's query list. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
857 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
858 Each of the actions is implemented by a corresponding ``*actionAction*`` |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
859 (where "action" is the name of the action) method on the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
860 ``roundup.cgi.Client`` class, which also happens to be available in your |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
861 tracker instance as ``interfaces.Client``. So if you need to define new |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
862 actions, you may add them there (see `defining new web actions`_). |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
863 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
864 Each action also has a corresponding ``*actionPermission*`` (where |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
865 "action" is the name of the action) method which determines whether the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
866 action is permissible given the current user. The base permission checks |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
867 are: |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
868 |
| 1125 | 869 **login** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
870 Determine whether the user has permission to log in. Base behaviour is |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
871 to check the user has "Web Access". |
| 1125 | 872 **logout** |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
873 No permission checks are made. |
| 1125 | 874 **register** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
875 Determine whether the user has permission to register. Base behaviour |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
876 is to check the user has the "Web Registration" Permission. |
| 1125 | 877 **edit** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
878 Determine whether the user has permission to edit this item. Base |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
879 behaviour is to check whether the user can edit this class. If we're |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
880 editing the "user" class, users are allowed to edit their own details - |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
881 unless they try to edit the "roles" property, which requires the |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
882 special Permission "Web Roles". |
| 1125 | 883 **new** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
884 Determine whether the user has permission to create (or edit) this |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
885 item. Base behaviour is to check the user can edit this class. No |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
886 additional property checks are made. Additionally, new user items may |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
887 be created if the user has the "Web Registration" Permission. |
| 1125 | 888 **editCSV** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
889 Determine whether the user has permission to edit this class. Base |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
890 behaviour is to check whether the user may edit this class. |
| 1125 | 891 **search** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
892 Determine whether the user has permission to search this class. Base |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
893 behaviour is to check whether the user may view this class. |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
894 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
895 |
| 1091 | 896 Default templates |
| 1098 | 897 ----------------- |
| 1091 | 898 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
899 Most customisation of the web view can be done by modifying the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
900 templates in the tracker ``'html'`` directory. There are several types |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
901 of files in there. The *minimal* template includes: |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
902 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
903 **page.html** |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
904 This template usually defines the overall look of your tracker. When |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
905 you view an issue, it appears inside this template. When you view an |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
906 index, it also appears inside this template. This template defines a |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
907 macro called "icing" which is used by almost all other templates as a |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
908 coating for their content, using its "content" slot. It also defines |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
909 the "head_title" and "body_title" slots to allow setting of the page |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
910 title. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
911 **home.html** |
| 1091 | 912 the default page displayed when no other page is indicated by the user |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
913 **home.classlist.html** |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
914 a special version of the default page that lists the classes in the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
915 tracker |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
916 **classname.item.html** |
| 1091 | 917 displays an item of the *classname* class |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
918 **classname.index.html** |
| 1091 | 919 displays a list of *classname* items |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
920 **classname.search.html** |
| 1091 | 921 displays a search page for *classname* items |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
922 **_generic.index.html** |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
923 used to display a list of items where there is no |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
924 ``*classname*.index`` available |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
925 **_generic.help.html** |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
926 used to display a "class help" page where there is no |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
927 ``*classname*.help`` |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
928 **user.register.html** |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
929 a special page just for the user class, that renders the registration |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
930 page |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
931 **style.css.html** |
| 1091 | 932 a static file that is served up as-is |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
933 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
934 The *classic* template has a number of additional templates. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
935 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
936 Note: Remember that you can create any template extension you want to, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
937 so if you just want to play around with the templating for new issues, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
938 you can copy the current "issue.item" template to "issue.test", and then |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
939 access the test template using the ":template" URL argument:: |
|
1147
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
940 |
|
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
941 http://your.tracker.example/tracker/issue?:template=test |
|
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
942 |
|
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
943 and it won't affect your users using the "issue.item" template. |
|
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
944 |
|
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
945 |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
946 How the templates work |
| 1098 | 947 ---------------------- |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
948 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
949 |
| 1214 | 950 Basic Templating Actions |
| 951 ~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 952 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
953 Roundup's templates consist of special attributes on the HTML tags. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
954 These attributes form the Template Attribute Language, or TAL. The basic |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
955 TAL commands are: |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
956 |
| 1125 | 957 **tal:define="variable expression; variable expression; ..."** |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
958 Define a new variable that is local to this tag and its contents. For |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
959 example:: |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
960 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
961 <html tal:define="title request/description"> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
962 <head><title tal:content="title"></title></head> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
963 </html> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
964 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
965 In this example, the variable "title" is defined as the result of the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
966 expression "request/description". The "tal:content" command inside the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
967 <html> tag may then use the "title" variable. |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
968 |
| 1125 | 969 **tal:condition="expression"** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
970 Only keep this tag and its contents if the expression is true. For |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
971 example:: |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
972 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
973 <p tal:condition="python:request.user.hasPermission('View', 'issue')"> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
974 Display some issue information. |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
975 </p> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
976 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
977 In the example, the <p> tag and its contents are only displayed if |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
978 the user has the "View" permission for issues. We consider the number |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
979 zero, a blank string, an empty list, and the built-in variable |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
980 nothing to be false values. Nearly every other value is true, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
981 including non-zero numbers, and strings with anything in them (even |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
982 spaces!). |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
983 |
| 1125 | 984 **tal:repeat="variable expression"** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
985 Repeat this tag and its contents for each element of the sequence |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
986 that the expression returns, defining a new local variable and a |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
987 special "repeat" variable for each element. For example:: |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
988 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
989 <tr tal:repeat="u user/list"> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
990 <td tal:content="u/id"></td> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
991 <td tal:content="u/username"></td> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
992 <td tal:content="u/realname"></td> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
993 </tr> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
994 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
995 The example would iterate over the sequence of users returned by |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
996 "user/list" and define the local variable "u" for each entry. |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
997 |
| 1125 | 998 **tal:replace="expression"** |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
999 Replace this tag with the result of the expression. For example:: |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1000 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1001 <span tal:replace="request/user/realname" /> |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1002 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1003 The example would replace the <span> tag and its contents with the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1004 user's realname. If the user's realname was "Bruce", then the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1005 resultant output would be "Bruce". |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1006 |
| 1125 | 1007 **tal:content="expression"** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1008 Replace the contents of this tag with the result of the expression. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1009 For example:: |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1010 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1011 <span tal:content="request/user/realname">user's name appears here |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1012 </span> |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1013 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1014 The example would replace the contents of the <span> tag with the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1015 user's realname. If the user's realname was "Bruce" then the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1016 resultant output would be "<span>Bruce</span>". |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1017 |
| 1125 | 1018 **tal:attributes="attribute expression; attribute expression; ..."** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1019 Set attributes on this tag to the results of expressions. For |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1020 example:: |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1021 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1022 <a tal:attributes="href string:user${request/user/id}">My Details</a> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1023 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1024 In the example, the "href" attribute of the <a> tag is set to the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1025 value of the "string:user${request/user/id}" expression, which will |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1026 be something like "user123". |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1027 |
| 1125 | 1028 **tal:omit-tag="expression"** |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1029 Remove this tag (but not its contents) if the expression is true. For |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1030 example:: |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1031 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1032 <span tal:omit-tag="python:1">Hello, world!</span> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1033 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1034 would result in output of:: |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1035 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1036 Hello, world! |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1037 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1038 Note that the commands on a given tag are evaulated in the order above, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1039 so *define* comes before *condition*, and so on. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1040 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1041 Additionally, you may include tags such as <tal:block>, which are |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1042 removed from output. Its content is kept, but the tag itself is not (so |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1043 don't go using any "tal:attributes" commands on it). This is useful for |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1044 making arbitrary blocks of HTML conditional or repeatable (very handy |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1045 for repeating multiple table rows, which would othewise require an |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1046 illegal tag placement to effect the repeat). |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1047 |
| 1214 | 1048 |
| 1049 Templating Expressions | |
| 1050 ~~~~~~~~~~~~~~~~~~~~~~ | |
| 1051 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1052 The expressions you may use in the attribute values may be one of the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1053 following forms: |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1054 |
| 1125 | 1055 **Path Expressions** - eg. ``item/status/checklist`` |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1056 These are object attribute / item accesses. Roughly speaking, the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1057 path ``item/status/checklist`` is broken into parts ``item``, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1058 ``status`` and ``checklist``. The ``item`` part is the root of the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1059 expression. We then look for a ``status`` attribute on ``item``, or |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1060 failing that, a ``status`` item (as in ``item['status']``). If that |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1061 fails, the path expression fails. When we get to the end, the object |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1062 we're left with is evaluated to get a string - if it is a method, it |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1063 is called; if it is an object, it is stringified. Path expressions |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1064 may have an optional ``path:`` prefix, but they are the default |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1065 expression type, so it's not necessary. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1066 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1067 If an expression evaluates to ``default``, then the expression is |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1068 "cancelled" - whatever HTML already exists in the template will |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1069 remain (tag content in the case of ``tal:content``, attributes in the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1070 case of ``tal:attributes``). |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1071 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1072 If an expression evaluates to ``nothing`` then the target of the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1073 expression is removed (tag content in the case of ``tal:content``, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1074 attributes in the case of ``tal:attributes`` and the tag itself in |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1075 the case of ``tal:replace``). |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1076 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1077 If an element in the path may not exist, then you can use the ``|`` |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1078 operator in the expression to provide an alternative. So, the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1079 expression ``request/form/foo/value | default`` would simply leave |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1080 the current HTML in place if the "foo" form variable doesn't exist. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1081 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1082 You may use the python function ``path``, as in |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1083 ``path("item/status")``, to embed path expressions in Python |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1084 expressions. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1085 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1086 **String Expressions** - eg. ``string:hello ${user/name}`` |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1087 These expressions are simple string interpolations - though they can |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1088 be just plain strings with no interpolation if you want. The |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1089 expression in the ``${ ... }`` is just a path expression as above. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1090 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1091 **Python Expressions** - eg. ``python: 1+1`` |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1092 These expressions give the full power of Python. All the "root level" |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1093 variables are available, so ``python:item.status.checklist()`` would |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1094 be equivalent to ``item/status/checklist``, assuming that |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1095 ``checklist`` is a method. |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1096 |
|
1448
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
1097 Modifiers: |
|
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
1098 |
|
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
1099 **structure** - eg. ``structure python:msg.content.plain(hyperlink=1)`` |
|
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
1100 The result of expressions are normally *escaped* to be safe for HTML |
|
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
1101 display (all "<", ">" and "&" are turned into special entities). The |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1102 ``structure`` expression modifier turns off this escaping - the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1103 result of the expression is now assumed to be HTML, which is passed |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1104 to the web browser for rendering. |
|
1448
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
1105 |
|
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
1106 **not:** - eg. ``not:python:1=1`` |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1107 This simply inverts the logical true/false value of another |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1108 expression. |
|
1448
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
1109 |
|
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
1110 |
| 1214 | 1111 Template Macros |
| 1112 ~~~~~~~~~~~~~~~ | |
| 1113 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1114 Macros are used in Roundup to save us from repeating the same common |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1115 page stuctures over and over. The most common (and probably only) macro |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1116 you'll use is the "icing" macro defined in the "page" template. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1117 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1118 Macros are generated and used inside your templates using special |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1119 attributes similar to the `basic templating actions`_. In this case, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1120 though, the attributes belong to the Macro Expansion Template Attribute |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1121 Language, or METAL. The macro commands are: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1122 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1123 **metal:define-macro="macro name"** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1124 Define that the tag and its contents are now a macro that may be |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1125 inserted into other templates using the *use-macro* command. For |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1126 example:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1127 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1128 <html metal:define-macro="page"> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1129 ... |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1130 </html> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1131 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1132 defines a macro called "page" using the ``<html>`` tag and its |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1133 contents. Once defined, macros are stored on the template they're |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1134 defined on in the ``macros`` attribute. You can access them later on |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1135 through the ``templates`` variable, eg. the most common |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1136 ``templates/page/macros/icing`` to access the "page" macro of the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1137 "page" template. |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1138 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1139 **metal:use-macro="path expression"** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1140 Use a macro, which is identified by the path expression (see above). |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1141 This will replace the current tag with the identified macro contents. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1142 For example:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1143 |
| 1214 | 1144 <tal:block metal:use-macro="templates/page/macros/icing"> |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1145 ... |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1146 </tal:block> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1147 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1148 will replace the tag and its contents with the "page" macro of the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1149 "page" template. |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1150 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1151 **metal:define-slot="slot name"** and **metal:fill-slot="slot name"** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1152 To define *dynamic* parts of the macro, you define "slots" which may |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1153 be filled when the macro is used with a *use-macro* command. For |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1154 example, the ``templates/page/macros/icing`` macro defines a slot like |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1155 so:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1156 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1157 <title metal:define-slot="head_title">title goes here</title> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1158 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1159 In your *use-macro* command, you may now use a *fill-slot* command |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1160 like this:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1161 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1162 <title metal:fill-slot="head_title">My Title</title> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1163 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1164 where the tag that fills the slot completely replaces the one defined |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1165 as the slot in the macro. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1166 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1167 Note that you may not mix METAL and TAL commands on the same tag, but |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1168 TAL commands may be used freely inside METAL-using tags (so your |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1169 *fill-slots* tags may have all manner of TAL inside them). |
| 1214 | 1170 |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1171 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1172 Information available to templates |
| 1098 | 1173 ---------------------------------- |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1174 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1175 Note: this is implemented by |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1176 ``roundup.cgi.templating.RoundupPageTemplate`` |
| 1125 | 1177 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1178 The following variables are available to templates. |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1179 |
| 1125 | 1180 **context** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1181 The current context. This is either None, a `hyperdb class wrapper`_ |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1182 or a `hyperdb item wrapper`_ |
| 1125 | 1183 **request** |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1184 Includes information about the current request, including: |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1185 - the current index information (``filterspec``, ``filter`` args, |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1186 ``properties``, etc) parsed out of the form. |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1187 - methods for easy filterspec link generation |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
1188 - *user*, the current user item as an HTMLItem instance |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1189 - *form* |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1190 The current CGI form information as a mapping of form argument name |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1191 to value |
|
1254
77920c42aeb9
Expose the tracker config as a variable for templating
Richard Jones <richard@users.sourceforge.net>
parents:
1252
diff
changeset
|
1192 **config** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1193 This variable holds all the values defined in the tracker config.py |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1194 file (eg. TRACKER_NAME, etc.) |
| 1125 | 1195 **db** |
|
1254
77920c42aeb9
Expose the tracker config as a variable for templating
Richard Jones <richard@users.sourceforge.net>
parents:
1252
diff
changeset
|
1196 The current database, used to access arbitrary database items. |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1197 **templates** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1198 Access to all the tracker templates by name. Used mainly in |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1199 *use-macro* commands. |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1200 **utils** |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1201 This variable makes available some utility functions like batching. |
| 1125 | 1202 **nothing** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1203 This is a special variable - if an expression evaluates to this, then |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1204 the tag (in the case of a ``tal:replace``), its contents (in the case |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1205 of ``tal:content``) or some attributes (in the case of |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1206 ``tal:attributes``) will not appear in the the output. So, for |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1207 example:: |
| 1100 | 1208 |
| 1209 <span tal:attributes="class nothing">Hello, World!</span> | |
| 1210 | |
| 1211 would result in:: | |
| 1212 | |
| 1213 <span>Hello, World!</span> | |
| 1214 | |
| 1125 | 1215 **default** |
| 1100 | 1216 Also a special variable - if an expression evaluates to this, then the |
| 1217 existing HTML in the template will not be replaced or removed, it will | |
| 1218 remain. So:: | |
| 1219 | |
| 1220 <span tal:replace="default">Hello, World!</span> | |
| 1221 | |
| 1222 would result in:: | |
| 1223 | |
| 1224 <span>Hello, World!</span> | |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1225 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1226 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1227 The context variable |
| 1098 | 1228 ~~~~~~~~~~~~~~~~~~~~ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1229 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1230 The *context* variable is one of three things based on the current |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1231 context (see `determining web context`_ for how we figure this out): |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1232 |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1233 1. if we're looking at a "home" page, then it's None |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1234 2. if we're looking at a specific hyperdb class, it's a |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1235 `hyperdb class wrapper`_. |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1236 3. if we're looking at a specific hyperdb item, it's a |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1237 `hyperdb item wrapper`_. |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1238 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1239 If the context is not None, we can access the properties of the class or |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1240 item. The only real difference between cases 2 and 3 above are: |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1241 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1242 1. the properties may have a real value behind them, and this will |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1243 appear if the property is displayed through ``context/property`` or |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1244 ``context/property/field``. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1245 2. the context's "id" property will be a false value in the second case, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1246 but a real, or true value in the third. Thus we can determine whether |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1247 we're looking at a real item from the hyperdb by testing |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1248 "context/id". |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1249 |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1250 Hyperdb class wrapper |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1251 ::::::::::::::::::::: |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1252 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1253 Note: this is implemented by the ``roundup.cgi.templating.HTMLClass`` |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1254 class. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1255 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1256 This wrapper object provides access to a hyperb class. It is used |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1257 primarily in both index view and new item views, but it's also usable |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1258 anywhere else that you wish to access information about a class, or the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1259 items of a class, when you don't have a specific item of that class in |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1260 mind. |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1261 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1262 We allow access to properties. There will be no "id" property. The value |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1263 accessed through the property will be the current value of the same name |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1264 from the CGI form. |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1265 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1266 There are several methods available on these wrapper objects: |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1267 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1268 =========== ============================================================= |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1269 Method Description |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1270 =========== ============================================================= |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1271 properties return a `hyperdb property wrapper`_ for all of this class's |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1272 properties. |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1273 list lists all of the active (not retired) items in the class. |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1274 csv return the items of this class as a chunk of CSV text. |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1275 propnames lists the names of the properties of this class. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1276 filter lists of items from this class, filtered and sorted by the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1277 current *request* filterspec/filter/sort/group args |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1278 classhelp display a link to a javascript popup containing this class' |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1279 "help" template. |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1280 submit generate a submit button (and action hidden element) |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1281 renderWith render this class with the given template. |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1282 history returns 'New node - no history' :) |
|
1136
7e193bbda38e
added generic item editing
Richard Jones <richard@users.sourceforge.net>
parents:
1133
diff
changeset
|
1283 is_edit_ok is the user allowed to Edit the current class? |
|
7e193bbda38e
added generic item editing
Richard Jones <richard@users.sourceforge.net>
parents:
1133
diff
changeset
|
1284 is_view_ok is the user allowed to View the current class? |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1285 =========== ============================================================= |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1286 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1287 Note that if you have a property of the same name as one of the above |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1288 methods, you'll need to access it using a python "item access" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1289 expression. For example:: |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1290 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1291 python:context['list'] |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1292 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1293 will access the "list" property, rather than the list method. |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1294 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1295 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1296 Hyperdb item wrapper |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1297 :::::::::::::::::::: |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1298 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1299 Note: this is implemented by the ``roundup.cgi.templating.HTMLItem`` |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1300 class. |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1301 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1302 This wrapper object provides access to a hyperb item. |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1303 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1304 We allow access to properties. There will be no "id" property. The value |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1305 accessed through the property will be the current value of the same name |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1306 from the CGI form. |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1307 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1308 There are several methods available on these wrapper objects: |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1309 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1310 =============== ======================================================== |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1311 Method Description |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1312 =============== ======================================================== |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1313 submit generate a submit button (and action hidden element) |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1314 journal return the journal of the current item (**not |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1315 implemented**) |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1316 history render the journal of the current item as HTML |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1317 renderQueryForm specific to the "query" class - render the search form |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1318 for the query |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1319 hasPermission specific to the "user" class - determine whether the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1320 user has a Permission |
|
1136
7e193bbda38e
added generic item editing
Richard Jones <richard@users.sourceforge.net>
parents:
1133
diff
changeset
|
1321 is_edit_ok is the user allowed to Edit the current item? |
|
7e193bbda38e
added generic item editing
Richard Jones <richard@users.sourceforge.net>
parents:
1133
diff
changeset
|
1322 is_view_ok is the user allowed to View the current item? |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1323 =============== ======================================================== |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1324 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1325 Note that if you have a property of the same name as one of the above |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1326 methods, you'll need to access it using a python "item access" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1327 expression. For example:: |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1328 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1329 python:context['journal'] |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1330 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1331 will access the "journal" property, rather than the journal method. |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1332 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1333 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1334 Hyperdb property wrapper |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1335 :::::::::::::::::::::::: |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1336 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1337 Note: this is implemented by subclasses of the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1338 ``roundup.cgi.templating.HTMLProperty`` class (``HTMLStringProperty``, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1339 ``HTMLNumberProperty``, and so on). |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1340 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1341 This wrapper object provides access to a single property of a class. Its |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1342 value may be either: |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1343 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1344 1. if accessed through a `hyperdb item wrapper`_, then it's a value from |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1345 the hyperdb |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1346 2. if access through a `hyperdb class wrapper`_, then it's a value from |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1347 the CGI form |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1348 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1349 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1350 The property wrapper has some useful attributes: |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1351 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1352 =============== ======================================================== |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1353 Attribute Description |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1354 =============== ======================================================== |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1355 _name the name of the property |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1356 _value the value of the property if any - this is the actual |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1357 value retrieved from the hyperdb for this property |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1358 =============== ======================================================== |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1359 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1360 There are several methods available on these wrapper objects: |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1361 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1362 ========= ================================================================ |
|
1374
8e4c3e8de96f
fix StringHTMLProperty hyperlinking
Richard Jones <richard@users.sourceforge.net>
parents:
1365
diff
changeset
|
1363 Method Description |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1364 ========= ================================================================ |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1365 plain render a "plain" representation of the property. This method |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1366 may take two arguments: |
|
1374
8e4c3e8de96f
fix StringHTMLProperty hyperlinking
Richard Jones <richard@users.sourceforge.net>
parents:
1365
diff
changeset
|
1367 |
|
8e4c3e8de96f
fix StringHTMLProperty hyperlinking
Richard Jones <richard@users.sourceforge.net>
parents:
1365
diff
changeset
|
1368 escape |
|
8e4c3e8de96f
fix StringHTMLProperty hyperlinking
Richard Jones <richard@users.sourceforge.net>
parents:
1365
diff
changeset
|
1369 If true, escape the text so it is HTML safe (default: no). The |
|
8e4c3e8de96f
fix StringHTMLProperty hyperlinking
Richard Jones <richard@users.sourceforge.net>
parents:
1365
diff
changeset
|
1370 reason this defaults to off is that text is usually escaped |
|
8e4c3e8de96f
fix StringHTMLProperty hyperlinking
Richard Jones <richard@users.sourceforge.net>
parents:
1365
diff
changeset
|
1371 at a later stage by the TAL commands, unless the "structure" |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1372 option is used in the template. The following are all |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1373 equivalent:: |
|
1374
8e4c3e8de96f
fix StringHTMLProperty hyperlinking
Richard Jones <richard@users.sourceforge.net>
parents:
1365
diff
changeset
|
1374 |
|
8e4c3e8de96f
fix StringHTMLProperty hyperlinking
Richard Jones <richard@users.sourceforge.net>
parents:
1365
diff
changeset
|
1375 <p tal:content="structure python:msg.content.plain(escape=1)" /> |
|
8e4c3e8de96f
fix StringHTMLProperty hyperlinking
Richard Jones <richard@users.sourceforge.net>
parents:
1365
diff
changeset
|
1376 <p tal:content="python:msg.content.plain()" /> |
|
8e4c3e8de96f
fix StringHTMLProperty hyperlinking
Richard Jones <richard@users.sourceforge.net>
parents:
1365
diff
changeset
|
1377 <p tal:content="msg/content/plain" /> |
|
8e4c3e8de96f
fix StringHTMLProperty hyperlinking
Richard Jones <richard@users.sourceforge.net>
parents:
1365
diff
changeset
|
1378 <p tal:content="msg/content" /> |
|
8e4c3e8de96f
fix StringHTMLProperty hyperlinking
Richard Jones <richard@users.sourceforge.net>
parents:
1365
diff
changeset
|
1379 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1380 Usually you'll only want to use the escape option in a |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1381 complex expression. |
|
1374
8e4c3e8de96f
fix StringHTMLProperty hyperlinking
Richard Jones <richard@users.sourceforge.net>
parents:
1365
diff
changeset
|
1382 |
|
8e4c3e8de96f
fix StringHTMLProperty hyperlinking
Richard Jones <richard@users.sourceforge.net>
parents:
1365
diff
changeset
|
1383 hyperlink |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1384 If true, turn URLs, email addresses and hyperdb item |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1385 designators in the text into hyperlinks (default: no). Note |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1386 that you'll need to use the "structure" TAL option if you |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1387 want to use this:: |
|
1374
8e4c3e8de96f
fix StringHTMLProperty hyperlinking
Richard Jones <richard@users.sourceforge.net>
parents:
1365
diff
changeset
|
1388 |
|
8e4c3e8de96f
fix StringHTMLProperty hyperlinking
Richard Jones <richard@users.sourceforge.net>
parents:
1365
diff
changeset
|
1389 <p tal:content="structure python:msg.content.plain(hyperlink=1)" /> |
|
8e4c3e8de96f
fix StringHTMLProperty hyperlinking
Richard Jones <richard@users.sourceforge.net>
parents:
1365
diff
changeset
|
1390 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1391 Note also that the text is automatically HTML-escaped before |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1392 the hyperlinking transformation. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1393 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1394 field render an appropriate form edit field for the property - for |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1395 most types this is a text entry box, but for Booleans it's a |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1396 tri-state yes/no/neither selection. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1397 stext only on String properties - render the value of the property |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1398 as StructuredText (requires the StructureText module to be |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1399 installed separately) |
|
1374
8e4c3e8de96f
fix StringHTMLProperty hyperlinking
Richard Jones <richard@users.sourceforge.net>
parents:
1365
diff
changeset
|
1400 multiline only on String properties - render a multiline form edit |
|
8e4c3e8de96f
fix StringHTMLProperty hyperlinking
Richard Jones <richard@users.sourceforge.net>
parents:
1365
diff
changeset
|
1401 field for the property |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1402 email only on String properties - render the value of the property |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1403 as an obscured email address |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1404 confirm only on Password properties - render a second form edit field |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1405 for the property, used for confirmation that the user typed |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1406 the password correctly. Generates a field with name |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1407 "name:confirm". |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1408 now only on Date properties - return the current date as a new |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1409 property |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1410 reldate only on Date properties - render the interval between the date |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1411 and now |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1412 local only on Date properties - return this date as a new property |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1413 with some timezone offset |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1414 pretty only on Interval properties - render the interval in a pretty |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1415 format (eg. "yesterday") |
|
1374
8e4c3e8de96f
fix StringHTMLProperty hyperlinking
Richard Jones <richard@users.sourceforge.net>
parents:
1365
diff
changeset
|
1416 menu only on Link and Multilink properties - render a form select |
|
8e4c3e8de96f
fix StringHTMLProperty hyperlinking
Richard Jones <richard@users.sourceforge.net>
parents:
1365
diff
changeset
|
1417 list for this property |
|
8e4c3e8de96f
fix StringHTMLProperty hyperlinking
Richard Jones <richard@users.sourceforge.net>
parents:
1365
diff
changeset
|
1418 reverse only on Multilink properties - produce a list of the linked |
|
8e4c3e8de96f
fix StringHTMLProperty hyperlinking
Richard Jones <richard@users.sourceforge.net>
parents:
1365
diff
changeset
|
1419 items in reverse order |
|
8e4c3e8de96f
fix StringHTMLProperty hyperlinking
Richard Jones <richard@users.sourceforge.net>
parents:
1365
diff
changeset
|
1420 ========= ===================================================================== |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1421 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1422 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1423 The request variable |
| 1098 | 1424 ~~~~~~~~~~~~~~~~~~~~ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1425 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1426 Note: this is implemented by the ``roundup.cgi.templating.HTMLRequest`` |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1427 class. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1428 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1429 The request variable is packed with information about the current |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1430 request. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1431 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1432 .. taken from ``roundup.cgi.templating.HTMLRequest`` docstring |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1433 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1434 =========== ============================================================ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1435 Variable Holds |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1436 =========== ============================================================ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1437 form the CGI form as a cgi.FieldStorage |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1438 env the CGI environment variables |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
1439 base the base URL for this tracker |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1440 user a HTMLUser instance for this user |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1441 classname the current classname (possibly None) |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1442 template the current template (suffix, also possibly None) |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1443 form the current CGI form variables in a FieldStorage |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1444 =========== ============================================================ |
| 1083 | 1445 |
| 1446 **Index page specific variables (indexing arguments)** | |
| 1447 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1448 =========== ============================================================ |
| 1083 | 1449 Variable Holds |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1450 =========== ============================================================ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1451 columns dictionary of the columns to display in an index page |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1452 show a convenience access to columns - request/show/colname will |
| 1098 | 1453 be true if the columns should be displayed, false otherwise |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1454 sort index sort column (direction, column name) |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1455 group index grouping property (direction, column name) |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1456 filter properties to filter the index on |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1457 filterspec values to filter the index on |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1458 search_text text to perform a full-text search on for an index |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1459 =========== ============================================================ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1460 |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1461 There are several methods available on the request variable: |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1462 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1463 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1464 Method Description |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1465 =============== ======================================================== |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1466 description render a description of the request - handle for the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1467 page title |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1468 indexargs_form render the current index args as form elements |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1469 indexargs_url render the current index args as a URL |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1470 base_javascript render some javascript that is used by other components |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1471 of the templating |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1472 batch run the current index args through a filter and return a |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1473 list of items (see `hyperdb item wrapper`_, and |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1474 `batching`_) |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1475 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1476 |
| 1142 | 1477 The form variable |
| 1478 ::::::::::::::::: | |
| 1479 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1480 The form variable is a bit special because it's actually a python |
| 1142 | 1481 FieldStorage object. That means that you have two ways to access its |
| 1482 contents. For example, to look up the CGI form value for the variable | |
| 1483 "name", use the path expression:: | |
| 1484 | |
| 1485 request/form/name/value | |
| 1486 | |
| 1487 or the python expression:: | |
| 1488 | |
| 1489 python:request.form['name'].value | |
| 1490 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1491 Note the "item" access used in the python case, and also note the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1492 explicit "value" attribute we have to access. That's because the form |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1493 variables are stored as MiniFieldStorages. If there's more than one |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1494 "name" value in the form, then the above will break since |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1495 ``request/form/name`` is actually a *list* of MiniFieldStorages. So it's |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1496 best to know beforehand what you're dealing with. |
| 1142 | 1497 |
| 1498 | |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1499 The db variable |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1500 ~~~~~~~~~~~~~~~ |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1501 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1502 Note: this is implemented by the ``roundup.cgi.templating.HTMLDatabase`` |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1503 class. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1504 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1505 Allows access to all hyperdb classes as attributes of this variable. If |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1506 you want access to the "user" class, for example, you would use:: |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1507 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1508 db/user |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1509 python:db.user |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1510 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1511 The access results in a `hyperdb class wrapper`_. |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1512 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1513 |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1514 The templates variable |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1515 ~~~~~~~~~~~~~~~~~~~~~~ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1516 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1517 Note: this is implemented by the ``roundup.cgi.templating.Templates`` |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1518 class. |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1519 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1520 This variable doesn't have any useful methods defined. It supports being |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1521 used in expressions to access the templates, and consequently the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1522 template macros. You may access the templates using the following path |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1523 expression:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1524 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1525 templates/name |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1526 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1527 or the python expression:: |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1528 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1529 templates[name] |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1530 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1531 where "name" is the name of the template you wish to access. The |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1532 template has one useful attribute, namely "macros". To access a specific |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1533 macro (called "macro_name"), use the path expression:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1534 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1535 templates/name/macros/macro_name |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1536 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1537 or the python expression:: |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1538 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1539 templates[name].macros[macro_name] |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1540 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1541 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1542 The utils variable |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1543 ~~~~~~~~~~~~~~~~~~ |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1544 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1545 Note: this is implemented by the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1546 ``roundup.cgi.templating.TemplatingUtils`` class, but it may be extended |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1547 as described below. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1548 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1549 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1550 Method Description |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1551 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1552 Batch return a batch object using the supplied list |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1553 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1554 |
|
1270
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
1555 You may add additional utility methods by writing them in your tracker |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1556 ``interfaces.py`` module's ``TemplatingUtils`` class. See `adding a time |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1557 log to your issues`_ for an example. The TemplatingUtils class itself |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1558 will have a single attribute, ``client``, which may be used to access |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1559 the ``client.db`` when you need to perform arbitrary database queries. |
|
1270
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
1560 |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1561 Batching |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1562 :::::::: |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1563 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1564 Use Batch to turn a list of items, or item ids of a given class, into a |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1565 series of batches. Its usage is:: |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1566 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1567 python:utils.Batch(sequence, size, start, end=0, orphan=0, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1568 overlap=0) |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1569 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1570 or, to get the current index batch:: |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1571 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1572 request/batch |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1573 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1574 The parameters are: |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1575 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1576 ========= ============================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1577 Parameter Usage |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1578 ========= ============================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1579 sequence a list of HTMLItems |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1580 size how big to make the sequence. |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1581 start where to start (0-indexed) in the sequence. |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1582 end where to end (0-indexed) in the sequence. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1583 orphan if the next batch would contain less items than this value, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1584 then it is combined with this batch |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1585 overlap the number of items shared between adjacent batches |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1586 ========= ============================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1587 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1588 All of the parameters are assigned as attributes on the batch object. In |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1589 addition, it has several more attributes: |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1590 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1591 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1592 Attribute Description |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1593 =============== ======================================================== |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1594 start indicates the start index of the batch. *Note: unlike |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1595 the argument, is a 1-based index (I know, lame)* |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1596 first indicates the start index of the batch *as a 0-based |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1597 index* |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1598 length the actual number of elements in the batch |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1599 sequence_length the length of the original, unbatched, sequence. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1600 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1601 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1602 And several methods: |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1603 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1604 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1605 Method Description |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1606 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1607 previous returns a new Batch with the previous batch settings |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1608 next returns a new Batch with the next batch settings |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1609 propchanged detect if the named property changed on the current item |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1610 when compared to the last item |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1611 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1612 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1613 An example of batching:: |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1614 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1615 <table class="otherinfo"> |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1616 <tr><th colspan="4" class="header">Existing Keywords</th></tr> |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1617 <tr tal:define="keywords db/keyword/list" |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1618 tal:repeat="start python:range(0, len(keywords), 4)"> |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1619 <td tal:define="batch python:utils.Batch(keywords, 4, start)" |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1620 tal:repeat="keyword batch" tal:content="keyword/name"> |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1621 keyword here</td> |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1622 </tr> |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1623 </table> |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1624 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1625 ... which will produce a table with four columns containing the items of |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1626 the "keyword" class (well, their "name" anyway). |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1627 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1628 Displaying Properties |
| 1098 | 1629 --------------------- |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1630 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1631 Properties appear in the user interface in three contexts: in indices, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1632 in editors, and as search arguments. For each type of property, there |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1633 are several display possibilities. For example, in an index view, a |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1634 string property may just be printed as a plain string, but in an editor |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1635 view, that property may be displayed in an editable field. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1636 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1637 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1638 Index Views |
| 1098 | 1639 ----------- |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1640 |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1641 This is one of the class context views. It is also the default view for |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1642 classes. The template used is "*classname*.index". |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1643 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1644 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1645 Index View Specifiers |
| 1098 | 1646 ~~~~~~~~~~~~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1647 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1648 An index view specifier (URL fragment) looks like this (whitespace has |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1649 been added for clarity):: |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1650 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1651 /issue?status=unread,in-progress,resolved& |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1652 topic=security,ui& |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1653 :group=+priority& |
| 1098 | 1654 :sort==activity& |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1655 :filters=status,topic& |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1656 :columns=title,status,fixer |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1657 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1658 The index view is determined by two parts of the specifier: the layout |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1659 part and the filter part. The layout part consists of the query |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1660 parameters that begin with colons, and it determines the way that the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1661 properties of selected items are displayed. The filter part consists of |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1662 all the other query parameters, and it determines the criteria by which |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1663 items are selected for display. The filter part is interactively |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1664 manipulated with the form widgets displayed in the filter section. The |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1665 layout part is interactively manipulated by clicking on the column |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1666 headings in the table. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1667 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1668 The filter part selects the union of the sets of items with values |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1669 matching any specified Link properties and the intersection of the sets |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1670 of items with values matching any specified Multilink properties. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1671 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1672 The example specifies an index of "issue" items. Only items with a |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1673 "status" of either "unread" or "in-progress" or "resolved" are |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1674 displayed, and only items with "topic" values including both "security" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1675 and "ui" are displayed. The items are grouped by priority, arranged in |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1676 ascending order; and within groups, sorted by activity, arranged in |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1677 descending order. The filter section shows filters for the "status" and |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1678 "topic" properties, and the table includes columns for the "title", |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1679 "status", and "fixer" properties. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1680 |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1681 Searching Views |
| 1098 | 1682 --------------- |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1683 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1684 Note: if you add a new column to the ``:columns`` form variable |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1685 potentials then you will need to add the column to the appropriate |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1686 `index views`_ template so that it is actually displayed. |
|
1320
3758a5af985f
Lots of little fixes in this update:
Richard Jones <richard@users.sourceforge.net>
parents:
1317
diff
changeset
|
1687 |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1688 This is one of the class context views. The template used is typically |
|
1245
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
1689 "*classname*.search". The form on this page should have "search" as its |
|
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
1690 ``:action`` variable. The "search" action: |
|
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
1691 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1692 - sets up additional filtering, as well as performing indexed text |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1693 searching |
|
1245
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
1694 - sets the ``:filter`` variable correctly |
|
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
1695 - saves the query off if ``:query_name`` is set. |
|
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
1696 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1697 The search page should lay out any fields that you wish to allow the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1698 user to search on. If your schema contains a large number of properties, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1699 you should be wary of making all of those properties available for |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1700 searching, as this can cause confusion. If the additional properties are |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1701 Strings, consider having their value indexed, and then they will be |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1702 searchable using the full text indexed search. This is both faster, and |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1703 more useful for the end user. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1704 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1705 The two special form values on search pages which are handled by the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1706 "search" action are: |
|
1245
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
1707 |
|
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
1708 :search_text |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1709 Text with which to perform a search of the text index. Results from |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1710 that search will be used to limit the results of other filters (using |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1711 an intersection operation) |
|
1245
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
1712 :query_name |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1713 If supplied, the search parameters (including :search_text) will be |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1714 saved off as a the query item and registered against the user's |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1715 queries property. Note that the *classic* template schema has this |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1716 ability, but the *minimal* template schema does not. |
|
1245
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
1717 |
|
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
1718 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1719 Item Views |
| 1098 | 1720 ---------- |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1721 |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1722 The basic view of a hyperdb item is provided by the "*classname*.item" |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1723 template. It generally has three sections; an "editor", a "spool" and a |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1724 "history" section. |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1725 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1726 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1727 Editor Section |
| 1098 | 1728 ~~~~~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1729 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1730 The editor section is used to manipulate the item - it may be a static |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1731 display if the user doesn't have permission to edit the item. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1732 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1733 Here's an example of a basic editor template (this is the default |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1734 "classic" template issue item edit form - from the "issue.item.html" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1735 template):: |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1736 |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1737 <table class="form"> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1738 <tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1739 <th nowrap>Title</th> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1740 <td colspan="3" tal:content="structure python:context.title.field(size=60)">title</td> |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1741 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1742 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1743 <tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1744 <th nowrap>Priority</th> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1745 <td tal:content="structure context/priority/menu">priority</td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1746 <th nowrap>Status</th> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1747 <td tal:content="structure context/status/menu">status</td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1748 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1749 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1750 <tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1751 <th nowrap>Superseder</th> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1752 <td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1753 <span tal:replace="structure python:context.superseder.field(showid=1, size=20)" /> |
|
1113
a95428868bf4
Added the missing keyword/topic interface to classic template (blush)
Richard Jones <richard@users.sourceforge.net>
parents:
1100
diff
changeset
|
1754 <span tal:replace="structure python:db.issue.classhelp('id,title')" /> |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1755 <span tal:condition="context/superseder"> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1756 <br>View: <span tal:replace="structure python:context.superseder.link(showid=1)" /> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1757 </span> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1758 </td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1759 <th nowrap>Nosy List</th> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1760 <td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1761 <span tal:replace="structure context/nosy/field" /> |
|
1113
a95428868bf4
Added the missing keyword/topic interface to classic template (blush)
Richard Jones <richard@users.sourceforge.net>
parents:
1100
diff
changeset
|
1762 <span tal:replace="structure python:db.user.classhelp('username,realname,address,phone')" /> |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1763 </td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1764 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1765 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1766 <tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1767 <th nowrap>Assigned To</th> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1768 <td tal:content="structure context/assignedto/menu"> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1769 assignedto menu |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1770 </td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1771 <td> </td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1772 <td> </td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1773 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1774 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1775 <tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1776 <th nowrap>Change Note</th> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1777 <td colspan="3"> |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
1778 <textarea name=":note" wrap="hard" rows="5" cols="60"></textarea> |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1779 </td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1780 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1781 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1782 <tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1783 <th nowrap>File</th> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1784 <td colspan="3"><input type="file" name=":file" size="40"></td> |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1785 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1786 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1787 <tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1788 <td> </td> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1789 <td colspan="3" tal:content="structure context/submit"> |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1790 submit button will go here |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1791 </td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1792 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1793 </table> |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1794 |
|
673
604c84696461
link() htmltemplate function now has a "showid" option for links & multilinks.
Richard Jones <richard@users.sourceforge.net>
parents:
659
diff
changeset
|
1795 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1796 When a change is submitted, the system automatically generates a message |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1797 describing the changed properties. As shown in the example, the editor |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
1798 template can use the ":note" and ":file" fields, which are added to the |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1799 standard changenote message generated by Roundup. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1800 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1801 |
| 1638 | 1802 Form values |
| 1803 ::::::::::: | |
| 1804 | |
| 1805 We have a number of ways to pull properties out of the form in order to | |
| 1806 meet the various needs of: | |
| 1807 | |
| 1808 1. editing the current item (perhaps an issue item) | |
| 1809 2. editing information related to the current item (eg. messages or | |
| 1810 attached files) | |
| 1811 3. creating new information to be linked to the current item (eg. time | |
| 1812 spent on an issue) | |
| 1813 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1814 In the following, ``<bracketed>`` values are variable, ":" may be one of |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1815 ":" or "@", and other text ("required") is fixed. |
| 1638 | 1816 |
| 1817 Properties are specified as form variables: | |
| 1818 | |
| 1819 ``<propname>`` | |
| 1820 property on the current context item | |
| 1821 | |
| 1822 ``<designator>:<propname>`` | |
| 1823 property on the indicated item (for editing related information) | |
| 1824 | |
| 1825 ``<classname>-<N>:<propname>`` | |
| 1826 property on the Nth new item of classname (generally for creating new | |
| 1827 items to attach to the current item) | |
| 1828 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1829 Once we have determined the "propname", we check to see if it is one of |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1830 the special form values: |
| 1638 | 1831 |
| 1832 ``:required`` | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1833 The named property values must be supplied or a ValueError will be |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1834 raised. |
| 1638 | 1835 |
| 1836 ``:remove:<propname>=id(s)`` | |
| 1837 The ids will be removed from the multilink property. | |
| 1838 | |
| 1839 ``:add:<propname>=id(s)`` | |
| 1840 The ids will be added to the multilink property. | |
| 1841 | |
| 1842 ``:link:<propname>=<designator>`` | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1843 Used to add a link to new items created during edit. These are |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1844 collected and returned in ``all_links``. This will result in an |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1845 additional linking operation (either Link set or Multilink append) |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1846 after the edit/create is done using ``all_props`` in ``_editnodes``. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1847 The <propname> on the current item will be set/appended the id of the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1848 newly created item of class <designator> (where <designator> must be |
| 1638 | 1849 <classname>-<N>). |
| 1850 | |
| 1851 Any of the form variables may be prefixed with a classname or | |
| 1852 designator. | |
| 1853 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1854 Two special form values are supported for backwards compatibility: |
| 1638 | 1855 |
| 1856 ``:note`` | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1857 create a message (with content, author and date), linked to the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1858 context item. This is ALWAYS designated "msg-1". |
| 1638 | 1859 ``:file`` |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1860 create a file, attached to the current item and any message created by |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1861 :note. This is ALWAYS designated "file-1". |
| 1638 | 1862 |
| 1863 | |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1864 Spool Section |
| 1098 | 1865 ~~~~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1866 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1867 The spool section lists related information like the messages and files |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1868 of an issue. |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1869 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1870 TODO |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1871 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1872 |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1873 History Section |
| 1098 | 1874 ~~~~~~~~~~~~~~~ |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1875 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1876 The final section displayed is the history of the item - its database |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1877 journal. This is generally generated with the template:: |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1878 |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1879 <tal:block tal:replace="structure context/history" /> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1880 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1881 *To be done:* |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1882 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1883 *The actual history entries of the item may be accessed for manual |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1884 templating through the "journal" method of the item*:: |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1885 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1886 <tal:block tal:repeat="entry context/journal"> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1887 a journal entry |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1888 </tal:block> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1889 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
1890 *where each journal entry is an HTMLJournalEntry.* |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1891 |
| 1098 | 1892 Defining new web actions |
| 1893 ------------------------ | |
| 1894 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1895 You may define new actions to be triggered by the ``:action`` form |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1896 variable. These are added to the tracker ``interfaces.py`` as methods on |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1897 the ``Client`` class. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1898 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1899 Adding action methods takes three steps; first you `define the new |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1900 action method`_, then you `register the action method`_ with the cgi |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1901 interface so it may be triggered by the ``:action`` form variable. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1902 Finally you `use the new action`_ in your HTML form. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1903 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1904 See "`setting up a "wizard" (or "druid") for controlled adding of |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1905 issues`_" for an example. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1906 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1907 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1908 Define the new action method |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1909 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1910 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1911 The action methods have the following interface:: |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1912 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1913 def myActionMethod(self): |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1914 ''' Perform some action. No return value is required. |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1915 ''' |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1916 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1917 The *self* argument is an instance of your tracker ``instance.Client`` |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1918 class - thus it's mostly implemented by ``roundup.cgi.Client``. See the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1919 docstring of that class for details of what it can do. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1920 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1921 The method will typically check the ``self.form`` variable's contents. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1922 It may then: |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1923 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1924 - add information to ``self.ok_message`` or ``self.error_message`` |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1925 - change the ``self.template`` variable to alter what the user will see |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1926 next |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1927 - raise Unauthorised, SendStaticFile, SendFile, NotFound or Redirect |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1928 exceptions |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1929 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1930 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1931 Register the action method |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1932 ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1933 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1934 The method is now written, but isn't available to the user until you add |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1935 it to the `instance.Client`` class ``actions`` variable, like so:: |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1936 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1937 actions = client.Class.actions + ( |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1938 ('myaction', 'myActionMethod'), |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1939 ) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1940 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1941 This maps the action name "myaction" to the action method we defined. |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1942 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1943 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1944 Use the new action |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1945 ~~~~~~~~~~~~~~~~~~ |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1946 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1947 In your HTML form, add a hidden form element like so:: |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1948 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1949 <input type="hidden" name=":action" value="myaction"> |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1950 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1951 where "myaction" is the name you registered in the previous step. |
|
1003
f89b8d32291b
Hack hack hack...
Richard Jones <richard@users.sourceforge.net>
parents:
935
diff
changeset
|
1952 |
|
910
299f4890427d
documentation reorg post-new-security
Richard Jones <richard@users.sourceforge.net>
parents:
909
diff
changeset
|
1953 |
| 1100 | 1954 Examples |
| 1955 ======== | |
| 1956 | |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1957 .. contents:: |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1958 :local: |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1959 :depth: 1 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1960 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1961 |
| 1228 | 1962 Adding a new field to the classic schema |
| 1963 ---------------------------------------- | |
| 1100 | 1964 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1965 This example shows how to add a new constrained property (i.e. a |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1966 selection of distinct values) to your tracker. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1967 |
| 1098 | 1968 |
| 1969 Introduction | |
| 1100 | 1970 ~~~~~~~~~~~~ |
| 1098 | 1971 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1972 To make the classic schema of roundup useful as a TODO tracking system |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1973 for a group of systems administrators, it needed an extra data field per |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1974 issue: a category. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1975 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1976 This would let sysadmins quickly list all TODOs in their particular area |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1977 of interest without having to do complex queries, and without relying on |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1978 the spelling capabilities of other sysadmins (a losing proposition at |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1979 best). |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1980 |
| 1098 | 1981 |
| 1982 Adding a field to the database | |
| 1100 | 1983 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 1098 | 1984 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1985 This is the easiest part of the change. The category would just be a |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1986 plain string, nothing fancy. To change what is in the database you need |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1987 to add some lines to the ``open()`` function in ``dbinit.py``. Under the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1988 comment:: |
|
1235
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
1989 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
1990 # add any additional database schema configuration here |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
1991 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
1992 add:: |
| 1098 | 1993 |
| 1994 category = Class(db, "category", name=String()) | |
| 1995 category.setkey("name") | |
| 1996 | |
| 1997 Here we are setting up a chunk of the database which we are calling | |
| 1998 "category". It contains a string, which we are refering to as "name" for | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1999 lack of a more imaginative title. (Since "name" is one of the properties |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2000 that Roundup looks for on items if you do not set a key for them, it's |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2001 probably a good idea to stick with it for new classes if at all |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2002 appropriate.) Then we are setting the key of this chunk of the database |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2003 to be that "name". This is equivalent to an index for database types. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2004 This also means that there can only be one category with a given name. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2005 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2006 Adding the above lines allows us to create categories, but they're not |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2007 tied to the issues that we are going to be creating. It's just a list of |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2008 categories off on its own, which isn't much use. We need to link it in |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2009 with the issues. To do that, find the lines in the ``open()`` function |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2010 in ``dbinit.py`` which set up the "issue" class, and then add a link to |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2011 the category:: |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2012 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2013 issue = IssueClass(db, "issue", ... , |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2014 category=Multilink("category"), ... ) |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2015 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2016 The ``Multilink()`` means that each issue can have many categories. If |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2017 you were adding something with a one-to-one relationship to issues (such |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2018 as the "assignedto" property), use ``Link()`` instead. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2019 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2020 That is all you need to do to change the schema. The rest of the effort |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2021 is fiddling around so you can actually use the new category. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2022 |
| 1098 | 2023 |
|
1235
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2024 Populating the new category class |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2025 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2026 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2027 If you haven't initialised the database with the roundup-admin |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2028 "initialise" command, then you can add the following to the tracker |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2029 ``dbinit.py`` in the ``init()`` function under the comment:: |
|
1235
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2030 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2031 # add any additional database create steps here - but only if you |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2032 # haven't initialised the database with the admin "initialise" command |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2033 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2034 Add:: |
|
1235
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2035 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2036 category = db.getclass('category') |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2037 category.create(name="scipy", order="1") |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2038 category.create(name="chaco", order="2") |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2039 category.create(name="weave", order="3") |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2040 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2041 If the database has already been initalised, then you need to use the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2042 ``roundup-admin`` tool:: |
|
1235
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2043 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2044 % roundup-admin -i <tracker home> |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2045 Roundup <version> ready for input. |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2046 Type "help" for help. |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2047 roundup> create category name=scipy order=1 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2048 1 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2049 roundup> create category name=chaco order=1 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2050 2 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2051 roundup> create category name=weave order=1 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2052 3 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2053 roundup> exit... |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2054 There are unsaved changes. Commit them (y/N)? y |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2055 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2056 TODO: explain why order=1 in each case. Also, does key get set to "name" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2057 automatically when added via roundup-admin? |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2058 |
|
1235
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2059 |
| 1098 | 2060 Setting up security on the new objects |
| 1100 | 2061 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 1098 | 2062 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2063 By default only the admin user can look at and change objects. This |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2064 doesn't suit us, as we want any user to be able to create new categories |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2065 as required, and obviously everyone needs to be able to view the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2066 categories of issues for it to be useful. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2067 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2068 We therefore need to change the security of the category objects. This |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2069 is also done in the ``open()`` function of ``dbinit.py``. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2070 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2071 There are currently two loops which set up permissions and then assign |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2072 them to various roles. Simply add the new "category" to both lists:: |
| 1098 | 2073 |
| 2074 # new permissions for this schema | |
| 2075 for cl in 'issue', 'file', 'msg', 'user', 'category': | |
| 2076 db.security.addPermission(name="Edit", klass=cl, | |
| 2077 description="User is allowed to edit "+cl) | |
| 2078 db.security.addPermission(name="View", klass=cl, | |
| 2079 description="User is allowed to access "+cl) | |
| 2080 | |
| 2081 # Assign the access and edit permissions for issue, file and message | |
| 2082 # to regular users now | |
| 2083 for cl in 'issue', 'file', 'msg', 'category': | |
| 2084 p = db.security.getPermission('View', cl) | |
| 2085 db.security.addPermissionToRole('User', p) | |
| 2086 p = db.security.getPermission('Edit', cl) | |
| 2087 db.security.addPermissionToRole('User', p) | |
| 2088 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2089 So you are in effect doing the following (with 'cl' substituted by its |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2090 value):: |
| 1098 | 2091 |
| 2092 db.security.addPermission(name="Edit", klass='category', | |
| 2093 description="User is allowed to edit "+'category') | |
| 2094 db.security.addPermission(name="View", klass='category', | |
| 2095 description="User is allowed to access "+'category') | |
| 2096 | |
| 2097 which is creating two permission types; that of editing and viewing | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2098 "category" objects respectively. Then the following lines assign those |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2099 new permissions to the "User" role, so that normal users can view and |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2100 edit "category" objects:: |
| 1098 | 2101 |
| 2102 p = db.security.getPermission('View', 'category') | |
| 2103 db.security.addPermissionToRole('User', p) | |
| 2104 | |
| 2105 p = db.security.getPermission('Edit', 'category') | |
| 2106 db.security.addPermissionToRole('User', p) | |
| 2107 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2108 This is all the work that needs to be done for the database. It will |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2109 store categories, and let users view and edit them. Now on to the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2110 interface stuff. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2111 |
| 1098 | 2112 |
| 2113 Changing the web left hand frame | |
| 1100 | 2114 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 1098 | 2115 |
| 2116 We need to give the users the ability to create new categories, and the | |
| 2117 place to put the link to this functionality is in the left hand function | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2118 bar, under the "Issues" area. The file that defines how this area looks |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2119 is ``html/page``, which is what we are going to be editing next. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2120 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2121 If you look at this file you can see that it contains a lot of |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2122 "classblock" sections which are chunks of HTML that will be included or |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2123 excluded in the output depending on whether the condition in the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2124 classblock is met. Under the end of the classblock for issue is where we |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2125 are going to add the category code:: |
| 1098 | 2126 |
| 2127 <p class="classblock" | |
| 2128 tal:condition="python:request.user.hasPermission('View', 'category')"> | |
| 2129 <b>Categories</b><br> | |
| 2130 <a tal:condition="python:request.user.hasPermission('Edit', 'category')" | |
| 2131 href="category?:template=item">New Category<br></a> | |
| 2132 </p> | |
| 2133 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2134 The first two lines is the classblock definition, which sets up a |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2135 condition that only users who have "View" permission for the "category" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2136 object will have this section included in their output. Next comes a |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2137 plain "Categories" header in bold. Everyone who can view categories will |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2138 get that. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2139 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2140 Next comes the link to the editing area of categories. This link will |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2141 only appear if the condition - that the user has "Edit" permissions for |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2142 the "category" objects - is matched. If they do have permission then |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2143 they will get a link to another page which will let the user add new |
| 1098 | 2144 categories. |
| 2145 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2146 Note that if you have permission to *view* but not to *edit* categories, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2147 then all you will see is a "Categories" header with nothing underneath |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2148 it. This is obviously not very good interface design, but will do for |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2149 now. I just claim that it is so I can add more links in this section |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2150 later on. However to fix the problem you could change the condition in |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2151 the classblock statement, so that only users with "Edit" permission |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2152 would see the "Categories" stuff. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2153 |
| 1098 | 2154 |
| 2155 Setting up a page to edit categories | |
| 1100 | 2156 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 1098 | 2157 |
| 2158 We defined code in the previous section which let users with the | |
| 2159 appropriate permissions see a link to a page which would let them edit | |
| 2160 conditions. Now we have to write that page. | |
| 2161 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2162 The link was for the *item* template of the *category* object. This |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2163 translates into Roundup looking for a file called ``category.item.html`` |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2164 in the ``html`` tracker directory. This is the file that we are going to |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2165 write now. |
| 1098 | 2166 |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2167 First we add an info tag in a comment which doesn't affect the outcome |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2168 of the code at all, but is useful for debugging. If you load a page in a |
| 1098 | 2169 browser and look at the page source, you can see which sections come |
| 2170 from which files by looking for these comments:: | |
| 2171 | |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2172 <!-- category.item --> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2173 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2174 Next we need to add in the METAL macro stuff so we get the normal page |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2175 trappings:: |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2176 |
| 1214 | 2177 <tal:block metal:use-macro="templates/page/macros/icing"> |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2178 <title metal:fill-slot="head_title">Category editing</title> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2179 <td class="page-header-top" metal:fill-slot="body_title"> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2180 <h2>Category editing</h2> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2181 </td> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2182 <td class="content" metal:fill-slot="content"> |
| 1098 | 2183 |
| 2184 Next we need to setup up a standard HTML form, which is the whole | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2185 purpose of this file. We link to some handy javascript which sends the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2186 form through only once. This is to stop users hitting the send button |
| 1098 | 2187 multiple times when they are impatient and thus having the form sent |
| 2188 multiple times:: | |
| 2189 | |
| 2190 <form method="POST" onSubmit="return submit_once()" | |
| 2191 enctype="multipart/form-data"> | |
| 2192 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2193 Next we define some code which sets up the minimum list of fields that |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2194 we require the user to enter. There will be only one field - "name" - so |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2195 they better put something in it, otherwise the whole form is pointless:: |
| 1098 | 2196 |
| 2197 <input type="hidden" name=":required" value="name"> | |
| 2198 | |
| 2199 To get everything to line up properly we will put everything in a table, | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2200 and put a nice big header on it so the user has an idea what is |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2201 happening:: |
| 1098 | 2202 |
| 2203 <table class="form"> | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2204 <tr><th class="header" colspan="2">Category</th></tr> |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2205 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2206 Next, we need the field into which the user is going to enter the new |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2207 category. The "context.name.field(size=60)" bit tells Roundup to |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2208 generate a normal HTML field of size 60, and the contents of that field |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2209 will be the "name" variable of the current context (which is |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2210 "category"). The upshot of this is that when the user types something in |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2211 to the form, a new category will be created with that name:: |
| 1098 | 2212 |
| 2213 <tr> | |
|
1113
a95428868bf4
Added the missing keyword/topic interface to classic template (blush)
Richard Jones <richard@users.sourceforge.net>
parents:
1100
diff
changeset
|
2214 <th nowrap>Name</th> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2215 <td tal:content="structure python:context.name.field(size=60)"> |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2216 name</td> |
| 1098 | 2217 </tr> |
| 2218 | |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2219 Then a submit button so that the user can submit the new category:: |
| 1098 | 2220 |
| 2221 <tr> | |
| 2222 <td> </td> | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2223 <td colspan="3" tal:content="structure context/submit"> |
| 1098 | 2224 submit button will go here |
| 2225 </td> | |
| 2226 </tr> | |
| 2227 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2228 Finally we finish off the tags we used at the start to do the METAL |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2229 stuff:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2230 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2231 </td> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2232 </tal:block> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2233 |
| 1098 | 2234 So putting it all together, and closing the table and form we get:: |
| 2235 | |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2236 <!-- category.item --> |
| 1214 | 2237 <tal:block metal:use-macro="templates/page/macros/icing"> |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2238 <title metal:fill-slot="head_title">Category editing</title> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2239 <td class="page-header-top" metal:fill-slot="body_title"> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2240 <h2>Category editing</h2> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2241 </td> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2242 <td class="content" metal:fill-slot="content"> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2243 <form method="POST" onSubmit="return submit_once()" |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2244 enctype="multipart/form-data"> |
| 1098 | 2245 |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2246 <input type="hidden" name=":required" value="name"> |
| 1098 | 2247 |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2248 <table class="form"> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2249 <tr><th class="header" colspan="2">Category</th></tr> |
| 1098 | 2250 |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2251 <tr> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2252 <th nowrap>Name</th> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2253 <td tal:content="structure python:context.name.field(size=60)"> |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2254 name</td> |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2255 </tr> |
| 1098 | 2256 |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2257 <tr> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2258 <td> </td> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2259 <td colspan="3" tal:content="structure context/submit"> |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2260 submit button will go here |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2261 </td> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2262 </tr> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2263 </table> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2264 </form> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2265 </td> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2266 </tal:block> |
| 1098 | 2267 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2268 This is quite a lot to just ask the user one simple question, but there |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2269 is a lot of setup for basically one line (the form line) to do its work. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2270 To add another field to "category" would involve one more line (well, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2271 maybe a few extra to get the formatting correct). |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2272 |
| 1098 | 2273 |
| 2274 Adding the category to the issue | |
| 1100 | 2275 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 1098 | 2276 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2277 We now have the ability to create issues to our heart's content, but |
| 1098 | 2278 that is pointless unless we can assign categories to issues. Just like |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2279 the ``html/category.item.html`` file was used to define how to add a new |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2280 category, the ``html/issue.item.html`` is used to define how a new issue |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2281 is created. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2282 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2283 Just like ``category.issue.html`` this file defines a form which has a |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2284 table to lay things out. It doesn't matter where in the table we add new |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2285 stuff, it is entirely up to your sense of aesthetics:: |
| 1098 | 2286 |
| 2287 <th nowrap>Category</th> | |
| 2288 <td><span tal:replace="structure context/category/field" /> | |
|
1113
a95428868bf4
Added the missing keyword/topic interface to classic template (blush)
Richard Jones <richard@users.sourceforge.net>
parents:
1100
diff
changeset
|
2289 <span tal:replace="structure db/category/classhelp" /> |
| 1098 | 2290 </td> |
| 2291 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2292 First, we define a nice header so that the user knows what the next |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2293 section is, then the middle line does what we are most interested in. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2294 This ``context/category/field`` gets replaced by a field which contains |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2295 the category in the current context (the current context being the new |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2296 issue). |
| 1098 | 2297 |
| 2298 The classhelp lines generate a link (labelled "list") to a popup window | |
| 2299 which contains the list of currently known categories. | |
| 2300 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2301 |
| 1098 | 2302 Searching on categories |
| 1100 | 2303 ~~~~~~~~~~~~~~~~~~~~~~~ |
| 1098 | 2304 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2305 We can add categories, and create issues with categories. The next |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2306 obvious thing that we would like to be able to do, would be to search |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2307 for issues based on their category, so that, for example, anyone working |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2308 on the web server could look at all issues in the category "Web". |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2309 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2310 If you look for "Search Issues" in the 'html/page.html' file, you will |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2311 find that it looks something like |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2312 ``<a href="issue?:template=search">Search Issues</a>``. This shows us |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2313 that when you click on "Search Issues" it will be looking for a |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2314 ``issue.search.html`` file to display. So that is the file that we will |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2315 change. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2316 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2317 This file should begin to look familiar, by now. It is a simple HTML |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2318 form using a table to define structure. You can add the new category |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2319 search code anywhere you like within that form:: |
| 1098 | 2320 |
| 2321 <tr> | |
| 2322 <th>Category:</th> | |
| 2323 <td> | |
| 2324 <select name="category"> | |
| 2325 <option value="">don't care</option> | |
| 2326 <option value="">------------</option> | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2327 <option tal:repeat="s db/category/list" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2328 tal:attributes="value s/name" |
| 1098 | 2329 tal:content="s/name">category to filter on</option> |
| 2330 </select> | |
| 2331 </td> | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2332 <td><input type="checkbox" name=":columns" value="category" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2333 checked></td> |
| 1098 | 2334 <td><input type="radio" name=":sort" value="category"></td> |
| 2335 <td><input type="radio" name=":group" value="category"></td> | |
| 2336 </tr> | |
| 2337 | |
| 2338 Most of this is straightforward to anyone who knows HTML. It is just | |
| 2339 setting up a select list followed by a checkbox and a couple of radio | |
| 2340 buttons. | |
| 2341 | |
| 2342 The ``tal:repeat`` part repeats the tag for every item in the "category" | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2343 table and sets "s" to each category in turn. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2344 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2345 The ``tal:attributes`` part is setting up the ``value=`` part of the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2346 option tag to be the name part of "s", which is the current category in |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2347 the loop. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2348 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2349 The ``tal:content`` part is setting the contents of the option tag to be |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2350 the name part of "s" again. For objects more complex than category, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2351 obviously you would put an id in the value, and the descriptive part in |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2352 the content; but for categories they are the same. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2353 |
| 1098 | 2354 |
| 2355 Adding category to the default view | |
| 1100 | 2356 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 1098 | 2357 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2358 We can now add categories, add issues with categories, and search for |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2359 issues based on categories. This is everything that we need to do; |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2360 however, there is some more icing that we would like. I think the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2361 category of an issue is important enough that it should be displayed by |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2362 default when listing all the issues. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2363 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2364 Unfortunately, this is a bit less obvious than the previous steps. The |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2365 code defining how the issues look is in ``html/issue.index.html``. This |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2366 is a large table with a form down at the bottom for redisplaying and so |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2367 forth. |
| 1098 | 2368 |
| 2369 Firstly we need to add an appropriate header to the start of the table:: | |
| 2370 | |
| 2371 <th tal:condition="request/show/category">Category</th> | |
| 2372 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2373 The *condition* part of this statement is to avoid displaying the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2374 Category column if the user has selected not to see it. |
| 1098 | 2375 |
| 2376 The rest of the table is a loop which will go through every issue that | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2377 matches the display criteria. The loop variable is "i" - which means |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2378 that every issue gets assigned to "i" in turn. |
| 1098 | 2379 |
| 2380 The new part of code to display the category will look like this:: | |
| 2381 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2382 <td tal:condition="request/show/category" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2383 tal:content="i/category"></td> |
| 1098 | 2384 |
| 2385 The condition is the same as above: only display the condition when the | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2386 user hasn't asked for it to be hidden. The next part is to set the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2387 content of the cell to be the category part of "i" - the current issue. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2388 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2389 Finally we have to edit ``html/page.html`` again. This time, we need to |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2390 tell it that when the user clicks on "Unasigned Issues" or "All Issues", |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2391 the category column should be included in the resulting list. If you |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2392 scroll down the page file, you can see the links with lots of options. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2393 The option that we are interested in is the ``:columns=`` one which |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2394 tells roundup which fields of the issue to display. Simply add |
| 1098 | 2395 "category" to that list and it all should work. |
| 2396 | |
| 2397 | |
| 1100 | 2398 Adding in state transition control |
| 2399 ---------------------------------- | |
| 2400 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2401 Sometimes tracker admins want to control the states that users may move |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2402 issues to. You can do this by following these steps: |
| 1100 | 2403 |
|
1503
94ec56691f07
fix to [SF#700272]
Richard Jones <richard@users.sourceforge.net>
parents:
1457
diff
changeset
|
2404 1. make "status" a required variable. This is achieved by adding the |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2405 following to the top of the form in the ``issue.item.html`` |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2406 template:: |
|
1503
94ec56691f07
fix to [SF#700272]
Richard Jones <richard@users.sourceforge.net>
parents:
1457
diff
changeset
|
2407 |
|
94ec56691f07
fix to [SF#700272]
Richard Jones <richard@users.sourceforge.net>
parents:
1457
diff
changeset
|
2408 <input type="hidden" name="@required" value="status"> |
|
94ec56691f07
fix to [SF#700272]
Richard Jones <richard@users.sourceforge.net>
parents:
1457
diff
changeset
|
2409 |
|
94ec56691f07
fix to [SF#700272]
Richard Jones <richard@users.sourceforge.net>
parents:
1457
diff
changeset
|
2410 this will force users to select a status. |
|
94ec56691f07
fix to [SF#700272]
Richard Jones <richard@users.sourceforge.net>
parents:
1457
diff
changeset
|
2411 |
|
94ec56691f07
fix to [SF#700272]
Richard Jones <richard@users.sourceforge.net>
parents:
1457
diff
changeset
|
2412 2. add a Multilink property to the status class:: |
| 1100 | 2413 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2414 stat = Class(db, "status", ... , transitions=Multilink('status'), |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2415 ...) |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2416 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2417 and then edit the statuses already created, either: |
|
1255
e5af1b963837
minor doc fix
Richard Jones <richard@users.sourceforge.net>
parents:
1254
diff
changeset
|
2418 |
|
e5af1b963837
minor doc fix
Richard Jones <richard@users.sourceforge.net>
parents:
1254
diff
changeset
|
2419 a. through the web using the class list -> status class editor, or |
|
e5af1b963837
minor doc fix
Richard Jones <richard@users.sourceforge.net>
parents:
1254
diff
changeset
|
2420 b. using the roundup-admin "set" command. |
| 1100 | 2421 |
|
1503
94ec56691f07
fix to [SF#700272]
Richard Jones <richard@users.sourceforge.net>
parents:
1457
diff
changeset
|
2422 3. add an auditor module ``checktransition.py`` in your tracker's |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2423 ``detectors`` directory, for example:: |
| 1100 | 2424 |
| 2425 def checktransition(db, cl, nodeid, newvalues): | |
| 2426 ''' Check that the desired transition is valid for the "status" | |
| 2427 property. | |
| 2428 ''' | |
| 2429 if not newvalues.has_key('status'): | |
| 2430 return | |
| 2431 current = cl.get(nodeid, 'status') | |
| 2432 new = newvalues['status'] | |
| 2433 if new == current: | |
| 2434 return | |
| 2435 ok = db.status.get(current, 'transitions') | |
| 2436 if new not in ok: | |
| 2437 raise ValueError, 'Status not allowed to move from "%s" to "%s"'%( | |
| 2438 db.status.get(current, 'name'), db.status.get(new, 'name')) | |
| 2439 | |
| 2440 def init(db): | |
| 2441 db.issue.audit('set', checktransition) | |
| 2442 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2443 4. in the ``issue.item.html`` template, change the status editing bit |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2444 from:: |
| 1100 | 2445 |
| 2446 <th nowrap>Status</th> | |
| 2447 <td tal:content="structure context/status/menu">status</td> | |
| 2448 | |
| 2449 to:: | |
| 2450 | |
| 2451 <th nowrap>Status</th> | |
| 2452 <td> | |
| 2453 <select tal:condition="context/id" name="status"> | |
| 2454 <tal:block tal:define="ok context/status/transitions" | |
| 2455 tal:repeat="state db/status/list"> | |
| 2456 <option tal:condition="python:state.id in ok" | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2457 tal:attributes=" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2458 value state/id; |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2459 selected python:state.id == context.status.id" |
| 1100 | 2460 tal:content="state/name"></option> |
| 2461 </tal:block> | |
| 2462 </select> | |
| 2463 <tal:block tal:condition="not:context/id" | |
| 2464 tal:replace="structure context/status/menu" /> | |
| 2465 </td> | |
| 2466 | |
| 2467 which displays only the allowed status to transition to. | |
| 2468 | |
| 2469 | |
|
1304
61ad556cfc8d
working toward 0.5.2 release
Richard Jones <richard@users.sourceforge.net>
parents:
1299
diff
changeset
|
2470 Displaying only message summaries in the issue display |
|
61ad556cfc8d
working toward 0.5.2 release
Richard Jones <richard@users.sourceforge.net>
parents:
1299
diff
changeset
|
2471 ------------------------------------------------------ |
|
1133
36ec30d286ea
Cleaned up CHANGES/TODO
Richard Jones <richard@users.sourceforge.net>
parents:
1125
diff
changeset
|
2472 |
|
36ec30d286ea
Cleaned up CHANGES/TODO
Richard Jones <richard@users.sourceforge.net>
parents:
1125
diff
changeset
|
2473 Alter the issue.item template section for messages to:: |
|
36ec30d286ea
Cleaned up CHANGES/TODO
Richard Jones <richard@users.sourceforge.net>
parents:
1125
diff
changeset
|
2474 |
|
36ec30d286ea
Cleaned up CHANGES/TODO
Richard Jones <richard@users.sourceforge.net>
parents:
1125
diff
changeset
|
2475 <table class="messages" tal:condition="context/messages"> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2476 <tr><th colspan="5" class="header">Messages</th></tr> |
|
1304
61ad556cfc8d
working toward 0.5.2 release
Richard Jones <richard@users.sourceforge.net>
parents:
1299
diff
changeset
|
2477 <tr tal:repeat="msg context/messages"> |
|
61ad556cfc8d
working toward 0.5.2 release
Richard Jones <richard@users.sourceforge.net>
parents:
1299
diff
changeset
|
2478 <td><a tal:attributes="href string:msg${msg/id}" |
|
61ad556cfc8d
working toward 0.5.2 release
Richard Jones <richard@users.sourceforge.net>
parents:
1299
diff
changeset
|
2479 tal:content="string:msg${msg/id}"></a></td> |
|
61ad556cfc8d
working toward 0.5.2 release
Richard Jones <richard@users.sourceforge.net>
parents:
1299
diff
changeset
|
2480 <td tal:content="msg/author">author</td> |
|
61ad556cfc8d
working toward 0.5.2 release
Richard Jones <richard@users.sourceforge.net>
parents:
1299
diff
changeset
|
2481 <td nowrap tal:content="msg/date/pretty">date</td> |
|
61ad556cfc8d
working toward 0.5.2 release
Richard Jones <richard@users.sourceforge.net>
parents:
1299
diff
changeset
|
2482 <td tal:content="msg/summary">summary</td> |
|
61ad556cfc8d
working toward 0.5.2 release
Richard Jones <richard@users.sourceforge.net>
parents:
1299
diff
changeset
|
2483 <td> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2484 <a tal:attributes="href string:?:remove:messages=${msg/id}&:action=edit"> |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2485 remove</a> |
|
1304
61ad556cfc8d
working toward 0.5.2 release
Richard Jones <richard@users.sourceforge.net>
parents:
1299
diff
changeset
|
2486 </td> |
|
61ad556cfc8d
working toward 0.5.2 release
Richard Jones <richard@users.sourceforge.net>
parents:
1299
diff
changeset
|
2487 </tr> |
|
1133
36ec30d286ea
Cleaned up CHANGES/TODO
Richard Jones <richard@users.sourceforge.net>
parents:
1125
diff
changeset
|
2488 </table> |
|
36ec30d286ea
Cleaned up CHANGES/TODO
Richard Jones <richard@users.sourceforge.net>
parents:
1125
diff
changeset
|
2489 |
|
1147
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
2490 Restricting the list of users that are assignable to a task |
|
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
2491 ----------------------------------------------------------- |
|
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
2492 |
| 1150 | 2493 1. In your tracker's "dbinit.py", create a new Role, say "Developer":: |
|
1147
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
2494 |
|
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
2495 db.security.addRole(name='Developer', description='A developer') |
|
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
2496 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2497 2. Just after that, create a new Permission, say "Fixer", specific to |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2498 "issue":: |
|
1147
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
2499 |
|
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
2500 p = db.security.addPermission(name='Fixer', klass='issue', |
|
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
2501 description='User is allowed to be assigned to fix issues') |
|
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
2502 |
| 1150 | 2503 3. Then assign the new Permission to your "Developer" Role:: |
|
1147
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
2504 |
|
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
2505 db.security.addPermissionToRole('Developer', p) |
|
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
2506 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2507 4. In the issue item edit page ("html/issue.item.html" in your tracker |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2508 directory), use the new Permission in restricting the "assignedto" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2509 list:: |
|
1147
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
2510 |
|
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
2511 <select name="assignedto"> |
|
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
2512 <option value="-1">- no selection -</option> |
|
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
2513 <tal:block tal:repeat="user db/user/list"> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2514 <option tal:condition="python:user.hasPermission( |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2515 'Fixer', context._classname)" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2516 tal:attributes=" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2517 value user/id; |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2518 selected python:user.id == context.assignedto" |
|
1147
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
2519 tal:content="user/realname"></option> |
|
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
2520 </tal:block> |
|
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
2521 </select> |
|
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
2522 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2523 For extra security, you may wish to setup an auditor to enforce the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2524 Permission requirement (install this as "assignedtoFixer.py" in your |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2525 tracker "detectors" directory):: |
|
1147
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
2526 |
| 1149 | 2527 def assignedtoMustBeFixer(db, cl, nodeid, newvalues): |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2528 ''' Ensure the assignedto value in newvalues is a used with the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2529 Fixer Permission |
| 1149 | 2530 ''' |
| 2531 if not newvalues.has_key('assignedto'): | |
| 2532 # don't care | |
| 2533 return | |
| 2534 | |
| 2535 # get the userid | |
| 2536 userid = newvalues['assignedto'] | |
| 2537 if not db.security.hasPermission('Fixer', userid, cl.classname): | |
| 2538 raise ValueError, 'You do not have permission to edit %s'%cl.classname | |
| 2539 | |
| 2540 def init(db): | |
| 2541 db.issue.audit('set', assignedtoMustBeFixer) | |
| 2542 db.issue.audit('create', assignedtoMustBeFixer) | |
| 2543 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2544 So now, if an edit action attempts to set "assignedto" to a user that |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2545 doesn't have the "Fixer" Permission, the error will be raised. |
|
1147
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
2546 |
|
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
2547 |
|
1151
7e0024954954
making it easier to add new actions, and more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1150
diff
changeset
|
2548 Setting up a "wizard" (or "druid") for controlled adding of issues |
|
7e0024954954
making it easier to add new actions, and more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1150
diff
changeset
|
2549 ------------------------------------------------------------------ |
|
7e0024954954
making it easier to add new actions, and more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1150
diff
changeset
|
2550 |
|
1154
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2551 1. Set up the page templates you wish to use for data input. My wizard |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2552 is going to be a two-step process: first figuring out what category |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2553 of issue the user is submitting, and then getting details specific to |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2554 that category. The first page includes a table of help, explaining |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2555 what the category names mean, and then the core of the form:: |
|
1154
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2556 |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2557 <form method="POST" onSubmit="return submit_once()" |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2558 enctype="multipart/form-data"> |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2559 <input type="hidden" name=":template" value="add_page1"> |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2560 <input type="hidden" name=":action" value="page1submit"> |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2561 |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2562 <strong>Category:</strong> |
|
1156
d0da32fbdedc
gadfly backend now complete
Richard Jones <richard@users.sourceforge.net>
parents:
1154
diff
changeset
|
2563 <tal:block tal:replace="structure context/category/menu" /> |
|
1154
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2564 <input type="submit" value="Continue"> |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2565 </form> |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2566 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2567 The next page has the usual issue entry information, with the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2568 addition of the following form fragments:: |
|
1154
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2569 |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2570 <form method="POST" onSubmit="return submit_once()" |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2571 enctype="multipart/form-data" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2572 tal:condition="context/is_edit_ok" |
|
1154
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2573 tal:define="cat request/form/category/value"> |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2574 |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2575 <input type="hidden" name=":template" value="add_page2"> |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2576 <input type="hidden" name=":required" value="title"> |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2577 <input type="hidden" name="category" tal:attributes="value cat"> |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2578 . |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2579 . |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2580 . |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2581 </form> |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2582 |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2583 Note that later in the form, I test the value of "cat" include form |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2584 elements that are appropriate. For example:: |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2585 |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2586 <tal:block tal:condition="python:cat in '6 10 13 14 15 16 17'.split()"> |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2587 <tr> |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2588 <th nowrap>Operating System</th> |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2589 <td tal:content="structure context/os/field"></td> |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2590 </tr> |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2591 <tr> |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2592 <th nowrap>Web Browser</th> |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2593 <td tal:content="structure context/browser/field"></td> |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2594 </tr> |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2595 </tal:block> |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2596 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2597 ... the above section will only be displayed if the category is one |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2598 of 6, 10, 13, 14, 15, 16 or 17. |
|
1154
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2599 |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2600 3. Determine what actions need to be taken between the pages - these are |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2601 usually to validate user choices and determine what page is next. Now |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2602 encode those actions in methods on the ``interfaces.Client`` class |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2603 and insert hooks to those actions in the "actions" attribute on that |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2604 class, like so:: |
|
1151
7e0024954954
making it easier to add new actions, and more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1150
diff
changeset
|
2605 |
| 1262 | 2606 actions = client.Client.actions + ( |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2607 ('page1_submit', 'page1SubmitAction'), |
|
1151
7e0024954954
making it easier to add new actions, and more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1150
diff
changeset
|
2608 ) |
|
7e0024954954
making it easier to add new actions, and more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1150
diff
changeset
|
2609 |
|
7e0024954954
making it easier to add new actions, and more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1150
diff
changeset
|
2610 def page1SubmitAction(self): |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2611 ''' Verify that the user has selected a category, and then move |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2612 on to page 2. |
|
1154
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2613 ''' |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2614 category = self.form['category'].value |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2615 if category == '-1': |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2616 self.error_message.append('You must select a category of report') |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2617 return |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2618 # everything's ok, move on to the next page |
|
e0142ee233e8
more wizard example
Richard Jones <richard@users.sourceforge.net>
parents:
1151
diff
changeset
|
2619 self.template = 'add_page2' |
|
1151
7e0024954954
making it easier to add new actions, and more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1150
diff
changeset
|
2620 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2621 4. Use the usual "new" action as the ``:action`` on the final page, and |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2622 you're done (the standard context/submit method can do this for you). |
|
1151
7e0024954954
making it easier to add new actions, and more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1150
diff
changeset
|
2623 |
| 1236 | 2624 |
| 2625 Using an external password validation source | |
| 2626 -------------------------------------------- | |
| 2627 | |
| 2628 We have a centrally-managed password changing system for our users. This | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2629 results in a UN*X passwd-style file that we use for verification of |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2630 users. Entries in the file consist of ``name:password`` where the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2631 password is encrypted using the standard UN*X ``crypt()`` function (see |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2632 the ``crypt`` module in your Python distribution). An example entry |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2633 would be:: |
| 1236 | 2634 |
| 2635 admin:aamrgyQfDFSHw | |
| 2636 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2637 Each user of Roundup must still have their information stored in the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2638 Roundup database - we just use the passwd file to check their password. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2639 To do this, we add the following code to our ``Client`` class in the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2640 tracker home ``interfaces.py`` module:: |
| 1236 | 2641 |
| 2642 def verifyPassword(self, userid, password): | |
| 2643 # get the user's username | |
| 2644 username = self.db.user.get(userid, 'username') | |
| 2645 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2646 # the passwords are stored in the "passwd.txt" file in the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2647 # tracker home |
| 1236 | 2648 file = os.path.join(self.db.config.TRACKER_HOME, 'passwd.txt') |
| 2649 | |
| 2650 # see if we can find a match | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2651 for ent in [line.strip().split(':') for line in |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2652 open(file).readlines()]: |
| 1236 | 2653 if ent[0] == username: |
| 2654 return crypt.crypt(password, ent[1][:2]) == ent[1] | |
| 2655 | |
| 2656 # user doesn't exist in the file | |
| 2657 return 0 | |
| 2658 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2659 What this does is look through the file, line by line, looking for a |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2660 name that matches. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2661 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2662 We also remove the redundant password fields from the ``user.item`` |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2663 template. |
| 1236 | 2664 |
| 2665 | |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2666 Adding a "vacation" flag to users for stopping nosy messages |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2667 ------------------------------------------------------------ |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2668 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2669 When users go on vacation and set up vacation email bouncing, you'll |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2670 start to see a lot of messages come back through Roundup "Fred is on |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2671 vacation". Not very useful, and relatively easy to stop. |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2672 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2673 1. add a "vacation" flag to your users:: |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2674 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2675 user = Class(db, "user", |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2676 username=String(), password=Password(), |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2677 address=String(), realname=String(), |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2678 phone=String(), organisation=String(), |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2679 alternate_addresses=String(), |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2680 roles=String(), queries=Multilink("query"), |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2681 vacation=Boolean()) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2682 |
|
1522
d20680d611a6
added example HTML tempating for vacation flag [SF#701722]
Richard Jones <richard@users.sourceforge.net>
parents:
1503
diff
changeset
|
2683 2. So that users may edit the vacation flags, add something like the |
|
d20680d611a6
added example HTML tempating for vacation flag [SF#701722]
Richard Jones <richard@users.sourceforge.net>
parents:
1503
diff
changeset
|
2684 following to your ``user.item`` template:: |
|
d20680d611a6
added example HTML tempating for vacation flag [SF#701722]
Richard Jones <richard@users.sourceforge.net>
parents:
1503
diff
changeset
|
2685 |
|
d20680d611a6
added example HTML tempating for vacation flag [SF#701722]
Richard Jones <richard@users.sourceforge.net>
parents:
1503
diff
changeset
|
2686 <tr> |
|
d20680d611a6
added example HTML tempating for vacation flag [SF#701722]
Richard Jones <richard@users.sourceforge.net>
parents:
1503
diff
changeset
|
2687 <th>On Vacation</th> |
|
d20680d611a6
added example HTML tempating for vacation flag [SF#701722]
Richard Jones <richard@users.sourceforge.net>
parents:
1503
diff
changeset
|
2688 <td tal:content="structure context/vacation/field">vacation</td> |
|
d20680d611a6
added example HTML tempating for vacation flag [SF#701722]
Richard Jones <richard@users.sourceforge.net>
parents:
1503
diff
changeset
|
2689 </tr> |
|
d20680d611a6
added example HTML tempating for vacation flag [SF#701722]
Richard Jones <richard@users.sourceforge.net>
parents:
1503
diff
changeset
|
2690 |
|
d20680d611a6
added example HTML tempating for vacation flag [SF#701722]
Richard Jones <richard@users.sourceforge.net>
parents:
1503
diff
changeset
|
2691 3. edit your detector ``nosyreactor.py`` so that the ``nosyreaction()`` |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2692 consists of:: |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2693 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2694 def nosyreaction(db, cl, nodeid, oldvalues): |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2695 # send a copy of all new messages to the nosy list |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2696 for msgid in determineNewMessages(cl, nodeid, oldvalues): |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2697 try: |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2698 users = db.user |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2699 messages = db.msg |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2700 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2701 # figure the recipient ids |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2702 sendto = [] |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2703 r = {} |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2704 recipients = messages.get(msgid, 'recipients') |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2705 for recipid in messages.get(msgid, 'recipients'): |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2706 r[recipid] = 1 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2707 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2708 # figure the author's id, and indicate they've received |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2709 # the message |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2710 authid = messages.get(msgid, 'author') |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2711 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2712 # possibly send the message to the author, as long as |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2713 # they aren't anonymous |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2714 if (db.config.MESSAGES_TO_AUTHOR == 'yes' and |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2715 users.get(authid, 'username') != 'anonymous'): |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2716 sendto.append(authid) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2717 r[authid] = 1 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2718 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2719 # now figure the nosy people who weren't recipients |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2720 nosy = cl.get(nodeid, 'nosy') |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2721 for nosyid in nosy: |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2722 # Don't send nosy mail to the anonymous user (that |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2723 # user shouldn't appear in the nosy list, but just |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2724 # in case they do...) |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2725 if users.get(nosyid, 'username') == 'anonymous': |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2726 continue |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2727 # make sure they haven't seen the message already |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2728 if not r.has_key(nosyid): |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2729 # send it to them |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2730 sendto.append(nosyid) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2731 recipients.append(nosyid) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2732 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2733 # generate a change note |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2734 if oldvalues: |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2735 note = cl.generateChangeNote(nodeid, oldvalues) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2736 else: |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2737 note = cl.generateCreateNote(nodeid) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2738 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2739 # we have new recipients |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2740 if sendto: |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2741 # filter out the people on vacation |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2742 sendto = [i for i in sendto |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2743 if not users.get(i, 'vacation', 0)] |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2744 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2745 # map userids to addresses |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2746 sendto = [users.get(i, 'address') for i in sendto] |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2747 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2748 # update the message's recipients list |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2749 messages.set(msgid, recipients=recipients) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2750 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2751 # send the message |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2752 cl.send_message(nodeid, msgid, note, sendto) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2753 except roundupdb.MessageSendError, message: |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2754 raise roundupdb.DetectorError, message |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2755 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2756 Note that this is the standard nosy reaction code, with the small |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2757 addition of:: |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2758 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2759 # filter out the people on vacation |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2760 sendto = [i for i in sendto if not users.get(i, 'vacation', 0)] |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2761 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2762 which filters out the users that have the vacation flag set to true. |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2763 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2764 |
| 1262 | 2765 Adding a time log to your issues |
| 2766 -------------------------------- | |
| 2767 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2768 We want to log the dates and amount of time spent working on issues, and |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2769 be able to give a summary of the total time spent on a particular issue. |
| 1262 | 2770 |
| 2771 1. Add a new class to your tracker ``dbinit.py``:: | |
| 2772 | |
| 2773 # storage for time logging | |
| 2774 timelog = Class(db, "timelog", period=Interval()) | |
| 2775 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2776 Note that we automatically get the date of the time log entry |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2777 creation through the standard property "creation". |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2778 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2779 2. Link to the new class from your issue class (again, in |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2780 ``dbinit.py``):: |
| 1262 | 2781 |
| 2782 issue = IssueClass(db, "issue", | |
| 2783 assignedto=Link("user"), topic=Multilink("keyword"), | |
| 2784 priority=Link("priority"), status=Link("status"), | |
| 2785 times=Multilink("timelog")) | |
| 2786 | |
| 2787 the "times" property is the new link to the "timelog" class. | |
| 2788 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2789 3. We'll need to let people add in times to the issue, so in the web |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2790 interface we'll have a new entry field, just below the change note |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2791 box:: |
| 1262 | 2792 |
| 2793 <tr> | |
| 2794 <th nowrap>Time Log</th> | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2795 <td colspan="3"><input name=":timelog"> |
| 1262 | 2796 (enter as "3y 1m 4d 2:40:02" or parts thereof) |
| 2797 </td> | |
| 2798 </tr> | |
| 2799 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2800 Note that we've made up a new form variable, but since we place a |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2801 colon ":" in front of it, it won't clash with any existing property |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2802 variables. The names you *can't* use are ``:note``, ``:file``, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2803 ``:action``, ``:required`` and ``:template``. These variables are |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2804 described in the section `performing actions in web requests`_. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2805 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2806 4. We also need to handle this new field in the CGI interface - the way |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2807 to do this is through implementing a new form action (see `Setting up |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2808 a "wizard" (or "druid") for controlled adding of issues`_ for another |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2809 example where we implemented a new CGI form action). |
| 1262 | 2810 |
| 2811 In this case, we'll want our action to: | |
| 2812 | |
| 2813 1. create a new "timelog" entry, | |
| 2814 2. fake that the issue's "times" property has been edited, and then | |
| 2815 3. call the normal CGI edit action handler. | |
| 2816 | |
| 2817 The code to do this is:: | |
| 2818 | |
|
1406
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2819 class Client(client.Client): |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2820 ''' derives basic CGI implementation from the standard module, |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2821 with any specific extensions |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2822 ''' |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2823 actions = client.Client.actions + ( |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2824 ('edit_with_timelog', 'timelogEditAction'), |
|
1409
8dc60d87ab42
Fixed a backlog of bug reports, and worked on python 2.3 compatibility:
Richard Jones <richard@users.sourceforge.net>
parents:
1406
diff
changeset
|
2825 ('new_with_timelog', 'timelogEditAction'), |
|
1406
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2826 ) |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2827 |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2828 def timelogEditAction(self): |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2829 ''' Handle the creation of a new time log entry if |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2830 necessary. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2831 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2832 If we create a new entry, fake up a CGI form value for |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2833 the altered "times" property of the issue being edited. |
|
1406
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2834 |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2835 Punt to the regular edit action when we're done. |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2836 ''' |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2837 # if there's a timelog value specified, create an entry |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2838 if self.form.has_key(':timelog') and \ |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2839 self.form[':timelog'].value.strip(): |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2840 period = Interval(self.form[':timelog'].value) |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2841 # create it |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2842 newid = self.db.timelog.create(period=period) |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2843 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2844 # if we're editing an existing item, get the old timelog |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2845 # value |
|
1406
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2846 if self.nodeid: |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2847 l = self.db.issue.get(self.nodeid, 'times') |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2848 l.append(newid) |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2849 else: |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2850 l = [newid] |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2851 |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2852 # now make the fake CGI form values |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2853 for entry in l: |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2854 self.form.list.append( |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2855 MiniFieldStorage('times', entry)) |
|
1406
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2856 |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2857 # punt to the normal edit action |
|
1409
8dc60d87ab42
Fixed a backlog of bug reports, and worked on python 2.3 compatibility:
Richard Jones <richard@users.sourceforge.net>
parents:
1406
diff
changeset
|
2858 if self.nodeid: |
|
8dc60d87ab42
Fixed a backlog of bug reports, and worked on python 2.3 compatibility:
Richard Jones <richard@users.sourceforge.net>
parents:
1406
diff
changeset
|
2859 return self.editItemAction() |
|
8dc60d87ab42
Fixed a backlog of bug reports, and worked on python 2.3 compatibility:
Richard Jones <richard@users.sourceforge.net>
parents:
1406
diff
changeset
|
2860 else: |
|
8dc60d87ab42
Fixed a backlog of bug reports, and worked on python 2.3 compatibility:
Richard Jones <richard@users.sourceforge.net>
parents:
1406
diff
changeset
|
2861 return self.newItemAction() |
|
1406
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2862 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2863 you add this code to your Client class in your tracker's |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2864 ``interfaces.py`` file. Locate the section that looks like:: |
|
1406
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2865 |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2866 class Client: |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2867 ''' derives basic CGI implementation from the standard module, |
|
1406
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2868 with any specific extensions |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2869 ''' |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2870 pass |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2871 |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2872 and insert this code in place of the ``pass`` statement. |
| 1262 | 2873 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2874 5. You'll also need to modify your ``issue.item`` form submit action so |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2875 it calls the time logging action we just created. The current |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2876 template will look like this:: |
|
1406
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2877 |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2878 <tr> |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2879 <td> </td> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2880 <td colspan="3" tal:content="structure context/submit"> |
|
1406
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2881 submit button will go here |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2882 </td> |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2883 </tr> |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2884 |
|
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2885 replace it with this:: |
| 1262 | 2886 |
| 2887 <tr> | |
| 2888 <td> </td> | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2889 <td colspan="3"> |
| 1262 | 2890 <tal:block tal:condition="context/id"> |
| 2891 <input type="hidden" name=":action" value="edit_with_timelog"> | |
| 2892 <input type="submit" name="submit" value="Submit Changes"> | |
| 2893 </tal:block> | |
| 2894 <tal:block tal:condition="not:context/id"> | |
|
1409
8dc60d87ab42
Fixed a backlog of bug reports, and worked on python 2.3 compatibility:
Richard Jones <richard@users.sourceforge.net>
parents:
1406
diff
changeset
|
2895 <input type="hidden" name=":action" value="new_with_timelog"> |
| 1262 | 2896 <input type="submit" name="submit" value="Submit New Issue"> |
| 2897 </tal:block> | |
| 2898 </td> | |
| 2899 </tr> | |
| 2900 | |
|
1406
ca7dfc8bce15
fixes to time tracking customisation
Richard Jones <richard@users.sourceforge.net>
parents:
1374
diff
changeset
|
2901 The important change is setting the action to "edit_with_timelog" for |
|
1409
8dc60d87ab42
Fixed a backlog of bug reports, and worked on python 2.3 compatibility:
Richard Jones <richard@users.sourceforge.net>
parents:
1406
diff
changeset
|
2902 edit operations (where the item exists) and "new_with_timelog" for |
|
8dc60d87ab42
Fixed a backlog of bug reports, and worked on python 2.3 compatibility:
Richard Jones <richard@users.sourceforge.net>
parents:
1406
diff
changeset
|
2903 creations operations. |
| 1262 | 2904 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2905 6. We want to display a total of the time log times that have been |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2906 accumulated for an issue. To do this, we'll need to actually write |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2907 some Python code, since it's beyond the scope of PageTemplates to |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2908 perform such calculations. We do this by adding a method to the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2909 TemplatingUtils class in our tracker ``interfaces.py`` module:: |
|
1270
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2910 |
|
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2911 class TemplatingUtils: |
|
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2912 ''' Methods implemented on this class will be available to HTML |
|
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2913 templates through the 'utils' variable. |
|
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2914 ''' |
|
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2915 def totalTimeSpent(self, times): |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2916 ''' Call me with a list of timelog items (which have an |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2917 Interval "period" property) |
|
1270
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2918 ''' |
|
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2919 total = Interval('') |
|
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2920 for time in times: |
|
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2921 total += time.period._value |
|
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2922 return total |
|
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2923 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2924 Replace the ``pass`` line as we did in step 4 above with the Client |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2925 class. As indicated in the docstrings, we will be able to access the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2926 ``totalTimeSpent`` method via the ``utils`` variable in our |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2927 templates. |
|
1270
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2928 |
|
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2929 7. Display the time log for an issue:: |
| 1262 | 2930 |
| 2931 <table class="otherinfo" tal:condition="context/times"> | |
|
1270
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2932 <tr><th colspan="3" class="header">Time Log |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2933 <tal:block |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2934 tal:replace="python:utils.totalTimeSpent(context.times)" /> |
|
1270
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2935 </th></tr> |
| 1262 | 2936 <tr><th>Date</th><th>Period</th><th>Logged By</th></tr> |
| 2937 <tr tal:repeat="time context/times"> | |
| 2938 <td tal:content="time/creation"></td> | |
| 2939 <td tal:content="time/period"></td> | |
| 2940 <td tal:content="time/creator"></td> | |
| 2941 </tr> | |
| 2942 </table> | |
| 2943 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2944 I put this just above the Messages log in my issue display. Note our |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2945 use of the ``totalTimeSpent`` method which will total up the times |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2946 for the issue and return a new Interval. That will be automatically |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2947 displayed in the template as text like "+ 1y 2:40" (1 year, 2 hours |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2948 and 40 minutes). |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2949 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2950 8. If you're using a persistent web server - roundup-server or |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2951 mod_python for example - then you'll need to restart that to pick up |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2952 the code changes. When that's done, you'll be able to use the new |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2953 time logging interface. |
| 1262 | 2954 |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
2955 Using a UN*X passwd file as the user database |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
2956 --------------------------------------------- |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
2957 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2958 On some systems the primary store of users is the UN*X passwd file. It |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2959 holds information on users such as their username, real name, password |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2960 and primary user group. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2961 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2962 Roundup can use this store as its primary source of user information, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2963 but it needs additional information too - email address(es), roundup |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2964 Roles, vacation flags, roundup hyperdb item ids, etc. Also, "retired" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2965 users must still exist in the user database, unlike some passwd files in |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2966 which the users are removed when they no longer have access to a system. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2967 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2968 To make use of the passwd file, we therefore synchronise between the two |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2969 user stores. We also use the passwd file to validate the user logins, as |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2970 described in the previous example, `using an external password |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2971 validation source`_. We keep the users lists in sync using a fairly |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2972 simple script that runs once a day, or several times an hour if more |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2973 immediate access is needed. In short, it: |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
2974 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
2975 1. parses the passwd file, finding usernames, passwords and real names, |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
2976 2. compares that list to the current roundup user list: |
|
1299
b2d04ce03802
Email improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
1293
diff
changeset
|
2977 |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
2978 a. entries no longer in the passwd file are *retired* |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
2979 b. entries with mismatching real names are *updated* |
| 1293 | 2980 c. entries only exist in the passwd file are *created* |
|
1299
b2d04ce03802
Email improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
1293
diff
changeset
|
2981 |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
2982 3. send an email to administrators to let them know what's been done. |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
2983 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2984 The retiring and updating are simple operations, requiring only a call |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2985 to ``retire()`` or ``set()``. The creation operation requires more |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2986 information though - the user's email address and their roundup Roles. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2987 We're going to assume that the user's email address is the same as their |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2988 login name, so we just append the domain name to that. The Roles are |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2989 determined using the passwd group identifier - mapping their UN*X group |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2990 to an appropriate set of Roles. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2991 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2992 The script to perform all this, broken up into its main components, is |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2993 as follows. Firstly, we import the necessary modules and open the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2994 tracker we're to work on:: |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
2995 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
2996 import sys, os, smtplib |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
2997 from roundup import instance, date |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
2998 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
2999 # open the tracker |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3000 tracker_home = sys.argv[1] |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3001 tracker = instance.open(tracker_home) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3002 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3003 Next we read in the *passwd* file from the tracker home:: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3004 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3005 # read in the users |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3006 file = os.path.join(tracker_home, 'users.passwd') |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3007 users = [x.strip().split(':') for x in open(file).readlines()] |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3008 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3009 Handle special users (those to ignore in the file, and those who don't |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3010 appear in the file):: |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3011 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3012 # users to not keep ever, pre-load with the users I know aren't |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3013 # "real" users |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3014 ignore = ['ekmmon', 'bfast', 'csrmail'] |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3015 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3016 # users to keep - pre-load with the roundup-specific users |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3017 keep = ['comment_pool', 'network_pool', 'admin', 'dev-team', |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3018 'cs_pool', 'anonymous', 'system_pool', 'automated'] |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3019 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3020 Now we map the UN*X group numbers to the Roles that users should have:: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3021 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3022 roles = { |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3023 '501': 'User,Tech', # tech |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3024 '502': 'User', # finance |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3025 '503': 'User,CSR', # customer service reps |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3026 '504': 'User', # sales |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3027 '505': 'User', # marketing |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3028 } |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3029 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3030 Now we do all the work. Note that the body of the script (where we have |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3031 the tracker database open) is wrapped in a ``try`` / ``finally`` clause, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3032 so that we always close the database cleanly when we're finished. So, we |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3033 now do all the work:: |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3034 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3035 # open the database |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3036 db = tracker.open('admin') |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3037 try: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3038 # store away messages to send to the tracker admins |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3039 msg = [] |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3040 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3041 # loop over the users list read in from the passwd file |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3042 for user,passw,uid,gid,real,home,shell in users: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3043 if user in ignore: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3044 # this user shouldn't appear in our tracker |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3045 continue |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3046 keep.append(user) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3047 try: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3048 # see if the user exists in the tracker |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3049 uid = db.user.lookup(user) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3050 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3051 # yes, they do - now check the real name for correctness |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3052 if real != db.user.get(uid, 'realname'): |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3053 db.user.set(uid, realname=real) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3054 msg.append('FIX %s - %s'%(user, real)) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3055 except KeyError: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3056 # nope, the user doesn't exist |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3057 db.user.create(username=user, realname=real, |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3058 address='%s@ekit-inc.com'%user, roles=roles[gid]) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3059 msg.append('ADD %s - %s (%s)'%(user, real, roles[gid])) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3060 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3061 # now check that all the users in the tracker are also in our |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3062 # "keep" list - retire those who aren't |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3063 for uid in db.user.list(): |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3064 user = db.user.get(uid, 'username') |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3065 if user not in keep: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3066 db.user.retire(uid) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3067 msg.append('RET %s'%user) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3068 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3069 # if we did work, then send email to the tracker admins |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3070 if msg: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3071 # create the email |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3072 msg = '''Subject: %s user database maintenance |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3073 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3074 %s |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3075 '''%(db.config.TRACKER_NAME, '\n'.join(msg)) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3076 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3077 # send the email |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3078 smtp = smtplib.SMTP(db.config.MAILHOST) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3079 addr = db.config.ADMIN_EMAIL |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3080 smtp.sendmail(addr, addr, msg) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3081 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3082 # now we're done - commit the changes |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3083 db.commit() |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3084 finally: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3085 # always close the database cleanly |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3086 db.close() |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3087 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3088 And that's it! |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3089 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3090 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3091 Enabling display of either message summaries or the entire messages |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3092 ------------------------------------------------------------------- |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3093 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3094 This is pretty simple - all we need to do is copy the code from the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3095 example `displaying only message summaries in the issue display`_ into |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3096 our template alongside the summary display, and then introduce a switch |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3097 that shows either one or the other. We'll use a new form variable, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3098 ``:whole_messages`` to achieve this:: |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3099 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3100 <table class="messages" tal:condition="context/messages"> |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3101 <tal:block tal:condition="not:request/form/:whole_messages/value | python:0"> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3102 <tr><th colspan="3" class="header">Messages</th> |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3103 <th colspan="2" class="header"> |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3104 <a href="?:whole_messages=yes">show entire messages</a> |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3105 </th> |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3106 </tr> |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3107 <tr tal:repeat="msg context/messages"> |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3108 <td><a tal:attributes="href string:msg${msg/id}" |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3109 tal:content="string:msg${msg/id}"></a></td> |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3110 <td tal:content="msg/author">author</td> |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3111 <td nowrap tal:content="msg/date/pretty">date</td> |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3112 <td tal:content="msg/summary">summary</td> |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3113 <td> |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3114 <a tal:attributes="href string:?:remove:messages=${msg/id}&:action=edit">remove</a> |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3115 </td> |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3116 </tr> |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3117 </tal:block> |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3118 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3119 <tal:block tal:condition="request/form/:whole_messages/value | python:0"> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3120 <tr><th colspan="2" class="header">Messages</th> |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3121 <th class="header"> |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3122 <a href="?:whole_messages=">show only summaries</a> |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3123 </th> |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3124 </tr> |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3125 <tal:block tal:repeat="msg context/messages"> |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3126 <tr> |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3127 <th tal:content="msg/author">author</th> |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3128 <th nowrap tal:content="msg/date/pretty">date</th> |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3129 <th style="text-align: right"> |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3130 (<a tal:attributes="href string:?:remove:messages=${msg/id}&:action=edit">remove</a>) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3131 </th> |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3132 </tr> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3133 <tr><td colspan="3" tal:content="msg/content"></td></tr> |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3134 </tal:block> |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3135 </tal:block> |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3136 </table> |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3137 |
| 1262 | 3138 |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3139 Blocking issues that depend on other issues |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3140 ------------------------------------------- |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3141 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3142 We needed the ability to mark certain issues as "blockers" - that is, |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3143 they can't be resolved until another issue (the blocker) they rely on is |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3144 resolved. To achieve this: |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3145 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3146 1. Create a new property on the issue Class, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3147 ``blockers=Multilink("issue")``. Edit your tracker's dbinit.py file. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3148 Where the "issue" class is defined, something like:: |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3149 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3150 issue = IssueClass(db, "issue", |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3151 assignedto=Link("user"), topic=Multilink("keyword"), |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3152 priority=Link("priority"), status=Link("status")) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3153 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3154 add the blockers entry like so:: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3155 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3156 issue = IssueClass(db, "issue", |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3157 blockers=Multilink("issue"), |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3158 assignedto=Link("user"), topic=Multilink("keyword"), |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3159 priority=Link("priority"), status=Link("status")) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3160 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3161 2. Add the new "blockers" property to the issue.item edit page, using |
| 1560 | 3162 something like:: |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3163 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3164 <th nowrap>Waiting On</th> |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3165 <td> |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3166 <span tal:replace="structure python:context.blockers.field(showid=1, |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3167 size=20)" /> |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3168 <span tal:replace="structure python:db.issue.classhelp('id,title')" /> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3169 <span tal:condition="context/blockers" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3170 tal:repeat="blk context/blockers"> |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3171 <br>View: <a tal:attributes="href string:issue${blk/id}" |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3172 tal:content="blk/id"></a> |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3173 </span> |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3174 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3175 You'll need to fiddle with your item page layout to find an |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3176 appropriate place to put it - I'll leave that fun part up to you. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3177 Just make sure it appears in the first table, possibly somewhere near |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3178 the "superseders" field. |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3179 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3180 3. Create a new detector module (attached) which enforces the rules: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3181 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3182 - issues may not be resolved if they have blockers |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3183 - when a blocker is resolved, it's removed from issues it blocks |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3184 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3185 The contents of the detector should be something like this:: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3186 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3187 def blockresolution(db, cl, nodeid, newvalues): |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3188 ''' If the issue has blockers, don't allow it to be resolved. |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3189 ''' |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3190 if nodeid is None: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3191 blockers = [] |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3192 else: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3193 blockers = cl.get(nodeid, 'blockers') |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3194 blockers = newvalues.get('blockers', blockers) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3195 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3196 # don't do anything if there's no blockers or the status hasn't |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3197 # changed |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3198 if not blockers or not newvalues.has_key('status'): |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3199 return |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3200 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3201 # get the resolved state ID |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3202 resolved_id = db.status.lookup('resolved') |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3203 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3204 # format the info |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3205 u = db.config.TRACKER_WEB |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3206 s = ', '.join(['<a href="%sissue%s">%s</a>'%( |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3207 u,id,id) for id in blockers]) |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3208 if len(blockers) == 1: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3209 s = 'issue %s is'%s |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3210 else: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3211 s = 'issues %s are'%s |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3212 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3213 # ok, see if we're trying to resolve |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3214 if newvalues['status'] == resolved_id: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3215 raise ValueError, "This issue can't be resolved until %s resolved."%s |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3216 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3217 def resolveblockers(db, cl, nodeid, newvalues): |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3218 ''' When we resolve an issue that's a blocker, remove it from the |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3219 blockers list of the issue(s) it blocks. |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3220 ''' |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3221 if not newvalues.has_key('status'): |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3222 return |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3223 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3224 # get the resolved state ID |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3225 resolved_id = db.status.lookup('resolved') |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3226 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3227 # interesting? |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3228 if newvalues['status'] != resolved_id: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3229 return |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3230 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3231 # yes - find all the blocked issues, if any, and remove me from |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3232 # their blockers list |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3233 issues = cl.find(blockers=nodeid) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3234 for issueid in issues: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3235 blockers = cl.get(issueid, 'blockers') |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3236 if nodeid in blockers: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3237 blockers.remove(nodeid) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3238 cl.set(issueid, blockers=blockers) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3239 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3240 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3241 def init(db): |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3242 # might, in an obscure situation, happen in a create |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3243 db.issue.audit('create', blockresolution) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3244 db.issue.audit('set', blockresolution) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3245 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3246 # can only happen on a set |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3247 db.issue.react('set', resolveblockers) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3248 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3249 Put the above code in a file called "blockers.py" in your tracker's |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3250 "detectors" directory. |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3251 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3252 4. Finally, and this is an optional step, modify the tracker web page |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3253 URLs so they filter out issues with any blockers. You do this by |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3254 adding an additional filter on "blockers" for the value "-1". For |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3255 example, the existing "Show All" link in the "page" template (in the |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3256 tracker's "html" directory) looks like this:: |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3257 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3258 <a href="issue?:sort=-activity&:group=priority&:filter=status&:columns=id,activity,title,creator,assignedto,status&status=-1,1,2,3,4,5,6,7">Show All</a><br> |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3259 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3260 modify it to add the "blockers" info to the URL (note, both the |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3261 ":filter" *and* "blockers" values must be specified):: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3262 |
|
1568
d181aff91b40
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1560
diff
changeset
|
3263 <a href="issue?:sort=-activity&:group=priority&:filter=status,blockers&blockers=-1&:columns=id,activity,title,creator,assignedto,status&status=-1,1,2,3,4,5,6,7">Show All</a><br> |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3264 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3265 That's it. You should now be able to set blockers on your issues. Note |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3266 that if you want to know whether an issue has any other issues dependent |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3267 on it (i.e. it's in their blockers list) you can look at the journal |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3268 history at the bottom of the issue page - look for a "link" event to |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3269 another issue's "blockers" property. |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3270 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3271 |
| 1098 | 3272 ------------------- |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3273 |
|
686
c52122f38c9b
Documentation cleanup, added info for potential (and current) developers
Richard Jones <richard@users.sourceforge.net>
parents:
684
diff
changeset
|
3274 Back to `Table of Contents`_ |
|
c52122f38c9b
Documentation cleanup, added info for potential (and current) developers
Richard Jones <richard@users.sourceforge.net>
parents:
684
diff
changeset
|
3275 |
|
c52122f38c9b
Documentation cleanup, added info for potential (and current) developers
Richard Jones <richard@users.sourceforge.net>
parents:
684
diff
changeset
|
3276 .. _`Table of Contents`: index.html |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
3277 .. _`design documentation`: design.html |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
3278 |
