Mercurial > p > roundup > code
annotate doc/customizing.txt @ 2478:3ab2b91cdd2c
*** empty log message ***
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Thu, 17 Jun 2004 08:40:52 +0000 |
| parents | 096063697f77 |
| children | 38166eb3100f |
| 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 |
| 2409 | 5 :Version: $Revision: 1.138 $ |
|
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 |
|
1850
6e80f8f760a4
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1832
diff
changeset
|
19 Customisation of Roundup can take one of six 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_ |
|
2003
a291bf753037
maintenance -> admin guide
Richard Jones <richard@users.sourceforge.net>
parents:
1998
diff
changeset
|
25 5. `security / 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 |
|
2121
fd5459469069
Did a couple of things:
Eddie Parker <eparker@users.sourceforge.net>
parents:
2088
diff
changeset
|
149 **ERROR_MESSAGES_TO** - ``'user'``, ``'dispatcher'`` or ``'both'`` |
|
2122
7109f83d5250
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2121
diff
changeset
|
150 Sends error messages to the dispatcher, user, or both. It will use the |
|
7109f83d5250
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2121
diff
changeset
|
151 ``DISPATCHER_EMAIL`` address if set, otherwise it'll use the |
|
7109f83d5250
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2121
diff
changeset
|
152 ``ADMIN_EMAIL`` address. |
|
7109f83d5250
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2121
diff
changeset
|
153 |
|
7109f83d5250
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2121
diff
changeset
|
154 **DISPATCHER_EMAIL** - ``''`` |
|
7109f83d5250
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2121
diff
changeset
|
155 The email address that Roundup will issue all error messages to. This is |
|
7109f83d5250
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2121
diff
changeset
|
156 also useful if you want to switch your 'new message' notification to |
|
7109f83d5250
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2121
diff
changeset
|
157 a central user. |
|
2121
fd5459469069
Did a couple of things:
Eddie Parker <eparker@users.sourceforge.net>
parents:
2088
diff
changeset
|
158 |
|
2397
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
159 **LOGGGING_CONFIG** - ``os.path.join(TRACKER_HOME, 'logging.ini')`` |
|
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
160 This variable activates logging of Roundup's internal messages using the |
|
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
161 standard python ``logging`` module. The module is configured using the |
|
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
162 indicated configuration file. |
|
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
163 |
|
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
164 **LOGGING_FILENAME** - ``'/path/to/log file'`` |
|
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
165 This variable activates logging of Roundup's internal messages using a |
|
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
166 built-in minimal logging service which appends messages to the indicated |
|
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
167 file. |
|
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
168 |
|
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
169 **LOGGING_LEVEL** - ``'DEBUG'``, ``'INFO'``, ``'WARNING'`` or ``'ERROR'`` |
|
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
170 This variable determines the level of messages logged by the built-in |
|
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
171 logging service - messages of the level named and higher will be sent to |
|
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
172 the ``LOGGING_FILENAME`` file. Not used when the ``LOGGGING_CONFIG`` |
|
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
173 variable is set. |
|
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
174 |
|
1602
a3442208867f
mention MESSAGES_TO_AUTHOR "new" setting [SF#724518]
Richard Jones <richard@users.sourceforge.net>
parents:
1570
diff
changeset
|
175 **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
|
176 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
|
177 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
|
178 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
|
179 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
|
180 |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
181 **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
|
182 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
|
183 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
|
184 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
|
185 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
|
186 |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
187 **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
|
188 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
|
189 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
|
190 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
|
191 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
|
192 |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
193 **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
|
194 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
|
195 |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
196 **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
|
197 Keep email citations. Citations are the part of e-mail which the sender has |
|
1998
a62786cb094f
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
1980
diff
changeset
|
198 quoted in their reply to previous e-mail with ``>`` or ``|`` characters at |
|
a62786cb094f
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
1980
diff
changeset
|
199 the start of the line. |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
200 |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
201 **EMAIL_LEAVE_BODY_UNCHANGED** - ``'no'`` |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
202 Preserve the email body as is. Enabiling this will cause the entire message |
|
1998
a62786cb094f
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
1980
diff
changeset
|
203 body to be stored, including all citations, signatures and Outlook-quoted |
|
a62786cb094f
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
1980
diff
changeset
|
204 sections (ie. "Original Message" blocks). It should be either ``'yes'`` |
|
a62786cb094f
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
1980
diff
changeset
|
205 or ``'no'``. |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
206 |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
207 **MAIL_DEFAULT_CLASS** - ``'issue'`` or ``''`` |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
208 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
|
209 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
|
210 |
|
1952
c40ed9113285
Applied Stefan Seefeld's html4/xhtml patch with some changes.
Richard Jones <richard@users.sourceforge.net>
parents:
1918
diff
changeset
|
211 **HTML_VERSION** - ``'html4'`` or ``'xhtml'`` |
|
c40ed9113285
Applied Stefan Seefeld's html4/xhtml patch with some changes.
Richard Jones <richard@users.sourceforge.net>
parents:
1918
diff
changeset
|
212 HTML version to generate. The templates are html4 by default. If you |
|
c40ed9113285
Applied Stefan Seefeld's html4/xhtml patch with some changes.
Richard Jones <richard@users.sourceforge.net>
parents:
1918
diff
changeset
|
213 wish to make them xhtml, then you'll need to change this var to 'xhtml' |
|
c40ed9113285
Applied Stefan Seefeld's html4/xhtml patch with some changes.
Richard Jones <richard@users.sourceforge.net>
parents:
1918
diff
changeset
|
214 too so all auto-generated HTML is compliant. |
|
c40ed9113285
Applied Stefan Seefeld's html4/xhtml patch with some changes.
Richard Jones <richard@users.sourceforge.net>
parents:
1918
diff
changeset
|
215 |
|
2034
be047db3dd3d
Eudora can't handle utf-8 headers. We love Eudora. [SF#900046]
Richard Jones <richard@users.sourceforge.net>
parents:
2017
diff
changeset
|
216 **EMAIL_CHARSET** - ``utf-8`` (or ``iso-8859-1`` for Eudora users) |
|
be047db3dd3d
Eudora can't handle utf-8 headers. We love Eudora. [SF#900046]
Richard Jones <richard@users.sourceforge.net>
parents:
2017
diff
changeset
|
217 Character set to encode email headers with. We use utf-8 by default, as |
|
be047db3dd3d
Eudora can't handle utf-8 headers. We love Eudora. [SF#900046]
Richard Jones <richard@users.sourceforge.net>
parents:
2017
diff
changeset
|
218 it's the most flexible. Some mail readers (eg. Eudora) can't cope with |
|
be047db3dd3d
Eudora can't handle utf-8 headers. We love Eudora. [SF#900046]
Richard Jones <richard@users.sourceforge.net>
parents:
2017
diff
changeset
|
219 that, so you might need to specify a more limited character set (eg. |
|
be047db3dd3d
Eudora can't handle utf-8 headers. We love Eudora. [SF#900046]
Richard Jones <richard@users.sourceforge.net>
parents:
2017
diff
changeset
|
220 'iso-8859-1'. |
|
be047db3dd3d
Eudora can't handle utf-8 headers. We love Eudora. [SF#900046]
Richard Jones <richard@users.sourceforge.net>
parents:
2017
diff
changeset
|
221 |
|
2149
702f9a6afdcf
Added DEFAULT_TIMEZONE. Fixed up some missing info from What's New.
Richard Jones <richard@users.sourceforge.net>
parents:
2138
diff
changeset
|
222 **DEFAULT_TIMEZONE** - ``0`` |
|
702f9a6afdcf
Added DEFAULT_TIMEZONE. Fixed up some missing info from What's New.
Richard Jones <richard@users.sourceforge.net>
parents:
2138
diff
changeset
|
223 Numeric hour timezone offest to be used when displaying local times. |
|
702f9a6afdcf
Added DEFAULT_TIMEZONE. Fixed up some missing info from What's New.
Richard Jones <richard@users.sourceforge.net>
parents:
2138
diff
changeset
|
224 The default timezone is used when users do not choose their own in |
|
702f9a6afdcf
Added DEFAULT_TIMEZONE. Fixed up some missing info from What's New.
Richard Jones <richard@users.sourceforge.net>
parents:
2138
diff
changeset
|
225 their settings. |
|
702f9a6afdcf
Added DEFAULT_TIMEZONE. Fixed up some missing info from What's New.
Richard Jones <richard@users.sourceforge.net>
parents:
2138
diff
changeset
|
226 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
227 The default config.py is given below - as you |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
228 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
|
229 tracker is attempted.:: |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
230 |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
231 # 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
|
232 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
|
233 |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
234 # 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
|
235 MAILHOST = 'localhost' |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
236 |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
237 # 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
|
238 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
|
239 |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
240 # 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
|
241 DATABASE = os.path.join(TRACKER_HOME, 'db') |
|
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 # 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
|
244 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
|
245 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
246 # 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
|
247 TRACKER_NAME = 'Roundup issue tracker' |
|
794
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 # 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
|
250 TRACKER_EMAIL = 'issue_tracker@%s'%MAIL_DOMAIN |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
251 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
252 # 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
|
253 # 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
|
254 # 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
|
255 # 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
|
256 # in the URL. |
|
1360
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
257 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
|
258 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
259 # 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
|
260 # trouble |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
261 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
|
262 |
|
2397
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
263 # These variables define where to log Roundup's internal messages to. |
|
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
264 # You have two choices - either using the standard Python logging module |
|
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
265 # or a minimal logging facility built into Roundup. The former is activated |
|
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
266 # when you provide a LOGGING_CONFIG variable below which contains the |
|
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
267 # configuration of the logging module. The latter is activated when you |
|
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
268 # provide the LOGGING_FILENAME and optionally LOGGING_LEVEL variables. If |
|
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
269 # none of these variables are defined then only errors will be logged, and |
|
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
270 # they will go to stderr. |
|
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
271 # LOGGGING_CONFIG = os.path.join(TRACKER_HOME, 'logging.ini') |
|
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
272 # or, |
|
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
273 # LOGGING_FILENAME = '/path/to/log file' |
|
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
274 # LOGGING_LEVEL = 'INFO' # one of 'DEBUG', 'INFO', 'WARNING', 'ERROR' |
|
fa50e1347397
added basic logging support
Richard Jones <richard@users.sourceforge.net>
parents:
2296
diff
changeset
|
275 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
276 # 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
|
277 # 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
|
278 # 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
|
279 # 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
|
280 # "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
|
281 EMAIL_FROM_TAG = "" |
|
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
282 |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
283 # 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
|
284 MESSAGES_TO_AUTHOR = 'no' # either 'yes' or 'no' |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
285 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
286 # 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
|
287 # 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
|
288 # 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
|
289 # 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
|
290 # added to the nosy. |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
291 ADD_AUTHOR_TO_NOSY = 'new' # one of 'yes', 'no', 'new' |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
292 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
293 # 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
|
294 # 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
|
295 # 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
|
296 # 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
|
297 # the nosy. |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
298 ADD_RECIPIENTS_TO_NOSY = 'new' # either 'yes', 'no', 'new' |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
299 |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
300 # Where to place the email signature |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
301 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
|
302 |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
303 # Keep email citations |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
304 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
|
305 |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
306 # Preserve the email body as is |
|
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
307 EMAIL_LEAVE_BODY_UNCHANGED = 'no' # either 'yes' or 'no' |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
308 |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
309 # 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
|
310 # 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
|
311 # blank. Examples: |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
312 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
|
313 #MAIL_DEFAULT_CLASS = '' # disable (or just comment the var out) |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
314 |
|
1952
c40ed9113285
Applied Stefan Seefeld's html4/xhtml patch with some changes.
Richard Jones <richard@users.sourceforge.net>
parents:
1918
diff
changeset
|
315 # HTML version to generate. The templates are html4 by default. If you |
|
c40ed9113285
Applied Stefan Seefeld's html4/xhtml patch with some changes.
Richard Jones <richard@users.sourceforge.net>
parents:
1918
diff
changeset
|
316 # wish to make them xhtml, then you'll need to change this var to 'xhtml' |
|
c40ed9113285
Applied Stefan Seefeld's html4/xhtml patch with some changes.
Richard Jones <richard@users.sourceforge.net>
parents:
1918
diff
changeset
|
317 # too so all auto-generated HTML is compliant. |
|
c40ed9113285
Applied Stefan Seefeld's html4/xhtml patch with some changes.
Richard Jones <richard@users.sourceforge.net>
parents:
1918
diff
changeset
|
318 HTML_VERSION = 'html4' # either 'html4' or 'xhtml' |
|
c40ed9113285
Applied Stefan Seefeld's html4/xhtml patch with some changes.
Richard Jones <richard@users.sourceforge.net>
parents:
1918
diff
changeset
|
319 |
|
2034
be047db3dd3d
Eudora can't handle utf-8 headers. We love Eudora. [SF#900046]
Richard Jones <richard@users.sourceforge.net>
parents:
2017
diff
changeset
|
320 # Character set to encode email headers with. We use utf-8 by default, as |
|
be047db3dd3d
Eudora can't handle utf-8 headers. We love Eudora. [SF#900046]
Richard Jones <richard@users.sourceforge.net>
parents:
2017
diff
changeset
|
321 # it's the most flexible. Some mail readers (eg. Eudora) can't cope with |
|
be047db3dd3d
Eudora can't handle utf-8 headers. We love Eudora. [SF#900046]
Richard Jones <richard@users.sourceforge.net>
parents:
2017
diff
changeset
|
322 # that, so you might need to specify a more limited character set (eg. |
|
be047db3dd3d
Eudora can't handle utf-8 headers. We love Eudora. [SF#900046]
Richard Jones <richard@users.sourceforge.net>
parents:
2017
diff
changeset
|
323 # 'iso-8859-1'. |
|
be047db3dd3d
Eudora can't handle utf-8 headers. We love Eudora. [SF#900046]
Richard Jones <richard@users.sourceforge.net>
parents:
2017
diff
changeset
|
324 EMAIL_CHARSET = 'utf-8' |
|
be047db3dd3d
Eudora can't handle utf-8 headers. We love Eudora. [SF#900046]
Richard Jones <richard@users.sourceforge.net>
parents:
2017
diff
changeset
|
325 #EMAIL_CHARSET = 'iso-8859-1' # use this instead for Eudora users |
|
be047db3dd3d
Eudora can't handle utf-8 headers. We love Eudora. [SF#900046]
Richard Jones <richard@users.sourceforge.net>
parents:
2017
diff
changeset
|
326 |
|
2149
702f9a6afdcf
Added DEFAULT_TIMEZONE. Fixed up some missing info from What's New.
Richard Jones <richard@users.sourceforge.net>
parents:
2138
diff
changeset
|
327 # You may specify a different default timezone, for use when users do not |
|
702f9a6afdcf
Added DEFAULT_TIMEZONE. Fixed up some missing info from What's New.
Richard Jones <richard@users.sourceforge.net>
parents:
2138
diff
changeset
|
328 # choose their own in their settings. |
|
702f9a6afdcf
Added DEFAULT_TIMEZONE. Fixed up some missing info from What's New.
Richard Jones <richard@users.sourceforge.net>
parents:
2138
diff
changeset
|
329 DEFAULT_TIMEZONE = 0 # specify as numeric hour offest |
|
702f9a6afdcf
Added DEFAULT_TIMEZONE. Fixed up some missing info from What's New.
Richard Jones <richard@users.sourceforge.net>
parents:
2138
diff
changeset
|
330 |
|
1360
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
331 # |
|
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
332 # SECURITY DEFINITIONS |
|
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
333 # |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
334 # 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
|
335 # 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
|
336 # 'Admin,User') |
|
1360
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
337 NEW_WEB_USER_ROLES = 'User' |
|
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
338 NEW_EMAIL_USER_ROLES = 'User' |
|
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
339 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
340 Tracker Schema |
| 1098 | 341 ============== |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
342 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
343 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
|
344 `web interface`_ HTML template files and `detectors`_ to reflect |
|
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
345 your changes. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
346 |
| 1091 | 347 A tracker schema defines what data is stored in the tracker's database. |
| 348 Schemas are defined using Python code in the ``dbinit.py`` module of your | |
|
2153
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
349 tracker. |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
350 |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
351 The ``dbinit.py`` module |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
352 ------------------------ |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
353 |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
354 The ``dbinit.py`` module contains two functions: |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
355 |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
356 **open** |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
357 This function defines what your tracker looks like on the inside, the |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
358 **schema** of the tracker. It defines the **Classes** and **properties** |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
359 on each class. It also defines the **security** for those Classes. The |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
360 next few sections describe how schemas work and what you can do with |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
361 them. |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
362 **init** |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
363 This function is responsible for setting up the initial state of your |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
364 tracker. It's called exactly once - but the ``roundup-admin initialise`` |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
365 command. See the start of the section on `database content`_ for more |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
366 info about how this works. |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
367 |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
368 |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
369 The "classic" schema |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
370 -------------------- |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
371 |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
372 The "classic" schema looks like this (see below for the meaning |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
373 of ``'setkey'``):: |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
374 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
375 pri = Class(db, "priority", name=String(), order=String()) |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
376 pri.setkey("name") |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
377 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
378 stat = Class(db, "status", name=String(), order=String()) |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
379 stat.setkey("name") |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
380 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
381 keyword = Class(db, "keyword", name=String()) |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
382 keyword.setkey("name") |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
383 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
384 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
|
385 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
|
386 phone=String()) |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
387 user.setkey("username") |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
388 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
389 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
|
390 date=Date(), recipients=Multilink("user"), |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
391 files=Multilink("file")) |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
392 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
393 file = FileClass(db, "file", name=String(), type=String()) |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
394 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
395 issue = IssueClass(db, "issue", topic=Multilink("keyword"), |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
396 status=Link("status"), assignedto=Link("user"), |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
397 priority=Link("priority")) |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
398 issue.setkey('title') |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
399 |
| 1832 | 400 |
| 401 What you can't do to the schema | |
| 402 ------------------------------- | |
| 403 | |
| 404 You must never: | |
| 405 | |
| 406 **Remove the users class** | |
| 407 This class is the only *required* class in Roundup. Similarly, its | |
| 408 username, password and address properties must never be removed. | |
| 409 | |
| 410 **Change the type of a property** | |
| 411 Property types must *never* be changed - the database simply doesn't take | |
| 412 this kind of action into account. Note that you can't just remove a | |
| 413 property and re-add it as a new type either. If you wanted to make the | |
| 414 assignedto property a Multilink, you'd need to create a new property | |
| 415 assignedto_list and remove the old assignedto property. | |
| 416 | |
| 417 | |
| 418 What you can do to the schema | |
| 419 ----------------------------- | |
| 420 | |
| 421 Your schema may be changed at any time before or after the tracker has been | |
| 422 initialised (or used). You may: | |
| 423 | |
| 424 **Add new properties to classes, or add whole new classes** | |
| 425 This is painless and easy to do - there are generally no repurcussions | |
| 426 from adding new information to a tracker's schema. | |
| 427 | |
| 428 **Remove properties** | |
| 429 Removing properties is a little more tricky - you need to make sure that | |
| 430 the property is no longer used in the `web interface`_ *or* by the | |
| 431 detectors_. | |
| 432 | |
| 433 | |
| 434 | |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
435 Classes and Properties - creating a new information store |
| 1098 | 436 --------------------------------------------------------- |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
437 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
438 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
|
439 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
440 priority |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
441 Defines the possible levels of urgency for issues. |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
442 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
443 status |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
444 Defines the possible states of processing the issue may be in. |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
445 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
446 keyword |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
447 Initially empty, will hold keywords useful for searching issues. |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
448 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
449 user |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
450 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
|
451 for all users using roundup. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
452 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
453 msg |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
454 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
|
455 generated by roundup. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
456 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
457 file |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
458 Initially empty, will hold all files attached to issues. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
459 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
460 issue |
| 1091 | 461 Initially empty, this is where the issue information is stored. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
462 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
463 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
|
464 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
|
465 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
|
466 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
|
467 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
|
468 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
|
469 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
470 |
| 1091 | 471 Class and Items |
| 1098 | 472 ~~~~~~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
473 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
474 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
|
475 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
|
476 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
|
477 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
478 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
|
479 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
|
480 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
|
481 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
482 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
483 Properties |
| 1098 | 484 ~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
485 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
486 A Class is comprised of one or more properties of the following types: |
| 1091 | 487 |
| 488 * 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
|
489 * 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
|
490 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
|
491 class. |
| 1091 | 492 * Date properties store date-and-time stamps. Their values are Timestamp |
| 493 objects. | |
| 494 * Number properties store numeric values. | |
| 495 * 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
|
496 * 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
|
497 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
|
498 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
|
499 * 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
|
500 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
|
501 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
502 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
503 FileClass |
| 1098 | 504 ~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
505 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
506 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
|
507 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
|
508 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
|
509 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
|
510 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
|
511 tracker. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
512 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
513 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
514 IssueClass |
| 1098 | 515 ~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
516 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
517 IssueClasses automatically include the "messages", "files", "nosy", and |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
518 "superseder" properties. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
519 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
520 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
|
521 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
|
522 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
|
523 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
|
524 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
|
525 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
|
526 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
527 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
|
528 "creator" properties. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
529 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
530 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
|
531 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
|
532 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
|
533 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
|
534 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
|
535 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
536 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
537 setkey(property) |
| 1098 | 538 ~~~~~~~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
539 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
540 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
|
541 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
|
542 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
|
543 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
|
544 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
|
545 assign an issue to him, we could do either of:: |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
546 |
|
1570
93e0a565cee5
fix the "set" command usage statement
Richard Jones <richard@users.sourceforge.net>
parents:
1568
diff
changeset
|
547 roundup-admin set issue23 assignedto=2 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
548 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
549 or:: |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
550 |
|
1570
93e0a565cee5
fix the "set" command usage statement
Richard Jones <richard@users.sourceforge.net>
parents:
1568
diff
changeset
|
551 roundup-admin set issue23 assignedto=richard |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
552 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
553 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
|
554 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
555 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
|
556 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
|
557 (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
|
558 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
|
559 "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
|
560 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
561 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
562 create(information) |
| 1098 | 563 ~~~~~~~~~~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
564 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
565 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
|
566 in the "definitional" classes like "priority" and "status". |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
567 |
|
684
5b23ff865f3a
added a "detectors" directory...
Richard Jones <richard@users.sourceforge.net>
parents:
673
diff
changeset
|
568 |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
569 Examples of adding to your schema |
| 1098 | 570 --------------------------------- |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
571 |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
572 TODO |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
573 |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
574 |
|
684
5b23ff865f3a
added a "detectors" directory...
Richard Jones <richard@users.sourceforge.net>
parents:
673
diff
changeset
|
575 Detectors - adding behaviour to your tracker |
| 1098 | 576 ============================================ |
|
909
ef9c759c243e
Fix to hasPermission, thanks Stefan Seefeld.
Richard Jones <richard@users.sourceforge.net>
parents:
907
diff
changeset
|
577 .. _detectors: |
|
684
5b23ff865f3a
added a "detectors" directory...
Richard Jones <richard@users.sourceforge.net>
parents:
673
diff
changeset
|
578 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
579 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
|
580 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
|
581 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
|
582 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
583 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
|
584 (**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
|
585 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
|
586 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
|
587 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
|
588 for you are: |
|
907
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
589 |
|
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
590 **nosyreaction.py** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
591 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
|
592 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
|
593 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
|
594 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
|
595 (such as adding new authors, etc.) |
|
907
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
596 **statusauditor.py** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
597 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
|
598 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
|
599 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
|
600 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
|
601 defined. |
|
1777
fbe08359511a
customisation doc update
Richard Jones <richard@users.sourceforge.net>
parents:
1773
diff
changeset
|
602 **messagesummary.py** |
|
fbe08359511a
customisation doc update
Richard Jones <richard@users.sourceforge.net>
parents:
1773
diff
changeset
|
603 Generates the ``summary`` property for new messages based on the message |
|
fbe08359511a
customisation doc update
Richard Jones <richard@users.sourceforge.net>
parents:
1773
diff
changeset
|
604 content. |
|
fbe08359511a
customisation doc update
Richard Jones <richard@users.sourceforge.net>
parents:
1773
diff
changeset
|
605 **userauditor.py** |
|
fbe08359511a
customisation doc update
Richard Jones <richard@users.sourceforge.net>
parents:
1773
diff
changeset
|
606 Verifies the content of some of the user fields (email addresses and |
|
fbe08359511a
customisation doc update
Richard Jones <richard@users.sourceforge.net>
parents:
1773
diff
changeset
|
607 roles lists). |
|
fbe08359511a
customisation doc update
Richard Jones <richard@users.sourceforge.net>
parents:
1773
diff
changeset
|
608 |
|
fbe08359511a
customisation doc update
Richard Jones <richard@users.sourceforge.net>
parents:
1773
diff
changeset
|
609 If you don't want this default behaviour, you're completely free to change |
|
fbe08359511a
customisation doc update
Richard Jones <richard@users.sourceforge.net>
parents:
1773
diff
changeset
|
610 or remove these detectors. |
|
907
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
611 |
|
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
612 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
|
613 interface for detectors. |
|
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
614 |
|
909
ef9c759c243e
Fix to hasPermission, thanks Stefan Seefeld.
Richard Jones <richard@users.sourceforge.net>
parents:
907
diff
changeset
|
615 __ design.html |
|
907
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
616 |
| 2209 | 617 |
| 618 Detector API | |
| 619 ------------ | |
| 620 | |
| 621 Auditors are called with the arguments:: | |
| 622 | |
| 623 audit(db, cl, itemid, newdata) | |
| 624 | |
| 625 where ``db`` is the database, ``cl`` is an instance of Class or | |
| 626 IssueClass within the database, and ``newdata`` is a dictionary mapping | |
| 627 property names to values. | |
| 628 | |
| 629 For a ``create()`` operation, the ``itemid`` argument is None and | |
| 630 newdata contains all of the initial property values with which the item | |
| 631 is about to be created. | |
| 632 | |
| 633 For a ``set()`` operation, newdata contains only the names and values of | |
| 634 properties that are about to be changed. | |
| 635 | |
| 636 For a ``retire()`` or ``restore()`` operation, newdata is None. | |
| 637 | |
| 638 Reactors are called with the arguments:: | |
| 639 | |
| 640 react(db, cl, itemid, olddata) | |
| 641 | |
| 642 where ``db`` is the database, ``cl`` is an instance of Class or | |
| 643 IssueClass within the database, and ``olddata`` is a dictionary mapping | |
| 644 property names to values. | |
| 645 | |
| 646 For a ``create()`` operation, the ``itemid`` argument is the id of the | |
| 647 newly-created item and ``olddata`` is None. | |
| 648 | |
| 649 For a ``set()`` operation, ``olddata`` contains the names and previous | |
| 650 values of properties that were changed. | |
| 651 | |
| 652 For a ``retire()`` or ``restore()`` operation, ``itemid`` is the id of | |
| 653 the retired or restored item and ``olddata`` is None. | |
| 654 | |
| 655 | |
|
2193
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
656 Additional Detectors Ready For Use |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
657 ---------------------------------- |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
658 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
659 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
|
660 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
|
661 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
|
662 |
|
907
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
663 **newissuecopy.py** |
|
684
5b23ff865f3a
added a "detectors" directory...
Richard Jones <richard@users.sourceforge.net>
parents:
673
diff
changeset
|
664 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
|
665 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
|
666 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
|
667 email errors! |
|
2193
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
668 **creator_resolution.py** |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
669 Catch attempts to set the status to "resolved" - if the assignedto |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
670 user isn't the creator, then set the status to "confirm-done". Note that |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
671 "classic" Roundup doesn't have that status, so you'll have to add it. If |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
672 you don't want to though, it'll just use "in-progress" instead. |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
673 **email_auditor.py** |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
674 If a file added to an issue is of type message/rfc822, we tack on the |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
675 extension .eml. |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
676 The reason for this is that Microsoft Internet Explorer will not open |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
677 things with a .eml attachment, as they deem it 'unsafe'. Worse yet, |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
678 they'll just give you an incomprehensible error message. For more |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
679 information, see the detector code - it has a length explanation. |
| 1091 | 680 |
|
684
5b23ff865f3a
added a "detectors" directory...
Richard Jones <richard@users.sourceforge.net>
parents:
673
diff
changeset
|
681 |
|
2129
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
682 Auditor or Reactor? |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
683 ------------------- |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
684 |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
685 Generally speaking, the following rules should be observed: |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
686 |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
687 **Auditors** |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
688 Are used for `vetoing creation of or changes to items`_. They might |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
689 also make automatic changes to item properties. |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
690 **Reactors** |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
691 Detect changes in the database and react accordingly. They should avoid |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
692 making changes to the database where possible, as this could create |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
693 detector loops. |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
694 |
|
2138
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
695 |
|
2129
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
696 Vetoing creation of or changes to items |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
697 --------------------------------------- |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
698 |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
699 Auditors may raise the ``Reject`` exception to prevent the creation of |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
700 or changes to items in the database. The mail gateway, for example, will |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
701 not attach files or messages to issues when the creation of those files or |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
702 messages are prevented through the ``Reject`` exception. It'll also not create |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
703 users if that creation is ``Reject``'ed too. |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
704 |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
705 To use, simply add at the top of your auditor:: |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
706 |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
707 from roundup.exceptions import Reject |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
708 |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
709 And then when your rejection criteria have been detected, simply:: |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
710 |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
711 raise Reject |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
712 |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
713 |
|
2138
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
714 Generating email from Roundup |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
715 ----------------------------- |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
716 |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
717 The module ``roundup.mailer`` contains most of the nuts-n-bolts required |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
718 to generate email messages from Roundup. |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
719 |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
720 In addition, the ``IssueClass`` methods ``nosymessage()`` and |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
721 ``send_message()`` are used to generate nosy messages, and may generate |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
722 messages which only consist of a change note (ie. the message id parameter |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
723 is not required). |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
724 |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
725 |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
726 Database Content |
| 1098 | 727 ================ |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
728 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
729 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
|
730 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
|
731 changes. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
732 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
733 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
|
734 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
|
735 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
|
736 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
|
737 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
738 **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
|
739 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
|
740 using the ``create()`` methods. |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
741 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
742 **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
|
743 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
|
744 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
|
745 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
|
746 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
747 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
|
748 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
|
749 question. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
750 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
751 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
|
752 requires database content changes. |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
753 |
|
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
754 |
|
2003
a291bf753037
maintenance -> admin guide
Richard Jones <richard@users.sourceforge.net>
parents:
1998
diff
changeset
|
755 Security / Access Controls |
|
a291bf753037
maintenance -> admin guide
Richard Jones <richard@users.sourceforge.net>
parents:
1998
diff
changeset
|
756 ========================== |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
757 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
758 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
|
759 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
760 - Edit (everything) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
761 - View (everything) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
762 |
|
2076
2a4309450202
security fixes and doc updates
Richard Jones <richard@users.sourceforge.net>
parents:
2069
diff
changeset
|
763 Every Class you define in your tracker's schema also gets an Edit and View |
|
2a4309450202
security fixes and doc updates
Richard Jones <richard@users.sourceforge.net>
parents:
2069
diff
changeset
|
764 Permission of its own. |
|
2a4309450202
security fixes and doc updates
Richard Jones <richard@users.sourceforge.net>
parents:
2069
diff
changeset
|
765 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
766 The default interfaces define: |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
767 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
768 - Web Registration |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
769 - Web Access |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
770 - Web Roles |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
771 - Email Registration |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
772 - Email Access |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
773 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
774 These are hooked into the default Roles: |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
775 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
776 - Admin (Edit everything, View everything, Web Roles) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
777 - User (Web Access, Email Access) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
778 - Anonymous (Web Registration, Email Registration) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
779 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
780 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
|
781 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
|
782 installation. The two default schemas then define: |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
783 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
784 - Edit issue, View issue (both) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
785 - Edit file, View file (both) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
786 - Edit msg, View msg (both) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
787 - Edit support, View support (extended only) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
788 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
789 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
|
790 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
|
791 (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
|
792 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
793 # |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
794 # SECURITY SETTINGS |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
795 # |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
796 # 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
|
797 p = db.security.getPermission('Web Access') |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
798 db.security.addPermissionToRole('User', p) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
799 p = db.security.getPermission('Email Access') |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
800 db.security.addPermissionToRole('User', p) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
801 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
802 # 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
|
803 # if you don't want them to |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
804 p = db.security.getPermission('View', 'user') |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
805 db.security.addPermissionToRole('User', p) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
806 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
807 # 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
|
808 # Anonymous role. Choices here are: |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
809 # - Allow anonymous users to register through the web |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
810 p = db.security.getPermission('Web Registration') |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
811 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
|
812 # - 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
|
813 # gateway |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
814 p = db.security.getPermission('Email Registration') |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
815 db.security.addPermissionToRole('Anonymous', p) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
816 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
817 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
818 New User Roles |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
819 -------------- |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
820 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
821 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
|
822 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
823 - NEW_WEB_USER_ROLES |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
824 - NEW_EMAIL_USER_ROLES |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
825 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
826 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
827 Changing Access Controls |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
828 ------------------------ |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
829 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
830 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
|
831 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
|
832 interface if they register through email. |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
833 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
834 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
|
835 current Role and Permission configuration in your tracker. |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
836 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
837 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
838 Adding a new Permission |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
839 ~~~~~~~~~~~~~~~~~~~~~~~ |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
840 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
841 When adding a new Permission, you will need to: |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
842 |
|
2076
2a4309450202
security fixes and doc updates
Richard Jones <richard@users.sourceforge.net>
parents:
2069
diff
changeset
|
843 1. add it to your tracker's dbinit so it is created, using |
|
2a4309450202
security fixes and doc updates
Richard Jones <richard@users.sourceforge.net>
parents:
2069
diff
changeset
|
844 ``security.addPermission``, for example:: |
|
2a4309450202
security fixes and doc updates
Richard Jones <richard@users.sourceforge.net>
parents:
2069
diff
changeset
|
845 |
|
2a4309450202
security fixes and doc updates
Richard Jones <richard@users.sourceforge.net>
parents:
2069
diff
changeset
|
846 self.security.addPermission(name="View", klass='frozzle', |
|
2a4309450202
security fixes and doc updates
Richard Jones <richard@users.sourceforge.net>
parents:
2069
diff
changeset
|
847 description="User is allowed to access frozzles") |
|
2a4309450202
security fixes and doc updates
Richard Jones <richard@users.sourceforge.net>
parents:
2069
diff
changeset
|
848 |
|
2a4309450202
security fixes and doc updates
Richard Jones <richard@users.sourceforge.net>
parents:
2069
diff
changeset
|
849 will set up a new "View" permission on the Class "frozzle". |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
850 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
|
851 "``roundup-admin security``") |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
852 3. add it to the relevant HTML interface templates |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
853 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
|
854 interfaces module |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
855 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
856 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
857 Example Scenarios |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
858 ~~~~~~~~~~~~~~~~~ |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
859 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
860 **automatic registration of users in the e-mail gateway** |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
861 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
|
862 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
|
863 (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
|
864 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
|
865 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
|
866 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
867 **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
|
868 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
|
869 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
|
870 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
|
871 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
|
872 "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
|
873 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
|
874 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
|
875 address - will not be available - they're *anonymous*. |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
876 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
877 **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
|
878 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
|
879 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
|
880 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
|
881 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
|
882 auditor. See the example |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
883 `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
|
884 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
885 **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
|
886 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
|
887 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
|
888 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
|
889 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
|
890 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
|
891 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
|
892 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
893 <option tal:condition="python:request.user.hasPermission('Closer')" |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
894 value="resolved">Resolved</option> |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
895 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
896 **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
|
897 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
|
898 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
|
899 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
|
900 interface. |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
901 |
|
1317
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
902 **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
|
903 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
|
904 editing users:: |
|
1317
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
905 |
|
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
906 db.security.addRole(name='User Admin', description='Managing users') |
|
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
907 p = db.security.getPermission('Edit', 'user') |
|
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
908 db.security.addPermissionToRole('User Admin', p) |
|
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
909 |
|
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
910 and assign the Role to the users who need the permission. |
|
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
911 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
912 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
913 Web Interface |
| 1098 | 914 ============= |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
915 |
| 1125 | 916 .. contents:: |
| 917 :local: | |
| 918 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
919 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
|
920 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
|
921 (``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
|
922 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
|
923 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
|
924 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
|
925 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
|
926 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
|
927 anything you want as a web interface to your tracker. |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
928 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
929 Repercussions of changing the tracker schema |
| 1098 | 930 --------------------------------------------- |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
931 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
932 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
|
933 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
|
934 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
935 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
|
936 have properties added or removed, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
937 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
|
938 "home" page's content arguments. |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
939 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
940 How requests are processed |
| 1098 | 941 -------------------------- |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
942 |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
943 The basic processing of a web request proceeds as follows: |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
944 |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
945 1. figure out who we are, defaulting to the "anonymous" user |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
946 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
|
947 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
|
948 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
|
949 output |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
950 |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
951 In some situations, exceptions occur: |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
952 |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
953 - 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
|
954 - 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
|
955 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
|
956 - 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
|
957 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
|
958 - 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
|
959 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
|
960 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
|
961 the action to take place |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
962 - 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
|
963 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
|
964 client |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
965 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
966 Determining web context |
| 1098 | 967 ----------------------- |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
968 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
969 To determine the "context" of a request, we look at the URL and the |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
970 special request variable ``@template``. The URL path after the tracker |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
971 identifier is examined. Typical URL paths look like: |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
972 |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
973 1. ``/tracker/issue`` |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
974 2. ``/tracker/issue1`` |
|
2134
00dfd8b50773
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2129
diff
changeset
|
975 3. ``/tracker/@file/style.css`` |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
976 4. ``/cgi-bin/roundup.cgi/tracker/file1`` |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
977 5. ``/cgi-bin/roundup.cgi/tracker/file1/kitten.png`` |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
978 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
979 where the "tracker identifier" is "tracker" in the above cases. That means |
|
2134
00dfd8b50773
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2129
diff
changeset
|
980 we're looking at "issue", "issue1", "@file/style.css", "file1" and |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
981 "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
|
982 entry long - longer paths are handled differently. |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
983 |
|
2227
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
984 a. if there is no path, then we are in the "home" context. See `the "home" |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
985 context`_ below for more information about how it may be used. |
|
2134
00dfd8b50773
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2129
diff
changeset
|
986 b. if the path starts with "@file" (as in example 3, |
|
00dfd8b50773
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2129
diff
changeset
|
987 "/tracker/@file/style.css"), then the additional path entry, |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
988 "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
|
989 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
|
990 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
|
991 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
|
992 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
|
993 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
|
994 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
|
995 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
|
996 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
|
997 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
|
998 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
|
999 This raises a ``SendFile`` exception. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1000 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1001 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
|
1002 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
|
1003 |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1004 The template used is specified by the ``@template`` CGI variable, which |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1005 defaults to: |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1006 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1007 - only classname suplied: "index" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1008 - full item designator supplied: "item" |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1009 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1010 |
|
2227
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1011 The "home" Context |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1012 ------------------ |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1013 |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1014 The "home" context is special because it allows you to add templated |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1015 pages to your tracker that don't rely on a class or item (ie. an issues |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1016 list or specific issue). |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1017 |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1018 Let's say you wish to add frames to control the layout of your tracker's |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1019 interface. You'd probably have: |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1020 |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1021 - A top-level frameset page. This page probably wouldn't be templated, so |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1022 it could be served as a static file (see `serving static content`_) |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1023 - A sidebar frame that is templated. Let's call this page |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1024 "home.navigation.html" in your tracker's "html" directory. To load that |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1025 page up, you use the URL: |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1026 |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1027 <tracker url>/home?@template=navigation |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1028 |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1029 |
|
2134
00dfd8b50773
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2129
diff
changeset
|
1030 Serving static content |
|
00dfd8b50773
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2129
diff
changeset
|
1031 ---------------------- |
|
00dfd8b50773
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2129
diff
changeset
|
1032 |
|
00dfd8b50773
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2129
diff
changeset
|
1033 See the previous section `determining web context`_ where it describes |
|
00dfd8b50773
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2129
diff
changeset
|
1034 ``@file`` paths. |
|
00dfd8b50773
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2129
diff
changeset
|
1035 |
|
00dfd8b50773
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2129
diff
changeset
|
1036 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1037 Performing actions in web requests |
| 1098 | 1038 ---------------------------------- |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1039 |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1040 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
|
1041 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
|
1042 action is performed before the requested page is generated. Actions are |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1043 triggered by using a ``@action`` CGI variable, where the value is one |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1044 of: |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
1045 |
| 1125 | 1046 **login** |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
1047 Attempt to log a user in. |
|
1278
0c0494deb09f
doc for the retire action
Richard Jones <richard@users.sourceforge.net>
parents:
1270
diff
changeset
|
1048 |
| 1125 | 1049 **logout** |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
1050 Log the user out - make them "anonymous". |
|
1278
0c0494deb09f
doc for the retire action
Richard Jones <richard@users.sourceforge.net>
parents:
1270
diff
changeset
|
1051 |
| 1125 | 1052 **register** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1053 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
|
1054 log them in. |
|
1278
0c0494deb09f
doc for the retire action
Richard Jones <richard@users.sourceforge.net>
parents:
1270
diff
changeset
|
1055 |
| 1125 | 1056 **edit** |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1057 Perform an edit of an item in the database. There are some `special form |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1058 variables`_ you may use. |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
1059 |
| 1125 | 1060 **new** |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1061 Add a new item to the database. You may use the same `special form |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1062 variables`_ 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
|
1063 |
|
1278
0c0494deb09f
doc for the retire action
Richard Jones <richard@users.sourceforge.net>
parents:
1270
diff
changeset
|
1064 **retire** |
|
0c0494deb09f
doc for the retire action
Richard Jones <richard@users.sourceforge.net>
parents:
1270
diff
changeset
|
1065 Retire the item in the database. |
|
0c0494deb09f
doc for the retire action
Richard Jones <richard@users.sourceforge.net>
parents:
1270
diff
changeset
|
1066 |
| 1125 | 1067 **editCSV** |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
1068 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
|
1069 *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
|
1070 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
|
1071 features. |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
1072 |
| 1125 | 1073 **search** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1074 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
|
1075 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1076 - 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
|
1077 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
|
1078 them to :filter. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1079 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1080 - 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
|
1081 user's query list. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1082 |
|
2017
31d920b31642
Update customization examples too, expand upgrade notice a bit.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2016
diff
changeset
|
1083 Each of the actions is implemented by a corresponding ``*XxxAction*`` (where |
|
31d920b31642
Update customization examples too, expand upgrade notice a bit.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2016
diff
changeset
|
1084 "Xxx" is the name of the action) class in the ``roundup.cgi.actions`` module. |
|
31d920b31642
Update customization examples too, expand upgrade notice a bit.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2016
diff
changeset
|
1085 These classes are registered with ``roundup.cgi.client.Client`` which also |
|
31d920b31642
Update customization examples too, expand upgrade notice a bit.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2016
diff
changeset
|
1086 happens to be available in your tracker instance as ``interfaces.Client``. So |
|
31d920b31642
Update customization examples too, expand upgrade notice a bit.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2016
diff
changeset
|
1087 if you need to define new actions, you may add them there (see `defining new |
|
31d920b31642
Update customization examples too, expand upgrade notice a bit.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2016
diff
changeset
|
1088 web actions`_). |
|
31d920b31642
Update customization examples too, expand upgrade notice a bit.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2016
diff
changeset
|
1089 |
|
31d920b31642
Update customization examples too, expand upgrade notice a bit.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2016
diff
changeset
|
1090 Each action class also has a ``*permission*`` method which determines whether |
|
31d920b31642
Update customization examples too, expand upgrade notice a bit.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2016
diff
changeset
|
1091 the action is permissible given the current user. The base permission checks |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1092 are: |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
1093 |
| 1125 | 1094 **login** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1095 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
|
1096 to check the user has "Web Access". |
| 1125 | 1097 **logout** |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
1098 No permission checks are made. |
| 1125 | 1099 **register** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1100 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
|
1101 is to check the user has the "Web Registration" Permission. |
| 1125 | 1102 **edit** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1103 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
|
1104 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
|
1105 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
|
1106 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
|
1107 special Permission "Web Roles". |
| 1125 | 1108 **new** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1109 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
|
1110 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
|
1111 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
|
1112 be created if the user has the "Web Registration" Permission. |
| 1125 | 1113 **editCSV** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1114 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
|
1115 behaviour is to check whether the user may edit this class. |
| 1125 | 1116 **search** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1117 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
|
1118 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
|
1119 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1120 |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1121 Special form variables |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1122 ---------------------- |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1123 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1124 Item properties and their values are edited with html FORM |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1125 variables and their values. You can: |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1126 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1127 - Change the value of some property of the current item. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1128 - Create a new item of any class, and edit the new item's |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1129 properties, |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1130 - Attach newly created items to a multilink property of the |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1131 current item. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1132 - Remove items from a multilink property of the current item. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1133 - Specify that some properties are required for the edit |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1134 operation to be successful. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1135 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1136 In the following, <bracketed> values are variable, "@" may be |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1137 either ":" or "@", and other text "required" is fixed. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1138 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1139 Most properties are specified as form variables: |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1140 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1141 ``<propname>`` |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1142 property on the current context item |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1143 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1144 ``<designator>"@"<propname>`` |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1145 property on the indicated item (for editing related information) |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1146 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1147 Designators name a specific item of a class. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1148 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1149 ``<classname><N>`` |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1150 Name an existing item of class <classname>. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1151 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1152 ``<classname>"-"<N>`` |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1153 Name the <N>th new item of class <classname>. If the form |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1154 submission is successful, a new item of <classname> is |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1155 created. Within the submitted form, a particular |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1156 designator of this form always refers to the same new |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1157 item. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1158 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1159 Once we have determined the "propname", we look at it to see |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1160 if it's special: |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1161 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1162 ``@required`` |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1163 The associated form value is a comma-separated list of |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1164 property names that must be specified when the form is |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1165 submitted for the edit operation to succeed. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1166 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1167 When the <designator> is missing, the properties are |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1168 for the current context item. When <designator> is |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1169 present, they are for the item specified by |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1170 <designator>. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1171 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1172 The "@required" specifier must come before any of the |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1173 properties it refers to are assigned in the form. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1174 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1175 ``@remove@<propname>=id(s)`` or ``@add@<propname>=id(s)`` |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1176 The "@add@" and "@remove@" edit actions apply only to |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1177 Multilink properties. The form value must be a |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1178 comma-separate list of keys for the class specified by |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1179 the simple form variable. The listed items are added |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1180 to (respectively, removed from) the specified |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1181 property. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1182 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1183 ``@link@<propname>=<designator>`` |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1184 If the edit action is "@link@", the simple form |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1185 variable must specify a Link or Multilink property. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1186 The form value is a comma-separated list of |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1187 designators. The item corresponding to each |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1188 designator is linked to the property given by simple |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1189 form variable. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1190 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1191 None of the above (ie. just a simple form value) |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1192 The value of the form variable is converted |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1193 appropriately, depending on the type of the property. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1194 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1195 For a Link('klass') property, the form value is a |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1196 single key for 'klass', where the key field is |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1197 specified in dbinit.py. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1198 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1199 For a Multilink('klass') property, the form value is a |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1200 comma-separated list of keys for 'klass', where the |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1201 key field is specified in dbinit.py. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1202 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1203 Note that for simple-form-variables specifiying Link |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1204 and Multilink properties, the linked-to class must |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1205 have a key field. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1206 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1207 For a String() property specifying a filename, the |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1208 file named by the form value is uploaded. This means we |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1209 try to set additional properties "filename" and "type" (if |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1210 they are valid for the class). Otherwise, the property |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1211 is set to the form value. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1212 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1213 For Date(), Interval(), Boolean(), and Number() |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1214 properties, the form value is converted to the |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1215 appropriate |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1216 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1217 Any of the form variables may be prefixed with a classname or |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1218 designator. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1219 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1220 Two special form values are supported for backwards compatibility: |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1221 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1222 @note |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1223 This is equivalent to:: |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1224 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1225 @link@messages=msg-1 |
| 1918 | 1226 msg-1@content=value |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1227 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1228 except that in addition, the "author" and "date" properties of |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1229 "msg-1" are set to the userid of the submitter, and the current |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1230 time, respectively. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1231 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1232 @file |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1233 This is equivalent to:: |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1234 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1235 @link@files=file-1 |
| 1918 | 1236 file-1@content=value |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1237 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1238 The String content value is handled as described above for file |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1239 uploads. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1240 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1241 If both the "@note" and "@file" form variables are |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1242 specified, the action:: |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1243 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1244 @link@msg-1@files=file-1 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1245 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1246 is also performed. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1247 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1248 We also check that FileClass items have a "content" property with |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1249 actual content, otherwise we remove them from all_props before |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1250 returning. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1251 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1252 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1253 |
| 1091 | 1254 Default templates |
| 1098 | 1255 ----------------- |
| 1091 | 1256 |
|
1952
c40ed9113285
Applied Stefan Seefeld's html4/xhtml patch with some changes.
Richard Jones <richard@users.sourceforge.net>
parents:
1918
diff
changeset
|
1257 The default templates are html4 compliant. If you wish to change them to be |
|
c40ed9113285
Applied Stefan Seefeld's html4/xhtml patch with some changes.
Richard Jones <richard@users.sourceforge.net>
parents:
1918
diff
changeset
|
1258 xhtml compliant, you'll need to change the ``HTML_VERSION`` configuration |
|
c40ed9113285
Applied Stefan Seefeld's html4/xhtml patch with some changes.
Richard Jones <richard@users.sourceforge.net>
parents:
1918
diff
changeset
|
1259 variable in ``config.py`` to ``'xhtml'`` instead of ``'html4'``. |
|
c40ed9113285
Applied Stefan Seefeld's html4/xhtml patch with some changes.
Richard Jones <richard@users.sourceforge.net>
parents:
1918
diff
changeset
|
1260 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1261 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
|
1262 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
|
1263 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
|
1264 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1265 **page.html** |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1266 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
|
1267 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
|
1268 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
|
1269 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
|
1270 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
|
1271 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
|
1272 title. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1273 **home.html** |
| 1091 | 1274 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
|
1275 **home.classlist.html** |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1276 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
|
1277 tracker |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1278 **classname.item.html** |
| 1091 | 1279 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
|
1280 **classname.index.html** |
| 1091 | 1281 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
|
1282 **classname.search.html** |
| 1091 | 1283 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
|
1284 **_generic.index.html** |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1285 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
|
1286 ``*classname*.index`` available |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1287 **_generic.help.html** |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1288 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
|
1289 ``*classname*.help`` |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1290 **user.register.html** |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1291 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
|
1292 page |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1293 **style.css.html** |
| 1091 | 1294 a static file that is served up as-is |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1295 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1296 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
|
1297 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1298 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
|
1299 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
|
1300 you can copy the current "issue.item" template to "issue.test", and then |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1301 access the test template using the "@template" URL argument:: |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1302 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1303 http://your.tracker.example/tracker/issue?@template=test |
|
1147
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
1304 |
|
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
1305 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
|
1306 |
|
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
1307 |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1308 How the templates work |
| 1098 | 1309 ---------------------- |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1310 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1311 |
| 1214 | 1312 Basic Templating Actions |
| 1313 ~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 1314 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1315 Roundup's templates consist of special attributes on the HTML tags. |
|
2296
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1316 These attributes form the `Template Attribute Language`_, or TAL. |
|
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1317 The basic TAL commands are: |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1318 |
| 1125 | 1319 **tal:define="variable expression; variable expression; ..."** |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1320 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
|
1321 example:: |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1322 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1323 <html tal:define="title request/description"> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1324 <head><title tal:content="title"></title></head> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1325 </html> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1326 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1327 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
|
1328 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
|
1329 <html> tag may then use the "title" variable. |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1330 |
| 1125 | 1331 **tal:condition="expression"** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1332 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
|
1333 example:: |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1334 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1335 <p tal:condition="python:request.user.hasPermission('View', 'issue')"> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1336 Display some issue information. |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1337 </p> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1338 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1339 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
|
1340 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
|
1341 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
|
1342 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
|
1343 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
|
1344 spaces!). |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1345 |
| 1125 | 1346 **tal:repeat="variable expression"** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1347 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
|
1348 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
|
1349 special "repeat" variable for each element. For example:: |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1350 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1351 <tr tal:repeat="u user/list"> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1352 <td tal:content="u/id"></td> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1353 <td tal:content="u/username"></td> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1354 <td tal:content="u/realname"></td> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1355 </tr> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1356 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1357 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
|
1358 "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
|
1359 |
| 1125 | 1360 **tal:replace="expression"** |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1361 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
|
1362 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1363 <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
|
1364 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1365 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
|
1366 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
|
1367 resultant output would be "Bruce". |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1368 |
| 1125 | 1369 **tal:content="expression"** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1370 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
|
1371 For example:: |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1372 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1373 <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
|
1374 </span> |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1375 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1376 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
|
1377 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
|
1378 resultant output would be "<span>Bruce</span>". |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1379 |
| 1125 | 1380 **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
|
1381 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
|
1382 example:: |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1383 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1384 <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
|
1385 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1386 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
|
1387 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
|
1388 be something like "user123". |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1389 |
| 1125 | 1390 **tal:omit-tag="expression"** |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1391 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
|
1392 example:: |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1393 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1394 <span tal:omit-tag="python:1">Hello, world!</span> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1395 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1396 would result in output of:: |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1397 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1398 Hello, world! |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1399 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1400 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
|
1401 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
|
1402 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1403 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
|
1404 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
|
1405 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
|
1406 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
|
1407 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
|
1408 illegal tag placement to effect the repeat). |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1409 |
|
2296
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1410 .. _TAL: |
|
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1411 .. _Template Attribute Language: |
|
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1412 http://dev.zope.org/Wikis/DevSite/Projects/ZPT/TAL%20Specification%201.4 |
| 1214 | 1413 |
| 1414 Templating Expressions | |
| 1415 ~~~~~~~~~~~~~~~~~~~~~~ | |
| 1416 | |
|
2296
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1417 Templating Expressions are covered by `Template Attribute Language |
|
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1418 Expression Syntax`_, or TALES. The expressions you may use in the |
|
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1419 attribute values may be one of the following forms: |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1420 |
| 1125 | 1421 **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
|
1422 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
|
1423 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
|
1424 ``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
|
1425 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
|
1426 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
|
1427 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
|
1428 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
|
1429 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
|
1430 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
|
1431 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
|
1432 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1433 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
|
1434 "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
|
1435 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
|
1436 case of ``tal:attributes``). |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1437 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1438 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
|
1439 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
|
1440 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
|
1441 the case of ``tal:replace``). |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1442 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1443 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
|
1444 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
|
1445 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
|
1446 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
|
1447 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1448 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
|
1449 ``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
|
1450 expressions. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1451 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1452 **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
|
1453 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
|
1454 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
|
1455 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
|
1456 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1457 **Python Expressions** - eg. ``python: 1+1`` |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1458 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
|
1459 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
|
1460 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
|
1461 ``checklist`` is a method. |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1462 |
|
1448
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
1463 Modifiers: |
|
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
1464 |
|
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
1465 **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
|
1466 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
|
1467 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
|
1468 ``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
|
1469 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
|
1470 to the web browser for rendering. |
|
1448
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
1471 |
|
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
1472 **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
|
1473 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
|
1474 expression. |
|
1448
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
1475 |
|
2296
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1476 .. _TALES: |
|
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1477 .. _Template Attribute Language Expression Syntax: |
|
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1478 http://dev.zope.org/Wikis/DevSite/Projects/ZPT/TALES%20Specification%201.3 |
|
1448
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
1479 |
| 1214 | 1480 Template Macros |
| 1481 ~~~~~~~~~~~~~~~ | |
| 1482 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1483 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
|
1484 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
|
1485 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
|
1486 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1487 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
|
1488 attributes similar to the `basic templating actions`_. In this case, |
|
2296
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1489 though, the attributes belong to the `Macro Expansion Template |
|
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1490 Attribute Language`_, or METAL. The macro commands are: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1491 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1492 **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
|
1493 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
|
1494 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
|
1495 example:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1496 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1497 <html metal:define-macro="page"> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1498 ... |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1499 </html> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1500 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1501 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
|
1502 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
|
1503 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
|
1504 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
|
1505 ``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
|
1506 "page" template. |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1507 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1508 **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
|
1509 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
|
1510 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
|
1511 For example:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1512 |
| 1214 | 1513 <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
|
1514 ... |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1515 </tal:block> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1516 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1517 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
|
1518 "page" template. |
|
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 **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
|
1521 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
|
1522 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
|
1523 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
|
1524 so:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1525 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1526 <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
|
1527 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1528 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
|
1529 like this:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1530 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1531 <title metal:fill-slot="head_title">My Title</title> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1532 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1533 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
|
1534 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
|
1535 |
|
2296
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1536 Note that you may not mix `METAL`_ and `TAL`_ commands on the same tag, but |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1537 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
|
1538 *fill-slots* tags may have all manner of TAL inside them). |
| 1214 | 1539 |
|
2296
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1540 .. _METAL: |
|
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1541 .. _Macro Expansion Template Attribute Language: |
|
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1542 http://dev.zope.org/Wikis/DevSite/Projects/ZPT/METAL%20Specification%201.0 |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1543 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1544 Information available to templates |
| 1098 | 1545 ---------------------------------- |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1546 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1547 Note: this is implemented by |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1548 ``roundup.cgi.templating.RoundupPageTemplate`` |
| 1125 | 1549 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1550 The following variables are available to templates. |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1551 |
| 1125 | 1552 **context** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1553 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
|
1554 or a `hyperdb item wrapper`_ |
| 1125 | 1555 **request** |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1556 Includes information about the current request, including: |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1557 - the current index information (``filterspec``, ``filter`` args, |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1558 ``properties``, etc) parsed out of the form. |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1559 - methods for easy filterspec link generation |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
1560 - *user*, the current user item as an HTMLItem instance |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1561 - *form* |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1562 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
|
1563 to value |
|
1254
77920c42aeb9
Expose the tracker config as a variable for templating
Richard Jones <richard@users.sourceforge.net>
parents:
1252
diff
changeset
|
1564 **config** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1565 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
|
1566 file (eg. TRACKER_NAME, etc.) |
| 1125 | 1567 **db** |
|
1254
77920c42aeb9
Expose the tracker config as a variable for templating
Richard Jones <richard@users.sourceforge.net>
parents:
1252
diff
changeset
|
1568 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
|
1569 **templates** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1570 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
|
1571 *use-macro* commands. |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1572 **utils** |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1573 This variable makes available some utility functions like batching. |
| 1125 | 1574 **nothing** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1575 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
|
1576 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
|
1577 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
|
1578 ``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
|
1579 example:: |
| 1100 | 1580 |
| 1581 <span tal:attributes="class nothing">Hello, World!</span> | |
| 1582 | |
| 1583 would result in:: | |
| 1584 | |
| 1585 <span>Hello, World!</span> | |
| 1586 | |
| 1125 | 1587 **default** |
| 1100 | 1588 Also a special variable - if an expression evaluates to this, then the |
| 1589 existing HTML in the template will not be replaced or removed, it will | |
| 1590 remain. So:: | |
| 1591 | |
| 1592 <span tal:replace="default">Hello, World!</span> | |
| 1593 | |
| 1594 would result in:: | |
| 1595 | |
| 1596 <span>Hello, World!</span> | |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1597 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1598 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1599 The context variable |
| 1098 | 1600 ~~~~~~~~~~~~~~~~~~~~ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1601 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1602 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
|
1603 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
|
1604 |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1605 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
|
1606 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
|
1607 `hyperdb class wrapper`_. |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1608 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
|
1609 `hyperdb item wrapper`_. |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1610 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1611 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
|
1612 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
|
1613 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1614 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
|
1615 appear if the property is displayed through ``context/property`` or |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1616 ``context/property/field``. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1617 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
|
1618 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
|
1619 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
|
1620 "context/id". |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1621 |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1622 Hyperdb class wrapper |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1623 ::::::::::::::::::::: |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1624 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1625 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
|
1626 class. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1627 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1628 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
|
1629 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
|
1630 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
|
1631 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
|
1632 mind. |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1633 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1634 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
|
1635 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
|
1636 from the CGI form. |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1637 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1638 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
|
1639 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1640 =========== ============================================================= |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1641 Method Description |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1642 =========== ============================================================= |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1643 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
|
1644 properties. |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1645 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
|
1646 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
|
1647 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
|
1648 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
|
1649 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
|
1650 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
|
1651 "help" template. |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1652 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
|
1653 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
|
1654 history returns 'New node - no history' :) |
|
1136
7e193bbda38e
added generic item editing
Richard Jones <richard@users.sourceforge.net>
parents:
1133
diff
changeset
|
1655 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
|
1656 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
|
1657 =========== ============================================================= |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1658 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1659 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
|
1660 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
|
1661 expression. For example:: |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1662 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1663 python:context['list'] |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1664 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1665 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
|
1666 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1667 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1668 Hyperdb item wrapper |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1669 :::::::::::::::::::: |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1670 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1671 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
|
1672 class. |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1673 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1674 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
|
1675 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1676 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
|
1677 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
|
1678 from the CGI form. |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1679 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1680 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
|
1681 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1682 =============== ======================================================== |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1683 Method Description |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1684 =============== ======================================================== |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1685 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
|
1686 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
|
1687 implemented**) |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1688 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
|
1689 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
|
1690 for the query |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1691 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
|
1692 user has a Permission |
|
1136
7e193bbda38e
added generic item editing
Richard Jones <richard@users.sourceforge.net>
parents:
1133
diff
changeset
|
1693 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
|
1694 is_view_ok is the user allowed to View the current item? |
|
2154
9f6e6bc40a08
fixes and release announcement
Richard Jones <richard@users.sourceforge.net>
parents:
2153
diff
changeset
|
1695 is_retired is the item retired? |
|
2180
58b6d1747973
Web interface tweaks.
Richard Jones <richard@users.sourceforge.net>
parents:
2159
diff
changeset
|
1696 download_url generates a url-quoted link for download of FileClass |
|
58b6d1747973
Web interface tweaks.
Richard Jones <richard@users.sourceforge.net>
parents:
2159
diff
changeset
|
1697 item contents (ie. file<id>/<name>) |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1698 =============== ======================================================== |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1699 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1700 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
|
1701 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
|
1702 expression. For example:: |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1703 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1704 python:context['journal'] |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1705 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1706 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
|
1707 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1708 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1709 Hyperdb property wrapper |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1710 :::::::::::::::::::::::: |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1711 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1712 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
|
1713 ``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
|
1714 ``HTMLNumberProperty``, and so on). |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1715 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1716 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
|
1717 value may be either: |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1718 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1719 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
|
1720 the hyperdb |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1721 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
|
1722 the CGI form |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1723 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1724 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1725 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
|
1726 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1727 =============== ======================================================== |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1728 Attribute Description |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1729 =============== ======================================================== |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1730 _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
|
1731 _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
|
1732 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
|
1733 =============== ======================================================== |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1734 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1735 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
|
1736 |
|
1773
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1737 =========== ================================================================ |
|
1780
d2801a2b0a77
Initial implementation (half-baked) at new Tracker instance.
Richard Jones <richard@users.sourceforge.net>
parents:
1777
diff
changeset
|
1738 Method Description |
|
1773
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1739 =========== ================================================================ |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1740 plain render a "plain" representation of the property. This method |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1741 may take two arguments: |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1742 |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1743 escape |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1744 If true, escape the text so it is HTML safe (default: no). The |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1745 reason this defaults to off is that text is usually escaped |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1746 at a later stage by the TAL commands, unless the "structure" |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1747 option is used in the template. The following ``tal:content`` |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1748 expressions are all equivalent:: |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1749 |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1750 "structure python:msg.content.plain(escape=1)" |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1751 "python:msg.content.plain()" |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1752 "msg/content/plain" |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1753 "msg/content" |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1754 |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1755 Usually you'll only want to use the escape option in a |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1756 complex expression. |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1757 |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1758 hyperlink |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1759 If true, turn URLs, email addresses and hyperdb item |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1760 designators in the text into hyperlinks (default: no). Note |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1761 that you'll need to use the "structure" TAL option if you |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1762 want to use this ``tal:content`` expression:: |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1763 |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1764 "structure python:msg.content.plain(hyperlink=1)" |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1765 |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1766 Note also that the text is automatically HTML-escaped before |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1767 the hyperlinking transformation. |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1768 hyperlinked The same as msg.content.plain(hyperlink=1), but nicer:: |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1769 |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1770 "structure msg/content/hyperlinked" |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1771 |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1772 field render an appropriate form edit field for the property - for |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1773 most types this is a text entry box, but for Booleans it's a |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1774 tri-state yes/no/neither selection. |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1775 stext only on String properties - render the value of the property |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1776 as StructuredText (requires the StructureText module to be |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1777 installed separately) |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1778 multiline only on String properties - render a multiline form edit |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1779 field for the property |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1780 email only on String properties - render the value of the property |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1781 as an obscured email address |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1782 confirm only on Password properties - render a second form edit field |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1783 for the property, used for confirmation that the user typed |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1784 the password correctly. Generates a field with name |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1785 "name:confirm". |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1786 now only on Date properties - return the current date as a new |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1787 property |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1788 reldate only on Date properties - render the interval between the date |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1789 and now |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1790 local only on Date properties - return this date as a new property |
| 2007 | 1791 with some timezone offset, for example:: |
| 1792 | |
| 1793 python:context.creation.local(10) | |
| 1794 | |
| 1795 will render the date with a +10 hour offset. | |
| 2088 | 1796 pretty Date properties - render the date as "dd Mon YYYY" (eg. "19 |
| 1797 Mar 2004"). Takes an optional format argument, for example:: | |
| 1798 | |
| 1799 python:context.activity.pretty('%Y-%m-%d') | |
| 1800 | |
| 1801 Will format as "2004-03-19" instead. | |
| 1802 | |
| 1803 Interval properties - render the interval in a pretty | |
|
1773
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1804 format (eg. "yesterday") |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1805 menu only on Link and Multilink properties - render a form select |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1806 list for this property |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1807 reverse only on Multilink properties - produce a list of the linked |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1808 items in reverse order |
|
2180
58b6d1747973
Web interface tweaks.
Richard Jones <richard@users.sourceforge.net>
parents:
2159
diff
changeset
|
1809 isset returns True if the property has been set to a value |
|
1773
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1810 =========== ================================================================ |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1811 |
|
2138
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
1812 All of the above functions perform checks for permissions required to |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
1813 display or edit the data they are manipulating. The simplest case is |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
1814 editing an issue title. Including the expression:: |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
1815 |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
1816 context/title/field |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
1817 |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
1818 Will present the user with an edit field, if they have edit permission. If |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
1819 not, then they will be presented with a static display if they have view |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
1820 permission. If they don't even have view permission, then an error message |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
1821 is raised, preventing the display of the page, indicating that they don't |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
1822 have permission to view the information. |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
1823 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1824 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1825 The request variable |
| 1098 | 1826 ~~~~~~~~~~~~~~~~~~~~ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1827 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1828 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
|
1829 class. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1830 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1831 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
|
1832 request. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1833 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1834 .. 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
|
1835 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1836 =========== ============================================================ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1837 Variable Holds |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1838 =========== ============================================================ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1839 form the CGI form as a cgi.FieldStorage |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1840 env the CGI environment variables |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
1841 base the base URL for this tracker |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1842 user a HTMLUser instance for this user |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1843 classname the current classname (possibly None) |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1844 template the current template (suffix, also possibly None) |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1845 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
|
1846 =========== ============================================================ |
| 1083 | 1847 |
| 1848 **Index page specific variables (indexing arguments)** | |
| 1849 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1850 =========== ============================================================ |
| 1083 | 1851 Variable Holds |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1852 =========== ============================================================ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1853 columns dictionary of the columns to display in an index page |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1854 show a convenience access to columns - request/show/colname will |
| 1098 | 1855 be true if the columns should be displayed, false otherwise |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1856 sort index sort column (direction, column name) |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1857 group index grouping property (direction, column name) |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1858 filter properties to filter the index on |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1859 filterspec values to filter the index on |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1860 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
|
1861 =========== ============================================================ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1862 |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1863 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
|
1864 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1865 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1866 Method Description |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1867 =============== ======================================================== |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1868 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
|
1869 page title |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1870 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
|
1871 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
|
1872 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
|
1873 of the templating |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1874 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
|
1875 list of items (see `hyperdb item wrapper`_, and |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1876 `batching`_) |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1877 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1878 |
| 1142 | 1879 The form variable |
| 1880 ::::::::::::::::: | |
| 1881 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1882 The form variable is a bit special because it's actually a python |
| 1142 | 1883 FieldStorage object. That means that you have two ways to access its |
| 1884 contents. For example, to look up the CGI form value for the variable | |
| 1885 "name", use the path expression:: | |
| 1886 | |
| 1887 request/form/name/value | |
| 1888 | |
| 1889 or the python expression:: | |
| 1890 | |
| 1891 python:request.form['name'].value | |
| 1892 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1893 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
|
1894 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
|
1895 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
|
1896 "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
|
1897 ``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
|
1898 best to know beforehand what you're dealing with. |
| 1142 | 1899 |
| 1900 | |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1901 The db variable |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1902 ~~~~~~~~~~~~~~~ |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1903 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1904 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
|
1905 class. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1906 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1907 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
|
1908 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
|
1909 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1910 db/user |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1911 python:db.user |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1912 |
|
1711
3c3e44aacdb4
Documentation fixes.
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1680
diff
changeset
|
1913 Also, the current id of the current user is available as |
|
1800
a3b1b1dcf639
Use getuid(), not figure_curuserid()
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1780
diff
changeset
|
1914 ``db.getuid()``. This isn't so useful in templates (where you have |
|
1711
3c3e44aacdb4
Documentation fixes.
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1680
diff
changeset
|
1915 ``request/user``), but it can be useful in detectors or interfaces. |
|
3c3e44aacdb4
Documentation fixes.
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1680
diff
changeset
|
1916 |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1917 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
|
1918 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1919 |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1920 The templates variable |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1921 ~~~~~~~~~~~~~~~~~~~~~~ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1922 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1923 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
|
1924 class. |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1925 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1926 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
|
1927 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
|
1928 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
|
1929 expression:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1930 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1931 templates/name |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1932 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1933 or the python expression:: |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1934 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1935 templates[name] |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1936 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1937 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
|
1938 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
|
1939 macro (called "macro_name"), use the path expression:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1940 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1941 templates/name/macros/macro_name |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1942 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1943 or the python expression:: |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1944 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1945 templates[name].macros[macro_name] |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1946 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1947 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1948 The utils variable |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1949 ~~~~~~~~~~~~~~~~~~ |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1950 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1951 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
|
1952 ``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
|
1953 as described below. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1954 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1955 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1956 Method Description |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1957 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1958 Batch return a batch object using the supplied list |
|
2180
58b6d1747973
Web interface tweaks.
Richard Jones <richard@users.sourceforge.net>
parents:
2159
diff
changeset
|
1959 url_quote quote some text as safe for a URL (ie. space, %, ...) |
|
58b6d1747973
Web interface tweaks.
Richard Jones <richard@users.sourceforge.net>
parents:
2159
diff
changeset
|
1960 html_quote quote some text as safe in HTML (ie. <, >, ...) |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1961 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1962 |
|
1270
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
1963 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
|
1964 ``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
|
1965 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
|
1966 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
|
1967 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
|
1968 |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1969 Batching |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1970 :::::::: |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1971 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1972 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
|
1973 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
|
1974 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1975 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
|
1976 overlap=0) |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1977 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1978 or, to get the current index batch:: |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1979 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1980 request/batch |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1981 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1982 The parameters are: |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1983 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1984 ========= ============================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1985 Parameter Usage |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1986 ========= ============================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1987 sequence a list of HTMLItems |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1988 size how big to make the sequence. |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1989 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
|
1990 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
|
1991 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
|
1992 then it is combined with this batch |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1993 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
|
1994 ========= ============================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1995 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1996 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
|
1997 addition, it has several more attributes: |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
1998 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1999 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2000 Attribute Description |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2001 =============== ======================================================== |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2002 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
|
2003 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
|
2004 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
|
2005 index* |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2006 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
|
2007 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
|
2008 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2009 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2010 And several methods: |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2011 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2012 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2013 Method Description |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2014 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2015 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
|
2016 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
|
2017 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
|
2018 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
|
2019 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2020 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2021 An example of batching:: |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2022 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2023 <table class="otherinfo"> |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2024 <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
|
2025 <tr tal:define="keywords db/keyword/list" |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2026 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
|
2027 <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
|
2028 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
|
2029 keyword here</td> |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2030 </tr> |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2031 </table> |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2032 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2033 ... 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
|
2034 the "keyword" class (well, their "name" anyway). |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2035 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2036 Displaying Properties |
| 1098 | 2037 --------------------- |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2038 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2039 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
|
2040 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
|
2041 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
|
2042 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
|
2043 view, that property may be displayed in an editable field. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2044 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2045 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2046 Index Views |
| 1098 | 2047 ----------- |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2048 |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2049 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
|
2050 classes. The template used is "*classname*.index". |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2051 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2052 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2053 Index View Specifiers |
| 1098 | 2054 ~~~~~~~~~~~~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2055 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2056 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
|
2057 been added for clarity):: |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2058 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2059 /issue?status=unread,in-progress,resolved& |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
2060 topic=security,ui& |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
2061 :group=+priority& |
| 1098 | 2062 :sort==activity& |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
2063 :filters=status,topic& |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
2064 :columns=title,status,fixer |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2065 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2066 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
|
2067 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
|
2068 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
|
2069 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
|
2070 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
|
2071 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
|
2072 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
|
2073 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
|
2074 headings in the table. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2075 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2076 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
|
2077 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
|
2078 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
|
2079 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2080 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
|
2081 "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
|
2082 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
|
2083 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
|
2084 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
|
2085 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
|
2086 "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
|
2087 "status", and "fixer" properties. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2088 |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
2089 Searching Views |
| 1098 | 2090 --------------- |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2091 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2092 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
|
2093 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
|
2094 `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
|
2095 |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2096 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
|
2097 "*classname*.search". The form on this page should have "search" as its |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2098 ``@action`` variable. The "search" action: |
|
1245
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
2099 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2100 - 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
|
2101 searching |
|
1245
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
2102 - sets the ``:filter`` variable correctly |
|
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
2103 - 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
|
2104 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2105 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
|
2106 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
|
2107 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
|
2108 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
|
2109 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
|
2110 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
|
2111 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
|
2112 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2113 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
|
2114 "search" action are: |
|
1245
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
2115 |
|
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
2116 :search_text |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2117 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
|
2118 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
|
2119 an intersection operation) |
|
1245
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
2120 :query_name |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2121 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
|
2122 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
|
2123 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
|
2124 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
|
2125 |
|
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
2126 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2127 Item Views |
| 1098 | 2128 ---------- |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2129 |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2130 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
|
2131 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
|
2132 "history" section. |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2133 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2134 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2135 Editor Section |
| 1098 | 2136 ~~~~~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2137 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2138 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
|
2139 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
|
2140 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2141 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
|
2142 "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
|
2143 template):: |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2144 |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2145 <table class="form"> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2146 <tr> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
2147 <th>Title</th> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2148 <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
|
2149 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2150 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2151 <tr> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
2152 <th>Priority</th> |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2153 <td tal:content="structure context/priority/menu">priority</td> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
2154 <th>Status</th> |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2155 <td tal:content="structure context/status/menu">status</td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2156 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2157 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2158 <tr> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
2159 <th>Superseder</th> |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2160 <td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2161 <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
|
2162 <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
|
2163 <span tal:condition="context/superseder"> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2164 <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
|
2165 </span> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2166 </td> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
2167 <th>Nosy List</th> |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2168 <td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2169 <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
|
2170 <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
|
2171 </td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2172 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2173 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2174 <tr> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
2175 <th>Assigned To</th> |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2176 <td tal:content="structure context/assignedto/menu"> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2177 assignedto menu |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2178 </td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2179 <td> </td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2180 <td> </td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2181 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2182 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2183 <tr> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
2184 <th>Change Note</th> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2185 <td colspan="3"> |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
2186 <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
|
2187 </td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2188 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2189 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2190 <tr> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
2191 <th>File</th> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2192 <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
|
2193 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2194 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2195 <tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2196 <td> </td> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2197 <td colspan="3" tal:content="structure context/submit"> |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2198 submit button will go here |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2199 </td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2200 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2201 </table> |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2202 |
|
673
604c84696461
link() htmltemplate function now has a "showid" option for links & multilinks.
Richard Jones <richard@users.sourceforge.net>
parents:
659
diff
changeset
|
2203 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2204 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
|
2205 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
|
2206 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
|
2207 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
|
2208 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2209 |
| 1638 | 2210 Form values |
| 2211 ::::::::::: | |
| 2212 | |
| 2213 We have a number of ways to pull properties out of the form in order to | |
| 2214 meet the various needs of: | |
| 2215 | |
| 2216 1. editing the current item (perhaps an issue item) | |
| 2217 2. editing information related to the current item (eg. messages or | |
| 2218 attached files) | |
| 2219 3. creating new information to be linked to the current item (eg. time | |
| 2220 spent on an issue) | |
| 2221 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2222 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
|
2223 ":" or "@", and other text ("required") is fixed. |
| 1638 | 2224 |
| 2225 Properties are specified as form variables: | |
| 2226 | |
| 2227 ``<propname>`` | |
| 2228 property on the current context item | |
| 2229 | |
| 2230 ``<designator>:<propname>`` | |
| 2231 property on the indicated item (for editing related information) | |
| 2232 | |
| 2233 ``<classname>-<N>:<propname>`` | |
| 2234 property on the Nth new item of classname (generally for creating new | |
| 2235 items to attach to the current item) | |
| 2236 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2237 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
|
2238 the special form values: |
| 1638 | 2239 |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2240 ``@required`` |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2241 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
|
2242 raised. |
| 1638 | 2243 |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2244 ``@remove@<propname>=id(s)`` |
| 1638 | 2245 The ids will be removed from the multilink property. |
| 2246 | |
| 2247 ``:add:<propname>=id(s)`` | |
| 2248 The ids will be added to the multilink property. | |
| 2249 | |
| 2250 ``:link:<propname>=<designator>`` | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2251 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
|
2252 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
|
2253 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
|
2254 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
|
2255 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
|
2256 newly created item of class <designator> (where <designator> must be |
| 1638 | 2257 <classname>-<N>). |
| 2258 | |
| 2259 Any of the form variables may be prefixed with a classname or | |
| 2260 designator. | |
| 2261 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2262 Two special form values are supported for backwards compatibility: |
| 1638 | 2263 |
| 2264 ``:note`` | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2265 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
|
2266 context item. This is ALWAYS designated "msg-1". |
| 1638 | 2267 ``:file`` |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2268 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
|
2269 :note. This is ALWAYS designated "file-1". |
| 1638 | 2270 |
| 2271 | |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2272 Spool Section |
| 1098 | 2273 ~~~~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2274 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2275 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
|
2276 of an issue. |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2277 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2278 TODO |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2279 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2280 |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2281 History Section |
| 1098 | 2282 ~~~~~~~~~~~~~~~ |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2283 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2284 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
|
2285 journal. This is generally generated with the template:: |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2286 |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2287 <tal:block tal:replace="structure context/history" /> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2288 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2289 *To be done:* |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2290 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2291 *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
|
2292 templating through the "journal" method of the item*:: |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2293 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2294 <tal:block tal:repeat="entry context/journal"> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2295 a journal entry |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2296 </tal:block> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2297 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2298 *where each journal entry is an HTMLJournalEntry.* |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2299 |
| 1098 | 2300 Defining new web actions |
| 2301 ------------------------ | |
| 2302 | |
|
2016
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2303 You may define new actions to be triggered by the ``@action`` form variable. |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2304 These are added to the tracker ``interfaces.py`` as ``Action`` classes that get |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2305 called by the the ``Client`` class. |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2306 |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2307 Adding action classes takes three steps; first you `define the new |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2308 action class`_, then you `register the action class`_ with the cgi |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2309 interface so it may be triggered by the ``@action`` form variable. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2310 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
|
2311 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2312 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
|
2313 issues`_" for an example. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2314 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2315 |
|
2016
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2316 Define the new action class |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2317 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2318 |
|
2016
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2319 The action classes have the following interface:: |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2320 |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2321 class MyAction(Action): |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2322 def handle(self): |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2323 ''' Perform some action. No return value is required. |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2324 ''' |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2325 |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2326 The *self.client* attribute is an instance of your tracker ``instance.Client`` |
|
2017
31d920b31642
Update customization examples too, expand upgrade notice a bit.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2016
diff
changeset
|
2327 class - thus it's mostly implemented by ``roundup.cgi.client.Client``. See the |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2328 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
|
2329 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2330 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
|
2331 It may then: |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2332 |
|
2016
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2333 - add information to ``self.client.ok_message`` or ``self.client.error_message`` |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2334 - change the ``self.client.template`` variable to alter what the user will see |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2335 next |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2336 - raise Unauthorised, SendStaticFile, SendFile, NotFound or Redirect |
|
2016
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2337 exceptions (import them from roundup.cgi.exceptions) |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2338 |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2339 |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2340 Register the action class |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2341 ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2342 |
|
2016
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2343 The class is now written, but isn't available to the user until you add it to |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2344 the ``instance.Client`` class ``actions`` variable, like so:: |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2345 |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2346 actions = client.Client.actions + ( |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2347 ('myaction', myActionClass), |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2348 ) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2349 |
|
2016
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2350 This maps the action name "myaction" to the action class we defined. |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2351 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2352 Use the new action |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2353 ~~~~~~~~~~~~~~~~~~ |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2354 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2355 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
|
2356 |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2357 <input type="hidden" name="@action" value="myaction"> |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2358 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2359 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
|
2360 |
|
2046
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
2361 Actions may return content to the user |
|
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
2362 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
2363 |
|
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
2364 Actions generally perform some database manipulation and then pass control |
|
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
2365 on to the rendering of a template in the current context (see `Determining |
|
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
2366 web context`_ for how that works.) Some actions will want to generate the |
|
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
2367 actual content returned to the user. Action methods may return their own |
|
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
2368 content string to be displayed to the user, overriding the templating step. |
|
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
2369 In this situation, we assume that the content is HTML by default. You may |
|
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
2370 override the content type indicated to the user by calling ``setHeader``:: |
|
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
2371 |
|
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
2372 self.client.setHeader('Content-Type', 'text/csv') |
|
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
2373 |
|
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
2374 This example indicates that the value sent back to the user is actually |
|
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
2375 comma-separated value content (eg. something to be loaded into a |
|
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
2376 spreadsheet or database). |
|
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
2377 |
|
910
299f4890427d
documentation reorg post-new-security
Richard Jones <richard@users.sourceforge.net>
parents:
909
diff
changeset
|
2378 |
| 1100 | 2379 Examples |
| 2380 ======== | |
| 2381 | |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2382 .. contents:: |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2383 :local: |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2384 :depth: 2 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2385 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2386 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2387 Changing what's stored in the database |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2388 -------------------------------------- |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2389 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2390 The following examples illustrate ways to change the information stored in |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2391 the database. |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2392 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2393 |
| 1228 | 2394 Adding a new field to the classic schema |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2395 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 1100 | 2396 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2397 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
|
2398 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
|
2399 |
| 1098 | 2400 |
| 2401 Introduction | |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2402 :::::::::::: |
| 1098 | 2403 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2404 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
|
2405 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
|
2406 issue: a category. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2407 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2408 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
|
2409 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
|
2410 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
|
2411 best). |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2412 |
| 1098 | 2413 |
| 2414 Adding a field to the database | |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2415 :::::::::::::::::::::::::::::: |
| 1098 | 2416 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2417 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
|
2418 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
|
2419 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
|
2420 comment:: |
|
1235
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2421 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2422 # 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
|
2423 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2424 add:: |
| 1098 | 2425 |
| 2426 category = Class(db, "category", name=String()) | |
| 2427 category.setkey("name") | |
| 2428 | |
| 2429 Here we are setting up a chunk of the database which we are calling | |
| 2430 "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
|
2431 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
|
2432 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
|
2433 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
|
2434 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
|
2435 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
|
2436 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
|
2437 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2438 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
|
2439 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
|
2440 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
|
2441 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
|
2442 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
|
2443 the category:: |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2444 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2445 issue = IssueClass(db, "issue", ... , |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2446 category=Multilink("category"), ... ) |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2447 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2448 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
|
2449 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
|
2450 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
|
2451 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2452 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
|
2453 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
|
2454 |
| 1098 | 2455 |
|
1235
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2456 Populating the new category class |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2457 ::::::::::::::::::::::::::::::::: |
|
1235
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2458 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2459 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
|
2460 "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
|
2461 ``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
|
2462 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2463 # 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
|
2464 # 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
|
2465 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2466 Add:: |
|
1235
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2467 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2468 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
|
2469 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
|
2470 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
|
2471 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
|
2472 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2473 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
|
2474 ``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
|
2475 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2476 % 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
|
2477 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
|
2478 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
|
2479 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
|
2480 1 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2481 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
|
2482 2 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2483 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
|
2484 3 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2485 roundup> exit... |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2486 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
|
2487 |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2488 TODO: explain why order=1 in each case. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2489 |
|
1235
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2490 |
| 1098 | 2491 Setting up security on the new objects |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2492 :::::::::::::::::::::::::::::::::::::: |
| 1098 | 2493 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2494 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
|
2495 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
|
2496 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
|
2497 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
|
2498 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2499 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
|
2500 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
|
2501 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2502 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
|
2503 them to various roles. Simply add the new "category" to both lists:: |
| 1098 | 2504 |
| 2505 # new permissions for this schema | |
| 2506 for cl in 'issue', 'file', 'msg', 'user', 'category': | |
| 2507 db.security.addPermission(name="Edit", klass=cl, | |
| 2508 description="User is allowed to edit "+cl) | |
| 2509 db.security.addPermission(name="View", klass=cl, | |
| 2510 description="User is allowed to access "+cl) | |
| 2511 | |
| 2512 # Assign the access and edit permissions for issue, file and message | |
| 2513 # to regular users now | |
| 2514 for cl in 'issue', 'file', 'msg', 'category': | |
| 2515 p = db.security.getPermission('View', cl) | |
| 2516 db.security.addPermissionToRole('User', p) | |
| 2517 p = db.security.getPermission('Edit', cl) | |
| 2518 db.security.addPermissionToRole('User', p) | |
| 2519 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2520 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
|
2521 value):: |
| 1098 | 2522 |
| 2523 db.security.addPermission(name="Edit", klass='category', | |
| 2524 description="User is allowed to edit "+'category') | |
| 2525 db.security.addPermission(name="View", klass='category', | |
| 2526 description="User is allowed to access "+'category') | |
| 2527 | |
| 2528 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
|
2529 "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
|
2530 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
|
2531 edit "category" objects:: |
| 1098 | 2532 |
| 2533 p = db.security.getPermission('View', 'category') | |
| 2534 db.security.addPermissionToRole('User', p) | |
| 2535 | |
| 2536 p = db.security.getPermission('Edit', 'category') | |
| 2537 db.security.addPermissionToRole('User', p) | |
| 2538 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2539 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
|
2540 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
|
2541 interface stuff. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2542 |
| 1098 | 2543 |
| 2544 Changing the web left hand frame | |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2545 :::::::::::::::::::::::::::::::: |
| 1098 | 2546 |
| 2547 We need to give the users the ability to create new categories, and the | |
| 2548 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
|
2549 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
|
2550 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
|
2551 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2552 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
|
2553 "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
|
2554 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
|
2555 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
|
2556 are going to add the category code:: |
| 1098 | 2557 |
| 2558 <p class="classblock" | |
| 2559 tal:condition="python:request.user.hasPermission('View', 'category')"> | |
| 2560 <b>Categories</b><br> | |
| 2561 <a tal:condition="python:request.user.hasPermission('Edit', 'category')" | |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2562 href="category?@template=item">New Category<br></a> |
| 1098 | 2563 </p> |
| 2564 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2565 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
|
2566 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
|
2567 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
|
2568 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
|
2569 get that. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2570 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2571 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
|
2572 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
|
2573 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
|
2574 they will get a link to another page which will let the user add new |
| 1098 | 2575 categories. |
| 2576 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2577 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
|
2578 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
|
2579 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
|
2580 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
|
2581 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
|
2582 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
|
2583 would see the "Categories" stuff. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2584 |
| 1098 | 2585 |
| 2586 Setting up a page to edit categories | |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2587 :::::::::::::::::::::::::::::::::::: |
| 1098 | 2588 |
| 2589 We defined code in the previous section which let users with the | |
| 2590 appropriate permissions see a link to a page which would let them edit | |
| 2591 conditions. Now we have to write that page. | |
| 2592 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2593 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
|
2594 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
|
2595 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
|
2596 write now. |
| 1098 | 2597 |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2598 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
|
2599 of the code at all, but is useful for debugging. If you load a page in a |
| 1098 | 2600 browser and look at the page source, you can see which sections come |
| 2601 from which files by looking for these comments:: | |
| 2602 | |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2603 <!-- category.item --> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2604 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2605 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
|
2606 trappings:: |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2607 |
| 1214 | 2608 <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
|
2609 <title metal:fill-slot="head_title">Category editing</title> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2610 <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
|
2611 <h2>Category editing</h2> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2612 </td> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2613 <td class="content" metal:fill-slot="content"> |
| 1098 | 2614 |
| 2615 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
|
2616 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
|
2617 form through only once. This is to stop users hitting the send button |
| 1098 | 2618 multiple times when they are impatient and thus having the form sent |
| 2619 multiple times:: | |
| 2620 | |
| 2621 <form method="POST" onSubmit="return submit_once()" | |
| 2622 enctype="multipart/form-data"> | |
| 2623 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2624 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
|
2625 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
|
2626 they better put something in it, otherwise the whole form is pointless:: |
| 1098 | 2627 |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2628 <input type="hidden" name="@required" value="name"> |
| 1098 | 2629 |
| 2630 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
|
2631 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
|
2632 happening:: |
| 1098 | 2633 |
| 2634 <table class="form"> | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2635 <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
|
2636 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2637 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
|
2638 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
|
2639 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
|
2640 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
|
2641 "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
|
2642 to the form, a new category will be created with that name:: |
| 1098 | 2643 |
| 2644 <tr> | |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
2645 <th>Name</th> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2646 <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
|
2647 name</td> |
| 1098 | 2648 </tr> |
| 2649 | |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2650 Then a submit button so that the user can submit the new category:: |
| 1098 | 2651 |
| 2652 <tr> | |
| 2653 <td> </td> | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2654 <td colspan="3" tal:content="structure context/submit"> |
| 1098 | 2655 submit button will go here |
| 2656 </td> | |
| 2657 </tr> | |
| 2658 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2659 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
|
2660 stuff:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2661 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2662 </td> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2663 </tal:block> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2664 |
| 1098 | 2665 So putting it all together, and closing the table and form we get:: |
| 2666 | |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2667 <!-- category.item --> |
| 1214 | 2668 <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
|
2669 <title metal:fill-slot="head_title">Category editing</title> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2670 <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
|
2671 <h2>Category editing</h2> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2672 </td> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2673 <td class="content" metal:fill-slot="content"> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2674 <form method="POST" onSubmit="return submit_once()" |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2675 enctype="multipart/form-data"> |
| 1098 | 2676 |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2677 <table class="form"> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2678 <tr><th class="header" colspan="2">Category</th></tr> |
| 1098 | 2679 |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2680 <tr> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
2681 <th>Name</th> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2682 <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
|
2683 name</td> |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2684 </tr> |
| 1098 | 2685 |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2686 <tr> |
|
1829
4e4afbe3cd30
Move '<input type="hidden">' elements into a block.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1825
diff
changeset
|
2687 <td> |
|
4e4afbe3cd30
Move '<input type="hidden">' elements into a block.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1825
diff
changeset
|
2688 |
|
4e4afbe3cd30
Move '<input type="hidden">' elements into a block.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1825
diff
changeset
|
2689 <input type="hidden" name="@required" value="name"> |
|
4e4afbe3cd30
Move '<input type="hidden">' elements into a block.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1825
diff
changeset
|
2690 </td> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2691 <td colspan="3" tal:content="structure context/submit"> |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2692 submit button will go here |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2693 </td> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2694 </tr> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2695 </table> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2696 </form> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2697 </td> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2698 </tal:block> |
| 1098 | 2699 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2700 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
|
2701 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
|
2702 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
|
2703 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
|
2704 |
| 1098 | 2705 |
| 2706 Adding the category to the issue | |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2707 :::::::::::::::::::::::::::::::: |
| 1098 | 2708 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2709 We now have the ability to create issues to our heart's content, but |
| 1098 | 2710 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
|
2711 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
|
2712 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
|
2713 is created. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2714 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2715 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
|
2716 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
|
2717 stuff, it is entirely up to your sense of aesthetics:: |
| 1098 | 2718 |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
2719 <th>Category</th> |
| 1098 | 2720 <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
|
2721 <span tal:replace="structure db/category/classhelp" /> |
| 1098 | 2722 </td> |
| 2723 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2724 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
|
2725 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
|
2726 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
|
2727 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
|
2728 issue). |
| 1098 | 2729 |
| 2730 The classhelp lines generate a link (labelled "list") to a popup window | |
| 2731 which contains the list of currently known categories. | |
| 2732 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2733 |
| 1098 | 2734 Searching on categories |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2735 ::::::::::::::::::::::: |
| 1098 | 2736 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2737 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
|
2738 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
|
2739 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
|
2740 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
|
2741 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2742 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
|
2743 find that it looks something like |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2744 ``<a href="issue?@template=search">Search Issues</a>``. This shows us |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2745 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
|
2746 ``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
|
2747 change. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2748 |
|
1730
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2749 If you look at this file it should be starting to seem familiar, although it |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2750 does use some new macros. You can add the new category search code anywhere you |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2751 like within that form:: |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2752 |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2753 <tr tal:define="name string:category; |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2754 db_klass string:category; |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2755 db_content string:name;"> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2756 <th>Priority:</th> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2757 <td metal:use-macro="search_select"></td> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2758 <td metal:use-macro="column_input"></td> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2759 <td metal:use-macro="sort_input"></td> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2760 <td metal:use-macro="group_input"></td> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2761 </tr> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2762 |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2763 The definitions in the <tr> opening tag are used by the macros: |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2764 |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2765 - search_select expands to a drop-down box with all categories using db_klass |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2766 and db_content. |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2767 - column_input expands to a checkbox for selecting what columns should be |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2768 displayed. |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2769 - sort_input expands to a radio button for selecting what property should be |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2770 sorted on. |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2771 - group_input expands to a radio button for selecting what property should be |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2772 group on. |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2773 |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2774 The category search code above would expand to the following:: |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2775 |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2776 <tr> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2777 <th>Category:</th> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2778 <td> |
| 1098 | 2779 <select name="category"> |
|
1730
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2780 <option value="">don't care</option> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2781 <option value="">------------</option> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2782 <option value="1">scipy</option> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2783 <option value="2">chaco</option> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2784 <option value="3">weave</option> |
| 1098 | 2785 </select> |
|
1730
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2786 </td> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2787 <td><input type="checkbox" name=":columns" value="category"></td> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2788 <td><input type="radio" name=":sort" value="category"></td> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2789 <td><input type="radio" name=":group" value="category"></td> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
2790 </tr> |
| 1098 | 2791 |
| 2792 Adding category to the default view | |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2793 ::::::::::::::::::::::::::::::::::: |
| 1098 | 2794 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2795 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
|
2796 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
|
2797 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
|
2798 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
|
2799 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
|
2800 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2801 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
|
2802 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
|
2803 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
|
2804 forth. |
| 1098 | 2805 |
| 2806 Firstly we need to add an appropriate header to the start of the table:: | |
| 2807 | |
| 2808 <th tal:condition="request/show/category">Category</th> | |
| 2809 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2810 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
|
2811 Category column if the user has selected not to see it. |
| 1098 | 2812 |
| 2813 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
|
2814 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
|
2815 that every issue gets assigned to "i" in turn. |
| 1098 | 2816 |
| 2817 The new part of code to display the category will look like this:: | |
| 2818 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2819 <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
|
2820 tal:content="i/category"></td> |
| 1098 | 2821 |
| 2822 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
|
2823 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
|
2824 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
|
2825 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2826 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
|
2827 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
|
2828 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
|
2829 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
|
2830 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
|
2831 tells roundup which fields of the issue to display. Simply add |
| 1098 | 2832 "category" to that list and it all should work. |
| 2833 | |
| 1262 | 2834 Adding a time log to your issues |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2835 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 1262 | 2836 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2837 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
|
2838 be able to give a summary of the total time spent on a particular issue. |
| 1262 | 2839 |
| 2840 1. Add a new class to your tracker ``dbinit.py``:: | |
| 2841 | |
| 2842 # storage for time logging | |
| 2843 timelog = Class(db, "timelog", period=Interval()) | |
| 2844 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2845 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
|
2846 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
|
2847 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2848 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
|
2849 ``dbinit.py``):: |
| 1262 | 2850 |
| 2851 issue = IssueClass(db, "issue", | |
| 2852 assignedto=Link("user"), topic=Multilink("keyword"), | |
| 2853 priority=Link("priority"), status=Link("status"), | |
| 2854 times=Multilink("timelog")) | |
| 2855 | |
| 2856 the "times" property is the new link to the "timelog" class. | |
| 2857 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2858 3. We'll need to let people add in times to the issue, so in the web |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2859 interface we'll have a new entry field. This is a special field |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2860 because unlike the other fields in the issue.item template, it |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2861 affects a different item (a timelog item) and not the template's |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2862 item, an issue. We have a special syntax for form fields that affect |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2863 items other than the template default item (see the cgi |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2864 documentation on `special form variables`_). In particular, we add a |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2865 field to capture a new timelog item's perdiod:: |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2866 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2867 <tr> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
2868 <th>Time Log</th> |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2869 <td colspan=3><input type="text" name="timelog-1@period" /> |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2870 <br />(enter as '3y 1m 4d 2:40:02' or parts thereof) |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2871 </td> |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2872 </tr> |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2873 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2874 and another hidden field that links that new timelog item (new |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2875 because it's marked as having id "-1") to the issue item. It looks |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2876 like this:: |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2877 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2878 <input type="hidden" name="@link@times" value="timelog-1" /> |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2879 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2880 On submission, the "-1" timelog item will be created and assigned a |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2881 real item id. The "times" property of the issue will have the new id |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2882 added to it. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2883 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2884 4. We want to display a total of the time log times that have been |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2885 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
|
2886 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
|
2887 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
|
2888 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
|
2889 |
|
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2890 class TemplatingUtils: |
|
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2891 ''' 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
|
2892 templates through the 'utils' variable. |
|
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2893 ''' |
|
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2894 def totalTimeSpent(self, times): |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2895 ''' 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
|
2896 Interval "period" property) |
|
1270
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2897 ''' |
|
1980
8a6077ec701b
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1966
diff
changeset
|
2898 total = Interval('0d') |
|
1270
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2899 for time in times: |
|
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2900 total += time.period._value |
|
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2901 return total |
|
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2902 |
|
1980
8a6077ec701b
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1966
diff
changeset
|
2903 Replace the ``pass`` line if one appears in your TemplatingUtils |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2904 class. As indicated in the docstrings, we will be able to access the |
|
1980
8a6077ec701b
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1966
diff
changeset
|
2905 ``totalTimeSpent`` method via the ``utils`` variable in our templates. |
|
1270
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2906 |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2907 5. Display the time log for an issue:: |
| 1262 | 2908 |
| 2909 <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
|
2910 <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
|
2911 <tal:block |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2912 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
|
2913 </th></tr> |
| 1262 | 2914 <tr><th>Date</th><th>Period</th><th>Logged By</th></tr> |
| 2915 <tr tal:repeat="time context/times"> | |
| 2916 <td tal:content="time/creation"></td> | |
| 2917 <td tal:content="time/period"></td> | |
| 2918 <td tal:content="time/creator"></td> | |
| 2919 </tr> | |
| 2920 </table> | |
| 2921 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2922 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
|
2923 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
|
2924 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
|
2925 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
|
2926 and 40 minutes). |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2927 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2928 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
|
2929 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
|
2930 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
|
2931 time logging interface. |
| 1262 | 2932 |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2933 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2934 Tracking different types of issues |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2935 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2936 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2937 Sometimes you will want to track different types of issues - developer, |
|
2159
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
2938 customer support, systems, sales leads, etc. A single Roundup tracker is |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2939 able to support multiple types of issues. This example demonstrates adding |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2940 a customer support issue class to a tracker. |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2941 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2942 1. Figure out what information you're going to want to capture. OK, so |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2943 this is obvious, but sometimes it's better to actually sit down for a |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2944 while and think about the schema you're going to implement. |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2945 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2946 2. Add the new issue class to your tracker's ``dbinit.py`` - in this |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2947 example, we're adding a "system support" class. Just after the "issue" |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2948 class definition in the "open" function, add:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2949 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2950 support = IssueClass(db, "support", |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2951 assignedto=Link("user"), topic=Multilink("keyword"), |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2952 status=Link("status"), deadline=Date(), |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2953 affects=Multilink("system")) |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2954 |
|
2159
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
2955 3. Copy the existing "issue.*" (item, search and index) templates in the |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
2956 tracker's "html" to "support.*". Edit them so they use the properties |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
2957 defined in the "support" class. Be sure to check for hidden form |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
2958 variables like "required" to make sure they have the correct set of |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
2959 required properties. |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
2960 |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
2961 4. Edit the modules in the "detectors", adding lines to their "init" |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
2962 functions where appropriate. Look for "audit" and "react" registrations |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
2963 on the "issue" class, and duplicate them for "support". |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
2964 |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
2965 5. Create a new sidebar box for the new support class. Duplicate the |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
2966 existing issues one, changing the "issue" class name to "support". |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
2967 |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
2968 6. Re-start your tracker and start using the new "support" class. |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
2969 |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
2970 |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
2971 Optionally, you might want to restrict the users able to access this new |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
2972 class to just the users with a new "SysAdmin" Role. To do this, we add |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
2973 some security declarations:: |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2974 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2975 p = db.security.getPermission('View', 'support') |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2976 db.security.addPermissionToRole('SysAdmin', p) |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2977 p = db.security.getPermission('Edit', 'support') |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2978 db.security.addPermissionToRole('SysAdmin', p) |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2979 |
|
2159
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
2980 You would then (as an "admin" user) edit the details of the appropriate |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
2981 users, and add "SysAdmin" to their Roles list. |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
2982 |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
2983 Alternatively, you might want to change the Edit/View permissions granted |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
2984 for the "issue" class so that it's only available to users with the "System" |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
2985 or "Developer" Role, and then the new class you're adding is available to |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
2986 all with the "User" Role. |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2987 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2988 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2989 Using External User Databases |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2990 ----------------------------- |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2991 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2992 Using an external password validation source |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2993 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2994 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2995 We have a centrally-managed password changing system for our users. This |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2996 results in a UN*X passwd-style file that we use for verification of |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2997 users. Entries in the file consist of ``name:password`` where the |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2998 password is encrypted using the standard UN*X ``crypt()`` function (see |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2999 the ``crypt`` module in your Python distribution). An example entry |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3000 would be:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3001 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3002 admin:aamrgyQfDFSHw |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3003 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3004 Each user of Roundup must still have their information stored in the Roundup |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3005 database - we just use the passwd file to check their password. To do this, we |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3006 need to override the standard ``verifyPassword`` method defined in |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3007 ``roundup.cgi.actions.LoginAction`` and register the new class with our |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3008 ``Client`` class in the tracker home ``interfaces.py`` module:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3009 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3010 from roundup.cgi.actions import LoginAction |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3011 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3012 class ExternalPasswordLoginAction(LoginAction): |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3013 def verifyPassword(self, userid, password): |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3014 # get the user's username |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3015 username = self.db.user.get(userid, 'username') |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3016 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3017 # the passwords are stored in the "passwd.txt" file in the |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3018 # tracker home |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3019 file = os.path.join(self.db.config.TRACKER_HOME, 'passwd.txt') |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3020 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3021 # see if we can find a match |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3022 for ent in [line.strip().split(':') for line in |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3023 open(file).readlines()]: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3024 if ent[0] == username: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3025 return crypt.crypt(password, ent[1][:2]) == ent[1] |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3026 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3027 # user doesn't exist in the file |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3028 return 0 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3029 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3030 class Client(client.Client): |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3031 actions = client.Client.actions + ( |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3032 ('login', ExternalPasswordLoginAction) |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3033 ) |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3034 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3035 What this does is look through the file, line by line, looking for a |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3036 name that matches. |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3037 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3038 We also remove the redundant password fields from the ``user.item`` |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3039 template. |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3040 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3041 |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3042 Using a UN*X passwd file as the user database |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3043 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3044 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3045 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
|
3046 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
|
3047 and primary user group. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3048 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3049 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
|
3050 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
|
3051 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
|
3052 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
|
3053 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
|
3054 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3055 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
|
3056 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
|
3057 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
|
3058 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
|
3059 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
|
3060 immediate access is needed. In short, it: |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3061 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3062 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
|
3063 2. compares that list to the current roundup user list: |
|
1299
b2d04ce03802
Email improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
1293
diff
changeset
|
3064 |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3065 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
|
3066 b. entries with mismatching real names are *updated* |
| 1293 | 3067 c. entries only exist in the passwd file are *created* |
|
1299
b2d04ce03802
Email improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
1293
diff
changeset
|
3068 |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3069 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
|
3070 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3071 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
|
3072 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
|
3073 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
|
3074 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
|
3075 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
|
3076 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
|
3077 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
|
3078 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3079 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
|
3080 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
|
3081 tracker we're to work on:: |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3082 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3083 import sys, os, smtplib |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3084 from roundup import instance, date |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3085 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3086 # open the tracker |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3087 tracker_home = sys.argv[1] |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3088 tracker = instance.open(tracker_home) |
|
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 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
|
3091 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3092 # read in the users |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3093 file = os.path.join(tracker_home, 'users.passwd') |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3094 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
|
3095 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3096 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
|
3097 appear in the file):: |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3098 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3099 # 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
|
3100 # "real" users |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3101 ignore = ['ekmmon', 'bfast', 'csrmail'] |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3102 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3103 # 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
|
3104 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
|
3105 'cs_pool', 'anonymous', 'system_pool', 'automated'] |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3106 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3107 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
|
3108 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3109 roles = { |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3110 '501': 'User,Tech', # tech |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3111 '502': 'User', # finance |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3112 '503': 'User,CSR', # customer service reps |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3113 '504': 'User', # sales |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3114 '505': 'User', # marketing |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3115 } |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3116 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3117 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
|
3118 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
|
3119 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
|
3120 now do all the work:: |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3121 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3122 # open the database |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3123 db = tracker.open('admin') |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3124 try: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3125 # 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
|
3126 msg = [] |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3127 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3128 # 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
|
3129 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
|
3130 if user in ignore: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3131 # this user shouldn't appear in our tracker |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3132 continue |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3133 keep.append(user) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3134 try: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3135 # see if the user exists in the tracker |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3136 uid = db.user.lookup(user) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3137 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3138 # 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
|
3139 if real != db.user.get(uid, 'realname'): |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3140 db.user.set(uid, realname=real) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3141 msg.append('FIX %s - %s'%(user, real)) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3142 except KeyError: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3143 # nope, the user doesn't exist |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3144 db.user.create(username=user, realname=real, |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3145 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
|
3146 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
|
3147 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3148 # 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
|
3149 # "keep" list - retire those who aren't |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3150 for uid in db.user.list(): |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3151 user = db.user.get(uid, 'username') |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3152 if user not in keep: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3153 db.user.retire(uid) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3154 msg.append('RET %s'%user) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3155 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3156 # 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
|
3157 if msg: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3158 # create the email |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3159 msg = '''Subject: %s user database maintenance |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3160 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3161 %s |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3162 '''%(db.config.TRACKER_NAME, '\n'.join(msg)) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3163 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3164 # send the email |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3165 smtp = smtplib.SMTP(db.config.MAILHOST) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3166 addr = db.config.ADMIN_EMAIL |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3167 smtp.sendmail(addr, addr, msg) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3168 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3169 # now we're done - commit the changes |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3170 db.commit() |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3171 finally: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3172 # always close the database cleanly |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3173 db.close() |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3174 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3175 And that's it! |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3176 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3177 |
|
1680
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3178 Using an LDAP database for user information |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3179 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
1680
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3180 |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3181 A script that reads users from an LDAP store using |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3182 http://python-ldap.sf.net/ and then compares the list to the users in the |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3183 roundup user database would be pretty easy to write. You'd then have it run |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3184 once an hour / day (or on demand if you can work that into your LDAP store |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3185 workflow). See the example `Using a UN*X passwd file as the user database`_ |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3186 for more information about doing this. |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3187 |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3188 To authenticate off the LDAP store (rather than using the passwords in the |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3189 roundup user database) you'd use the same python-ldap module inside an |
|
2017
31d920b31642
Update customization examples too, expand upgrade notice a bit.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2016
diff
changeset
|
3190 extension to the cgi interface. You'd do this by overriding the method called |
|
31d920b31642
Update customization examples too, expand upgrade notice a bit.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2016
diff
changeset
|
3191 "verifyPassword" on the LoginAction class in your tracker's interfaces.py |
|
31d920b31642
Update customization examples too, expand upgrade notice a bit.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2016
diff
changeset
|
3192 module (see `using an external password validation source`_). The method is |
|
31d920b31642
Update customization examples too, expand upgrade notice a bit.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2016
diff
changeset
|
3193 implemented by default as:: |
|
1680
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3194 |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3195 def verifyPassword(self, userid, password): |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3196 ''' Verify the password that the user has supplied |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3197 ''' |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3198 stored = self.db.user.get(self.userid, 'password') |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3199 if password == stored: |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3200 return 1 |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3201 if not password and not stored: |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3202 return 1 |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3203 return 0 |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3204 |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3205 So you could reimplement this as something like:: |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3206 |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3207 def verifyPassword(self, userid, password): |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3208 ''' Verify the password that the user has supplied |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3209 ''' |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3210 # look up some unique LDAP information about the user |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3211 username = self.db.user.get(self.userid, 'username') |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3212 # now verify the password supplied against the LDAP store |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3213 |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3214 |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3215 Changes to Tracker Behaviour |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3216 ---------------------------- |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3217 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3218 Stop "nosy" messages going to people on vacation |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3219 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3220 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3221 When users go on vacation and set up vacation email bouncing, you'll |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3222 start to see a lot of messages come back through Roundup "Fred is on |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3223 vacation". Not very useful, and relatively easy to stop. |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3224 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3225 1. add a "vacation" flag to your users:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3226 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3227 user = Class(db, "user", |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3228 username=String(), password=Password(), |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3229 address=String(), realname=String(), |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3230 phone=String(), organisation=String(), |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3231 alternate_addresses=String(), |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3232 roles=String(), queries=Multilink("query"), |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3233 vacation=Boolean()) |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3234 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3235 2. So that users may edit the vacation flags, add something like the |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3236 following to your ``user.item`` template:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3237 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3238 <tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3239 <th>On Vacation</th> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3240 <td tal:content="structure context/vacation/field">vacation</td> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3241 </tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3242 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3243 3. edit your detector ``nosyreactor.py`` so that the ``nosyreaction()`` |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3244 consists of:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3245 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3246 def nosyreaction(db, cl, nodeid, oldvalues): |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3247 users = db.user |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3248 messages = db.msg |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3249 # send a copy of all new messages to the nosy list |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3250 for msgid in determineNewMessages(cl, nodeid, oldvalues): |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3251 try: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3252 # figure the recipient ids |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3253 sendto = [] |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3254 seen_message = {} |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3255 recipients = messages.get(msgid, 'recipients') |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3256 for recipid in messages.get(msgid, 'recipients'): |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3257 seen_message[recipid] = 1 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3258 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3259 # figure the author's id, and indicate they've received |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3260 # the message |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3261 authid = messages.get(msgid, 'author') |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3262 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3263 # possibly send the message to the author, as long as |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3264 # they aren't anonymous |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3265 if (db.config.MESSAGES_TO_AUTHOR == 'yes' and |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3266 users.get(authid, 'username') != 'anonymous'): |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3267 sendto.append(authid) |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3268 seen_message[authid] = 1 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3269 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3270 # now figure the nosy people who weren't recipients |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3271 nosy = cl.get(nodeid, 'nosy') |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3272 for nosyid in nosy: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3273 # Don't send nosy mail to the anonymous user (that |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3274 # user shouldn't appear in the nosy list, but just |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3275 # in case they do...) |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3276 if users.get(nosyid, 'username') == 'anonymous': |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3277 continue |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3278 # make sure they haven't seen the message already |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3279 if not seen_message.has_key(nosyid): |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3280 # send it to them |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3281 sendto.append(nosyid) |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3282 recipients.append(nosyid) |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3283 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3284 # generate a change note |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3285 if oldvalues: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3286 note = cl.generateChangeNote(nodeid, oldvalues) |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3287 else: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3288 note = cl.generateCreateNote(nodeid) |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3289 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3290 # we have new recipients |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3291 if sendto: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3292 # filter out the people on vacation |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3293 sendto = [i for i in sendto |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3294 if not users.get(i, 'vacation', 0)] |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3295 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3296 # map userids to addresses |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3297 sendto = [users.get(i, 'address') for i in sendto] |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3298 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3299 # update the message's recipients list |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3300 messages.set(msgid, recipients=recipients) |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3301 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3302 # send the message |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3303 cl.send_message(nodeid, msgid, note, sendto) |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3304 except roundupdb.MessageSendError, message: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3305 raise roundupdb.DetectorError, message |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3306 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3307 Note that this is the standard nosy reaction code, with the small |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3308 addition of:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3309 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3310 # filter out the people on vacation |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3311 sendto = [i for i in sendto if not users.get(i, 'vacation', 0)] |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3312 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3313 which filters out the users that have the vacation flag set to true. |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3314 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3315 Adding in state transition control |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3316 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3317 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3318 Sometimes tracker admins want to control the states that users may move |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3319 issues to. You can do this by following these steps: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3320 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3321 1. make "status" a required variable. This is achieved by adding the |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3322 following to the top of the form in the ``issue.item.html`` |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3323 template:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3324 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3325 <input type="hidden" name="@required" value="status"> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3326 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3327 this will force users to select a status. |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3328 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3329 2. add a Multilink property to the status class:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3330 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3331 stat = Class(db, "status", ... , transitions=Multilink('status'), |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3332 ...) |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3333 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3334 and then edit the statuses already created, either: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3335 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3336 a. through the web using the class list -> status class editor, or |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3337 b. using the roundup-admin "set" command. |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3338 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3339 3. add an auditor module ``checktransition.py`` in your tracker's |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3340 ``detectors`` directory, for example:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3341 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3342 def checktransition(db, cl, nodeid, newvalues): |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3343 ''' Check that the desired transition is valid for the "status" |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3344 property. |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3345 ''' |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3346 if not newvalues.has_key('status'): |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3347 return |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3348 current = cl.get(nodeid, 'status') |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3349 new = newvalues['status'] |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3350 if new == current: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3351 return |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3352 ok = db.status.get(current, 'transitions') |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3353 if new not in ok: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3354 raise ValueError, 'Status not allowed to move from "%s" to "%s"'%( |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3355 db.status.get(current, 'name'), db.status.get(new, 'name')) |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3356 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3357 def init(db): |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3358 db.issue.audit('set', checktransition) |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3359 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3360 4. in the ``issue.item.html`` template, change the status editing bit |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3361 from:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3362 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3363 <th>Status</th> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3364 <td tal:content="structure context/status/menu">status</td> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3365 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3366 to:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3367 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3368 <th>Status</th> |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3369 <td> |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3370 <select tal:condition="context/id" name="status"> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3371 <tal:block tal:define="ok context/status/transitions" |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3372 tal:repeat="state db/status/list"> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3373 <option tal:condition="python:state.id in ok" |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3374 tal:attributes=" |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3375 value state/id; |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3376 selected python:state.id == context.status.id" |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3377 tal:content="state/name"></option> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3378 </tal:block> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3379 </select> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3380 <tal:block tal:condition="not:context/id" |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3381 tal:replace="structure context/status/menu" /> |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3382 </td> |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3383 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3384 which displays only the allowed status to transition to. |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3385 |
| 1262 | 3386 |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3387 Blocking issues that depend on other issues |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3388 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3389 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3390 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
|
3391 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
|
3392 resolved. To achieve this: |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3393 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3394 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
|
3395 ``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
|
3396 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
|
3397 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3398 issue = IssueClass(db, "issue", |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3399 assignedto=Link("user"), topic=Multilink("keyword"), |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3400 priority=Link("priority"), status=Link("status")) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3401 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3402 add the blockers entry like so:: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3403 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3404 issue = IssueClass(db, "issue", |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3405 blockers=Multilink("issue"), |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3406 assignedto=Link("user"), topic=Multilink("keyword"), |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3407 priority=Link("priority"), status=Link("status")) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3408 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3409 2. Add the new "blockers" property to the issue.item edit page, using |
| 1560 | 3410 something like:: |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3411 |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
3412 <th>Waiting On</th> |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3413 <td> |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3414 <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
|
3415 size=20)" /> |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3416 <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
|
3417 <span tal:condition="context/blockers" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3418 tal:repeat="blk context/blockers"> |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3419 <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
|
3420 tal:content="blk/id"></a> |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3421 </span> |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3422 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3423 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
|
3424 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
|
3425 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
|
3426 the "superseders" field. |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3427 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3428 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
|
3429 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3430 - 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
|
3431 - 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
|
3432 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3433 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
|
3434 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3435 def blockresolution(db, cl, nodeid, newvalues): |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3436 ''' 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
|
3437 ''' |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3438 if nodeid is None: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3439 blockers = [] |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3440 else: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3441 blockers = cl.get(nodeid, 'blockers') |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3442 blockers = newvalues.get('blockers', blockers) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3443 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3444 # 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
|
3445 # changed |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3446 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
|
3447 return |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3448 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3449 # get the resolved state ID |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3450 resolved_id = db.status.lookup('resolved') |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3451 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3452 # format the info |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3453 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
|
3454 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
|
3455 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
|
3456 if len(blockers) == 1: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3457 s = 'issue %s is'%s |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3458 else: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3459 s = 'issues %s are'%s |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3460 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3461 # 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
|
3462 if newvalues['status'] == resolved_id: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3463 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
|
3464 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3465 def resolveblockers(db, cl, nodeid, newvalues): |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3466 ''' 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
|
3467 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
|
3468 ''' |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3469 if not newvalues.has_key('status'): |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3470 return |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3471 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3472 # get the resolved state ID |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3473 resolved_id = db.status.lookup('resolved') |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3474 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3475 # interesting? |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3476 if newvalues['status'] != resolved_id: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3477 return |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3478 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3479 # 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
|
3480 # their blockers list |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3481 issues = cl.find(blockers=nodeid) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3482 for issueid in issues: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3483 blockers = cl.get(issueid, 'blockers') |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3484 if nodeid in blockers: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3485 blockers.remove(nodeid) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3486 cl.set(issueid, blockers=blockers) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3487 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3488 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3489 def init(db): |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3490 # 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
|
3491 db.issue.audit('create', blockresolution) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3492 db.issue.audit('set', blockresolution) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3493 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3494 # can only happen on a set |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3495 db.issue.react('set', resolveblockers) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3496 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3497 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
|
3498 "detectors" directory. |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3499 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3500 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
|
3501 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
|
3502 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
|
3503 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
|
3504 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
|
3505 |
| 2409 | 3506 <a href="issue?:sort=-activity&:group=priority&:filter=status& |
| 3507 :columns=id,activity,title,creator,assignedto,status& | |
| 3508 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
|
3509 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3510 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
|
3511 ":filter" *and* "blockers" values must be specified):: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3512 |
| 2409 | 3513 <a href="issue?:sort=-activity&:group=priority&:filter=status,blockers& |
| 3514 blockers=-1&:columns=id,activity,title,creator,assignedto,status& | |
| 3515 status=-1,1,2,3,4,5,6,7">Show All</a><br> | |
| 3516 | |
| 3517 :Note: the above examples are line-wrapped on the trailing & and should | |
| 3518 be unwrapped. | |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3519 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3520 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
|
3521 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
|
3522 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
|
3523 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
|
3524 another issue's "blockers" property. |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3525 |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3526 Add users to the nosy list based on the topic |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3527 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3528 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3529 We need the ability to automatically add users to the nosy list based |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3530 on the occurence of a topic. Every user should be allowed to edit his |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3531 own list of topics for which he wants to be added to the nosy list. |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3532 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3533 Below will be showed that such a change can be performed with only |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3534 minimal understanding of the roundup system, but with clever use |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3535 of Copy and Paste. |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3536 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3537 This requires three changes to the tracker: a change in the database to |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3538 allow per-user recording of the lists of topics for which he wants to |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3539 be put on the nosy list, a change in the user view allowing to edit |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3540 this list of topics, and addition of an auditor which updates the nosy |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3541 list when a topic is set. |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3542 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3543 Adding the nosy topic list |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3544 :::::::::::::::::::::::::: |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3545 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3546 The change in the database to make is that for any user there should be |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3547 a list of topics for which he wants to be put on the nosy list. Adding |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3548 a ``Multilink`` of ``keyword`` seem to fullfill this (note that within |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3549 the code topics are called ``keywords``.) As such, all what has to be |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3550 done is to add a new field to the definition of ``user`` within the |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3551 file ``dbinit.py``. We will call this new field ``nosy_keywords``, and |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3552 the updated definition of user will be:: |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3553 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3554 user = Class(db, "user", |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3555 username=String(), password=Password(), |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3556 address=String(), realname=String(), |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3557 phone=String(), organisation=String(), |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3558 alternate_addresses=String(), |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3559 queries=Multilink('query'), roles=String(), |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3560 timezone=String(), |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3561 nosy_keywords=Multilink('keyword')) |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3562 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3563 Changing the user view to allow changing the nosy topic list |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3564 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3565 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3566 We want any user to be able to change the list of topics for which |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3567 he will by default be added to the nosy list. We choose to add this |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3568 to the user view, as is generated by the file ``html/user.item.html``. |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3569 We easily can |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3570 see that the topic field in the issue view has very similar editting |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3571 requirements as our nosy topics, both being a list of topics. As |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3572 such, we search for Topics in ``issue.item.html``, and extract the |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3573 associated parts from there. We add this to ``user.item.html`` at the |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3574 bottom of the list of viewed items (i.e. just below the 'Alternate |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3575 E-mail addresses' in the classic template):: |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3576 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3577 <tr> |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3578 <th>Nosy Topics</th> |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3579 <td> |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3580 <span tal:replace="structure context/nosy_keywords/field" /> |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3581 <span tal:replace="structure python:db.keyword.classhelp(property='nosy_keywords')" /> |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3582 </td> |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3583 </tr> |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3584 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3585 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3586 Addition of an auditor to update the nosy list |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3587 :::::::::::::::::::::::::::::::::::::::::::::: |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3588 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3589 The more difficult part is the addition of the logic to actually |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3590 at the users to the nosy list when it is required. |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3591 The choice is made to perform this action when the topics on an |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3592 item are set, including when an item is created. |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3593 Here we choose to start out with a copy of the |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3594 ``detectors/nosyreaction.py`` detector, which we copy to the file |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3595 ``detectors/nosy_keyword_reaction.py``. |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3596 This looks like a good start as it also adds users |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3597 to the nosy list. A look through the code reveals that the |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3598 ``nosyreaction`` function actually is sending the e-mail, which |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3599 we do not need. As such, we can change the init function to:: |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3600 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3601 def init(db): |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3602 db.issue.audit('create', update_kw_nosy) |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3603 db.issue.audit('set', update_kw_nosy) |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3604 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3605 After that we rename the ``updatenosy`` function to ``update_kw_nosy``. |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3606 The first two blocks of code in that function relate to settings |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3607 ``current`` to a combination of the old and new nosy lists. This |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3608 functionality is left in the new auditor. The following block of |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3609 code, which in ``updatenosy`` handled adding the assignedto user(s) |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3610 to the nosy list, should be replaced by a block of code to add the |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3611 interested users to the nosy list. We choose here to loop over all |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3612 new topics, than loop over all users, |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3613 and assign the user to the nosy list when the topic in the user's |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3614 nosy_keywords. The next part in ``updatenosy``, adding the author |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3615 and/or recipients of a message to the nosy list, obviously is not |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3616 relevant here and thus is deleted from the new auditor. The last |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3617 part, copying the new nosy list to newvalues, does not have to be changed. |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3618 This brings the following function:: |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3619 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3620 def update_kw_nosy(db, cl, nodeid, newvalues): |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3621 '''Update the nosy list for changes to the topics |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3622 ''' |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3623 # nodeid will be None if this is a new node |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3624 current = {} |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3625 if nodeid is None: |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3626 ok = ('new', 'yes') |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3627 else: |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3628 ok = ('yes',) |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3629 # old node, get the current values from the node if they haven't |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3630 # changed |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3631 if not newvalues.has_key('nosy'): |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3632 nosy = cl.get(nodeid, 'nosy') |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3633 for value in nosy: |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3634 if not current.has_key(value): |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3635 current[value] = 1 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3636 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3637 # if the nosy list changed in this transaction, init from the new value |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3638 if newvalues.has_key('nosy'): |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3639 nosy = newvalues.get('nosy', []) |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3640 for value in nosy: |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3641 if not db.hasnode('user', value): |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3642 continue |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3643 if not current.has_key(value): |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3644 current[value] = 1 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3645 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3646 # add users with topic in nosy_keywords to the nosy list |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3647 if newvalues.has_key('topic') and newvalues['topic'] is not None: |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3648 topic_ids = newvalues['topic'] |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3649 for topic in topic_ids: |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3650 # loop over all users, |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3651 # and assign user to nosy when topic in nosy_keywords |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3652 for user_id in db.user.list(): |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3653 nosy_kw = db.user.get(user_id, "nosy_keywords") |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3654 found = 0 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3655 for kw in nosy_kw: |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3656 if kw == topic: |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3657 found = 1 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3658 if found: |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3659 current[user_id] = 1 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3660 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3661 # that's it, save off the new nosy list |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3662 newvalues['nosy'] = current.keys() |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3663 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3664 and these two function are the only ones needed in the file. |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3665 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3666 TODO: update this example to use the find() Class method. |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3667 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3668 Caveats |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3669 ::::::: |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3670 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3671 A few problems with the design here can be noted: |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3672 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3673 Multiple additions |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3674 When a user, after automatic selection, is manually removed |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3675 from the nosy list, he again is added to the nosy list when the |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3676 topic list of the issue is updated. A better design might be |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3677 to only check which topics are new compared to the old list |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3678 of topics, and only add users when they have indicated |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3679 interest on a new topic. |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3680 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3681 The code could also be changed to only trigger on the create() event, |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3682 rather than also on the set() event, thus only setting the nosy list |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3683 when the issue is created. |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3684 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3685 Scalability |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3686 In the auditor there is a loop over all users. For a site with |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3687 only few users this will pose no serious problem, however, with |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3688 many users this will be a serious performance bottleneck. |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3689 A way out will be to link from the topics to the users which |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3690 selected these topics a nosy topics. This will eliminate the |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3691 loop over all users. |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3692 |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3693 Changes to Security and Permissions |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3694 ----------------------------------- |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3695 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3696 Restricting the list of users that are assignable to a task |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3697 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3698 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3699 1. In your tracker's "dbinit.py", create a new Role, say "Developer":: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3700 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3701 db.security.addRole(name='Developer', description='A developer') |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3702 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3703 2. Just after that, create a new Permission, say "Fixer", specific to |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3704 "issue":: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3705 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3706 p = db.security.addPermission(name='Fixer', klass='issue', |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3707 description='User is allowed to be assigned to fix issues') |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3708 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3709 3. Then assign the new Permission to your "Developer" Role:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3710 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3711 db.security.addPermissionToRole('Developer', p) |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3712 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3713 4. In the issue item edit page ("html/issue.item.html" in your tracker |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3714 directory), use the new Permission in restricting the "assignedto" |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3715 list:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3716 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3717 <select name="assignedto"> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3718 <option value="-1">- no selection -</option> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3719 <tal:block tal:repeat="user db/user/list"> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3720 <option tal:condition="python:user.hasPermission( |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3721 'Fixer', context._classname)" |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3722 tal:attributes=" |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3723 value user/id; |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3724 selected python:user.id == context.assignedto" |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3725 tal:content="user/realname"></option> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3726 </tal:block> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3727 </select> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3728 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3729 For extra security, you may wish to setup an auditor to enforce the |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3730 Permission requirement (install this as "assignedtoFixer.py" in your |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3731 tracker "detectors" directory):: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3732 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3733 def assignedtoMustBeFixer(db, cl, nodeid, newvalues): |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3734 ''' Ensure the assignedto value in newvalues is a used with the |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3735 Fixer Permission |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3736 ''' |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3737 if not newvalues.has_key('assignedto'): |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3738 # don't care |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3739 return |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3740 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3741 # get the userid |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3742 userid = newvalues['assignedto'] |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3743 if not db.security.hasPermission('Fixer', userid, cl.classname): |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3744 raise ValueError, 'You do not have permission to edit %s'%cl.classname |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3745 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3746 def init(db): |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3747 db.issue.audit('set', assignedtoMustBeFixer) |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3748 db.issue.audit('create', assignedtoMustBeFixer) |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3749 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3750 So now, if an edit action attempts to set "assignedto" to a user that |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3751 doesn't have the "Fixer" Permission, the error will be raised. |
|
1816
61a23c293147
added another example
Richard Jones <richard@users.sourceforge.net>
parents:
1808
diff
changeset
|
3752 |
|
1954
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3753 Users may only edit their issues |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3754 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
1954
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3755 |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3756 Users registering themselves are granted Provisional access - meaning they |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3757 have access to edit the issues they submit, but not others. We create a new |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3758 Role called "Provisional User" which is granted to newly-registered users, |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3759 and has limited access. One of the Permissions they have is the new "Edit |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3760 Own" on issues (regular users have "Edit".) We back up the permissions with |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3761 an auditor. |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3762 |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3763 First up, we create the new Role and Permission structure in |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3764 ``dbinit.py``:: |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3765 |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3766 # New users not approved by the admin |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3767 db.security.addRole(name='Provisional User', |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3768 description='New user registered via web or email') |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3769 p = db.security.addPermission(name='Edit Own', klass='issue', |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3770 description='Can only edit own issues') |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3771 db.security.addPermissionToRole('Provisional User', p) |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3772 |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3773 # Assign the access and edit Permissions for issue to new users now |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3774 p = db.security.getPermission('View', 'issue') |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3775 db.security.addPermissionToRole('Provisional User', p) |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3776 p = db.security.getPermission('Edit', 'issue') |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3777 db.security.addPermissionToRole('Provisional User', p) |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3778 |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3779 # and give the new users access to the web and email interface |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3780 p = db.security.getPermission('Web Access') |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3781 db.security.addPermissionToRole('Provisional User', p) |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3782 p = db.security.getPermission('Email Access') |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3783 db.security.addPermissionToRole('Provisional User', p) |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3784 |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3785 |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3786 Then in the ``config.py`` we change the Role assigned to newly-registered |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3787 users, replacing the existing ``'User'`` values:: |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3788 |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3789 NEW_WEB_USER_ROLES = 'Provisional User' |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3790 NEW_EMAIL_USER_ROLES = 'Provisional User' |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3791 |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3792 Finally we add a new *auditor* to the ``detectors`` directory called |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3793 ``provisional_user_auditor.py``:: |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3794 |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3795 def audit_provisionaluser(db, cl, nodeid, newvalues): |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3796 ''' New users are only allowed to modify their own issues. |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3797 ''' |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3798 if (db.getuid() != cl.get(nodeid, 'creator') |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3799 and db.security.hasPermission('Edit Own', db.getuid(), cl.classname)): |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3800 raise ValueError, ('You are only allowed to edit your own %s' |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3801 % cl.classname) |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3802 |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3803 def init(db): |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3804 # fire before changes are made |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3805 db.issue.audit('set', audit_provisionaluser) |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3806 db.issue.audit('retire', audit_provisionaluser) |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3807 db.issue.audit('restore', audit_provisionaluser) |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3808 |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3809 Note that some older trackers might also want to change the ``page.html`` |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3810 template as follows:: |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3811 |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3812 <p class="classblock" |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3813 - tal:condition="python:request.user.username != 'anonymous'"> |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3814 + tal:condition="python:request.user.hasPermission('View', 'user')"> |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3815 <b>Administration</b><br> |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3816 <tal:block tal:condition="python:request.user.hasPermission('Edit', None)"> |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3817 <a href="home?:template=classlist">Class List</a><br> |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3818 |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3819 (note that the "-" indicates a removed line, and the "+" indicates an added |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3820 line). |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3821 |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
3822 |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3823 Changes to the Web User Interface |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3824 --------------------------------- |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3825 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3826 Adding action links to the index page |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3827 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3828 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3829 Add a column to the item.index.html template. |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3830 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3831 Resolving the issue:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3832 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3833 <a tal:attributes="href |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3834 string:issue${i/id}?:status=resolved&:action=edit">resolve</a> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3835 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3836 "Take" the issue:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3837 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3838 <a tal:attributes="href |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3839 string:issue${i/id}?:assignedto=${request/user/id}&:action=edit">take</a> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3840 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3841 ... and so on |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3842 |
|
1966
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
3843 Colouring the rows in the issue index according to priority |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3844 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
1966
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
3845 |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
3846 A simple ``tal:attributes`` statement will do the bulk of the work here. In |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
3847 the ``issue.index.html`` template, add to the ``<tr>`` that displays the |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
3848 actual rows of data:: |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
3849 |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
3850 <tr tal:attributes="class string:priority-${i/priority/plain}"> |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
3851 |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
3852 and then in your stylesheet (``style.css``) specify the colouring for the |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
3853 different priorities, like:: |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
3854 |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
3855 tr.priority-critical td { |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
3856 background-color: red; |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
3857 } |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
3858 |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
3859 tr.priority-urgent td { |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
3860 background-color: orange; |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
3861 } |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
3862 |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
3863 and so on, with far less offensive colours :) |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
3864 |
|
2009
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3865 Editing multiple items in an index view |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3866 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
2009
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3867 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3868 To edit the status of all items in the item index view, edit the |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3869 ``issue.item.html``: |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3870 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3871 1. add a form around the listing table, so at the top it reads:: |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3872 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3873 <form method="POST" tal:attributes="action request/classname"> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3874 <table class="list"> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3875 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3876 and at the bottom of that table:: |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3877 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3878 </table> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3879 </form |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3880 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3881 making sure you match the ``</table>`` from the list table, not the |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3882 navigation table or the subsequent form table. |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3883 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3884 2. in the display for the issue property, change:: |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3885 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3886 <td tal:condition="request/show/status" |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3887 tal:content="python:i.status.plain() or default"> </td> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3888 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3889 to:: |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3890 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3891 <td tal:condition="request/show/status" |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3892 tal:content="structure i/status/field"> </td> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3893 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3894 this will result in an edit field for the status property. |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3895 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3896 3. after the ``tal:block`` which lists the actual index items (marked by |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3897 ``tal:repeat="i batch"``) add a new table row:: |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3898 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3899 <tr> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3900 <td tal:attributes="colspan python:len(request.columns)"> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3901 <input type="submit" value=" Save Changes "> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3902 <input type="hidden" name="@action" value="edit"> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3903 <tal:block replace="structure request/indexargs_form" /> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3904 </td> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3905 </tr> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3906 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3907 which gives us a submit button, indicates that we are performing an edit |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3908 on any changed statuses and the final block will make sure that the |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3909 current index view parameters (filtering, columns, etc) will be used in |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3910 rendering the next page (the results of the editing). |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
3911 |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3912 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3913 Displaying only message summaries in the issue display |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3914 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3915 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3916 Alter the issue.item template section for messages to:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3917 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3918 <table class="messages" tal:condition="context/messages"> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3919 <tr><th colspan="5" class="header">Messages</th></tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3920 <tr tal:repeat="msg context/messages"> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3921 <td><a tal:attributes="href string:msg${msg/id}" |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3922 tal:content="string:msg${msg/id}"></a></td> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3923 <td tal:content="msg/author">author</td> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3924 <td class="date" tal:content="msg/date/pretty">date</td> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3925 <td tal:content="msg/summary">summary</td> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3926 <td> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3927 <a tal:attributes="href string:?@remove@messages=${msg/id}&@action=edit"> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3928 remove</a> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3929 </td> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3930 </tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3931 </table> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3932 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3933 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3934 Enabling display of either message summaries or the entire messages |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3935 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3936 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3937 This is pretty simple - all we need to do is copy the code from the |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3938 example `displaying only message summaries in the issue display`_ into |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3939 our template alongside the summary display, and then introduce a switch |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3940 that shows either one or the other. We'll use a new form variable, |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3941 ``@whole_messages`` to achieve this:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3942 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3943 <table class="messages" tal:condition="context/messages"> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3944 <tal:block tal:condition="not:request/form/@whole_messages/value | python:0"> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3945 <tr><th colspan="3" class="header">Messages</th> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3946 <th colspan="2" class="header"> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3947 <a href="?@whole_messages=yes">show entire messages</a> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3948 </th> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3949 </tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3950 <tr tal:repeat="msg context/messages"> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3951 <td><a tal:attributes="href string:msg${msg/id}" |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3952 tal:content="string:msg${msg/id}"></a></td> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3953 <td tal:content="msg/author">author</td> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3954 <td class="date" tal:content="msg/date/pretty">date</td> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3955 <td tal:content="msg/summary">summary</td> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3956 <td> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3957 <a tal:attributes="href string:?@remove@messages=${msg/id}&@action=edit">remove</a> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3958 </td> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3959 </tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3960 </tal:block> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3961 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3962 <tal:block tal:condition="request/form/@whole_messages/value | python:0"> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3963 <tr><th colspan="2" class="header">Messages</th> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3964 <th class="header"> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3965 <a href="?@whole_messages=">show only summaries</a> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3966 </th> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3967 </tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3968 <tal:block tal:repeat="msg context/messages"> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3969 <tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3970 <th tal:content="msg/author">author</th> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3971 <th class="date" tal:content="msg/date/pretty">date</th> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3972 <th style="text-align: right"> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3973 (<a tal:attributes="href string:?@remove@messages=${msg/id}&@action=edit">remove</a>) |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3974 </th> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3975 </tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3976 <tr><td colspan="3" tal:content="msg/content"></td></tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3977 </tal:block> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3978 </tal:block> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3979 </table> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3980 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3981 Setting up a "wizard" (or "druid") for controlled adding of issues |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3982 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3983 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3984 1. Set up the page templates you wish to use for data input. My wizard |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3985 is going to be a two-step process: first figuring out what category |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3986 of issue the user is submitting, and then getting details specific to |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3987 that category. The first page includes a table of help, explaining |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3988 what the category names mean, and then the core of the form:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3989 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3990 <form method="POST" onSubmit="return submit_once()" |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3991 enctype="multipart/form-data"> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3992 <input type="hidden" name="@template" value="add_page1"> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3993 <input type="hidden" name="@action" value="page1_submit"> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3994 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3995 <strong>Category:</strong> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3996 <tal:block tal:replace="structure context/category/menu" /> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3997 <input type="submit" value="Continue"> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3998 </form> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3999 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4000 The next page has the usual issue entry information, with the |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4001 addition of the following form fragments:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4002 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4003 <form method="POST" onSubmit="return submit_once()" |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4004 enctype="multipart/form-data" |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4005 tal:condition="context/is_edit_ok" |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4006 tal:define="cat request/form/category/value"> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4007 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4008 <input type="hidden" name="@template" value="add_page2"> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4009 <input type="hidden" name="@required" value="title"> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4010 <input type="hidden" name="category" tal:attributes="value cat"> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4011 . |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4012 . |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4013 . |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4014 </form> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4015 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4016 Note that later in the form, I test the value of "cat" include form |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4017 elements that are appropriate. For example:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4018 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4019 <tal:block tal:condition="python:cat in '6 10 13 14 15 16 17'.split()"> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4020 <tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4021 <th>Operating System</th> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4022 <td tal:content="structure context/os/field"></td> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4023 </tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4024 <tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4025 <th>Web Browser</th> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4026 <td tal:content="structure context/browser/field"></td> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4027 </tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4028 </tal:block> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4029 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4030 ... the above section will only be displayed if the category is one |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4031 of 6, 10, 13, 14, 15, 16 or 17. |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4032 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4033 3. Determine what actions need to be taken between the pages - these are |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4034 usually to validate user choices and determine what page is next. Now encode |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4035 those actions in a new ``Action`` class and insert hooks to those actions in |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4036 the "actions" attribute on on the ``interfaces.Client`` class, like so (see |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4037 `defining new web actions`_):: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4038 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4039 class Page1SubmitAction(Action): |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4040 def handle(self): |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4041 ''' Verify that the user has selected a category, and then move |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4042 on to page 2. |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4043 ''' |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4044 category = self.form['category'].value |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4045 if category == '-1': |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4046 self.error_message.append('You must select a category of report') |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4047 return |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4048 # everything's ok, move on to the next page |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4049 self.template = 'add_page2' |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4050 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4051 actions = client.Client.actions + ( |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4052 ('page1_submit', Page1SubmitAction), |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4053 ) |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4054 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4055 4. Use the usual "new" action as the ``@action`` on the final page, and |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4056 you're done (the standard context/submit method can do this for you). |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4057 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4058 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4059 |
| 1098 | 4060 ------------------- |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
4061 |
|
686
c52122f38c9b
Documentation cleanup, added info for potential (and current) developers
Richard Jones <richard@users.sourceforge.net>
parents:
684
diff
changeset
|
4062 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
|
4063 |
|
c52122f38c9b
Documentation cleanup, added info for potential (and current) developers
Richard Jones <richard@users.sourceforge.net>
parents:
684
diff
changeset
|
4064 .. _`Table of Contents`: index.html |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
4065 .. _`design documentation`: design.html |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
4066 |
