Mercurial > p > roundup > code
annotate doc/customizing.txt @ 3240:09fbb09bddd4 maint-0.8
filename change
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Sat, 05 Mar 2005 05:13:54 +0000 |
| parents | 5ce9c9a1399d |
| children | f3e82dc57c7e |
| 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 |
|
3240
09fbb09bddd4
filename change
Richard Jones <richard@users.sourceforge.net>
parents:
3229
diff
changeset
|
5 :Version: $Revision: 1.161.2.10 $ |
|
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 =================== ======================================================== | |
|
2921
ad4fb8a14a97
more doc updates, not so many TODOs any more
Richard Jones <richard@users.sourceforge.net>
parents:
2915
diff
changeset
|
42 config.ini Holds the basic `tracker configuration`_ |
|
ad4fb8a14a97
more doc updates, not so many TODOs any more
Richard Jones <richard@users.sourceforge.net>
parents:
2915
diff
changeset
|
43 schema.py Holds the `tracker schema`_ |
|
ad4fb8a14a97
more doc updates, not so many TODOs any more
Richard Jones <richard@users.sourceforge.net>
parents:
2915
diff
changeset
|
44 initial_data.py Holds any data to be entered into the database when the |
|
ad4fb8a14a97
more doc updates, not so many TODOs any more
Richard Jones <richard@users.sourceforge.net>
parents:
2915
diff
changeset
|
45 tracker is initialised. |
| 1098 | 46 db/ Holds the tracker's database |
| 47 db/files/ Holds the tracker's upload files and messages | |
|
2921
ad4fb8a14a97
more doc updates, not so many TODOs any more
Richard Jones <richard@users.sourceforge.net>
parents:
2915
diff
changeset
|
48 db/backend_name Names the database back-end for the tracker |
| 1098 | 49 detectors/ Auditors and reactors for this tracker |
|
2921
ad4fb8a14a97
more doc updates, not so many TODOs any more
Richard Jones <richard@users.sourceforge.net>
parents:
2915
diff
changeset
|
50 extensions/ Additional web actions and templating utilities. |
| 1098 | 51 html/ Web interface templates, images and style sheets |
| 52 =================== ======================================================== | |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
53 |
|
3120
ac1803a09920
far more merging from HEAD than is good
Richard Jones <richard@users.sourceforge.net>
parents:
3098
diff
changeset
|
54 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
55 Tracker Configuration |
| 1098 | 56 ===================== |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
57 |
| 2910 | 58 The ``config.ini`` located in your tracker home contains the basic |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
59 configuration for the web and e-mail components of roundup's interfaces. |
| 2910 | 60 |
|
2911
ca6206cc74d9
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2910
diff
changeset
|
61 The following is taken from the `Python Library Reference`__ (May 20, 2004) |
| 2910 | 62 section "ConfigParser -- Configuration file parser": |
| 63 | |
| 64 The configuration file consists of sections, led by a "[section]" header | |
| 65 and followed by "name = value" entries, with line continuations on a | |
| 66 newline with leading whitespace. Note that leading whitespace is removed | |
| 67 from values. The optional values can contain format strings which | |
| 68 refer to other values in the same section. Lines beginning with "#" or ";" | |
| 69 are ignored and may be used to provide comments. | |
| 70 | |
| 71 For example:: | |
| 72 | |
| 73 [My Section] | |
|
2911
ca6206cc74d9
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2910
diff
changeset
|
74 foodir = %(dir)s/whatever |
|
ca6206cc74d9
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2910
diff
changeset
|
75 dir = frob |
|
ca6206cc74d9
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2910
diff
changeset
|
76 |
|
ca6206cc74d9
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2910
diff
changeset
|
77 would resolve the "%(dir)s" to the value of "dir" ("frob" in this case) |
|
ca6206cc74d9
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2910
diff
changeset
|
78 resulting in "foodir" being "frob/whatever". |
| 2910 | 79 |
| 80 __ http://docs.python.org/lib/module-ConfigParser.html | |
|
1245
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
81 |
|
2914
c75a19894d3e
alex's feedback
Richard Jones <richard@users.sourceforge.net>
parents:
2911
diff
changeset
|
82 Configuration variables may be referred to in lower or upper case. In code, |
|
c75a19894d3e
alex's feedback
Richard Jones <richard@users.sourceforge.net>
parents:
2911
diff
changeset
|
83 variables not in the "main" section are referred to using their section and |
|
c75a19894d3e
alex's feedback
Richard Jones <richard@users.sourceforge.net>
parents:
2911
diff
changeset
|
84 name, so "domain" in the section "mail" becomes MAIL_DOMAIN. The |
|
c75a19894d3e
alex's feedback
Richard Jones <richard@users.sourceforge.net>
parents:
2911
diff
changeset
|
85 configuration variables available are: |
|
794
8c6df3f14020
Added better explanation of the instance configuration.
Richard Jones <richard@users.sourceforge.net>
parents:
724
diff
changeset
|
86 |
| 2910 | 87 Section **main** |
| 88 database -- ``db`` | |
| 89 Database directory path. The path may be either absolute or relative | |
| 90 to the directory containig this config file. | |
| 91 | |
| 92 templates -- ``html`` | |
| 93 Path to the HTML templates directory. The path may be either absolute | |
| 94 or relative to the directory containig this config file. | |
| 95 | |
| 96 admin_email -- ``roundup-admin`` | |
|
2914
c75a19894d3e
alex's feedback
Richard Jones <richard@users.sourceforge.net>
parents:
2911
diff
changeset
|
97 Email address that roundup will complain to if it runs into trouble. If |
|
c75a19894d3e
alex's feedback
Richard Jones <richard@users.sourceforge.net>
parents:
2911
diff
changeset
|
98 the email address doesn't contain an ``@`` part, the MAIL_DOMAIN defined |
|
c75a19894d3e
alex's feedback
Richard Jones <richard@users.sourceforge.net>
parents:
2911
diff
changeset
|
99 below is used. |
| 2910 | 100 |
| 101 dispatcher_email -- ``roundup-admin`` | |
| 102 The 'dispatcher' is a role that can get notified of new items to the | |
|
2914
c75a19894d3e
alex's feedback
Richard Jones <richard@users.sourceforge.net>
parents:
2911
diff
changeset
|
103 database. It is used by the ERROR_MESSAGES_TO config setting. If the |
|
c75a19894d3e
alex's feedback
Richard Jones <richard@users.sourceforge.net>
parents:
2911
diff
changeset
|
104 email address doesn't contain an ``@`` part, the MAIL_DOMAIN defined |
|
c75a19894d3e
alex's feedback
Richard Jones <richard@users.sourceforge.net>
parents:
2911
diff
changeset
|
105 below is used. |
| 2910 | 106 |
| 107 email_from_tag -- default *blank* | |
| 108 Additional text to include in the "name" part of the From: address used | |
| 109 in nosy messages. If the sending user is "Foo Bar", the From: line | |
| 110 is usually: ``"Foo Bar" <issue_tracker@tracker.example>`` | |
| 111 the EMAIL_FROM_TAG goes inside the "Foo Bar" quotes like so: | |
| 112 ``"Foo Bar EMAIL_FROM_TAG" <issue_tracker@tracker.example>`` | |
| 113 | |
| 114 new_web_user_roles -- ``User`` | |
| 115 Roles that a user gets when they register with Web User Interface. | |
| 116 This is a comma-separated list of role names (e.g. ``Admin,User``). | |
| 117 | |
| 118 new_email_user_roles -- ``User`` | |
| 119 Roles that a user gets when they register with Email Gateway. | |
| 120 This is a comma-separated string of role names (e.g. ``Admin,User``). | |
| 121 | |
| 122 error_messages_to -- ``user`` | |
| 123 Send error message emails to the ``dispatcher``, ``user``, or ``both``? | |
| 124 The dispatcher is configured using the DISPATCHER_EMAIL setting. | |
| 125 Allowed values: ``dispatcher``, ``user``, or ``both`` | |
| 126 | |
| 127 html_version -- ``html4`` | |
| 128 HTML version to generate. The templates are ``html4`` by default. | |
| 129 If you wish to make them xhtml, then you'll need to change this | |
| 130 var to ``xhtml`` too so all auto-generated HTML is compliant. | |
| 131 Allowed values: ``html4``, ``xhtml`` | |
| 132 | |
| 133 timezone -- ``0`` | |
| 134 Numeric timezone offset used when users do not choose their own | |
| 135 in their settings. | |
| 136 | |
| 137 instant_registration -- ``yes`` | |
| 138 Register new users instantly, or require confirmation via | |
| 139 email? | |
| 140 Allowed values: ``yes``, ``no`` | |
| 141 | |
| 142 Section **tracker** | |
| 143 name -- ``Roundup issue tracker`` | |
| 144 A descriptive name for your roundup instance. | |
| 145 | |
| 146 web -- ``http://host.example/demo/`` | |
| 147 The web address that the tracker is viewable at. | |
| 148 This will be included in information sent to users of the tracker. | |
| 149 The URL MUST include the cgi-bin part or anything else | |
| 150 that is required to get to the home page of the tracker. | |
| 151 You MUST include a trailing '/' in the URL. | |
| 152 | |
| 153 email -- ``issue_tracker`` | |
| 154 Email address that mail to roundup should go to. | |
| 155 | |
| 156 Section **rdbms** | |
| 157 Settings in this section are used by Postgresql and MySQL backends only | |
| 158 | |
| 159 name -- ``roundup`` | |
| 160 Name of the database to use. | |
| 161 | |
| 162 host -- ``localhost`` | |
| 163 Database server host. | |
| 164 | |
| 165 port -- default *blank* | |
| 166 TCP port number of the database server. Postgresql usually resides on | |
| 167 port 5432 (if any), for MySQL default port number is 3306. Leave this | |
| 168 option empty to use backend default. | |
| 169 | |
| 170 user -- ``roundup`` | |
| 171 Database user name that Roundup should use. | |
| 172 | |
| 173 password -- ``roundup`` | |
| 174 Database user password. | |
| 175 | |
| 176 Section **logging** | |
| 177 config -- default *blank* | |
| 178 Path to configuration file for standard Python logging module. If this | |
| 179 option is set, logging configuration is loaded from specified file; | |
| 180 options 'filename' and 'level' in this section are ignored. The path may | |
| 181 be either absolute or relative to the directory containig this config file. | |
| 182 | |
| 183 filename -- default *blank* | |
| 184 Log file name for minimal logging facility built into Roundup. If no file | |
| 185 name specified, log messages are written on stderr. If above 'config' | |
| 186 option is set, this option has no effect. The path may be either absolute | |
| 187 or relative to the directory containig this config file. | |
| 188 | |
| 189 level -- ``ERROR`` | |
| 190 Minimal severity level of messages written to log file. If above 'config' | |
| 191 option is set, this option has no effect. | |
| 192 Allowed values: ``DEBUG``, ``INFO``, ``WARNING``, ``ERROR`` | |
| 193 | |
| 194 Section **mail** | |
| 195 Outgoing email options. Used for nosy messages, password reset and | |
| 196 registration approval requests. | |
| 197 | |
| 198 domain -- ``localhost`` | |
| 199 Domain name used for email addresses. | |
| 200 | |
| 201 host -- default *blank* | |
| 202 SMTP mail host that roundup will use to send mail | |
| 203 | |
| 204 username -- default *blank* | |
| 205 SMTP login name. Set this if your mail host requires authenticated access. | |
| 206 If username is not empty, password (below) MUST be set! | |
| 207 | |
| 208 password -- default *blank* | |
| 209 SMTP login password. | |
| 210 Set this if your mail host requires authenticated access. | |
| 211 | |
| 212 tls -- ``no`` | |
| 213 If your SMTP mail host provides or requires TLS (Transport Layer Security) | |
| 214 then you may set this option to 'yes'. | |
| 215 Allowed values: ``yes``, ``no`` | |
| 216 | |
| 217 tls_keyfile -- default *blank* | |
| 218 If TLS is used, you may set this option to the name of a PEM formatted | |
| 219 file that contains your private key. The path may be either absolute or | |
| 220 relative to the directory containig this config file. | |
| 221 | |
| 222 tls_certfile -- default *blank* | |
| 223 If TLS is used, you may set this option to the name of a PEM formatted | |
| 224 certificate chain file. The path may be either absolute or relative | |
| 225 to the directory containig this config file. | |
| 226 | |
| 227 charset -- utf-8 | |
| 228 Character set to encode email headers with. We use utf-8 by default, as | |
| 229 it's the most flexible. Some mail readers (eg. Eudora) can't cope with | |
| 230 that, so you might need to specify a more limited character set | |
| 231 (eg. iso-8859-1). | |
| 232 | |
| 233 debug -- default *blank* | |
| 234 Setting this option makes Roundup to write all outgoing email messages | |
| 235 to this file *instead* of sending them. This option has the same effect | |
| 236 as environment variable SENDMAILDEBUG. Environment variable takes | |
| 237 precedence. The path may be either absolute or relative to the directory | |
| 238 containig this config file. | |
| 239 | |
| 240 Section **mailgw** | |
| 241 Roundup Mail Gateway options | |
| 242 | |
| 243 keep_quoted_text -- ``yes`` | |
| 244 Keep email citations when accepting messages. Setting this to ``no`` strips | |
| 245 out "quoted" text from the message. Signatures are also stripped. | |
| 246 Allowed values: ``yes``, ``no`` | |
| 247 | |
| 248 leave_body_unchanged -- ``no`` | |
| 249 Preserve the email body as is - that is, keep the citations *and* | |
| 250 signatures. | |
| 251 Allowed values: ``yes``, ``no`` | |
| 252 | |
| 253 default_class -- ``issue`` | |
| 254 Default class to use in the mailgw if one isn't supplied in email subjects. | |
| 255 To disable, leave the value blank. | |
| 256 | |
| 257 Section **nosy** | |
| 258 Nosy messages sending | |
| 259 | |
| 260 messages_to_author -- ``no`` | |
| 261 Send nosy messages to the author of the message. | |
| 262 Allowed values: ``yes``, ``no``, ``new`` | |
| 263 | |
| 264 signature_position -- ``bottom`` | |
| 265 Where to place the email signature. | |
| 266 Allowed values: ``top``, ``bottom``, ``none`` | |
| 267 | |
| 268 add_author -- ``new`` | |
| 269 Does the author of a message get placed on the nosy list automatically? | |
| 270 If ``new`` is used, then the author will only be added when a message | |
| 271 creates a new issue. If ``yes``, then the author will be added on | |
| 272 followups too. If ``no``, they're never added to the nosy. | |
| 273 Allowed values: ``yes``, ``no``, ``new`` | |
| 274 | |
| 275 add_recipients -- ``new`` | |
| 276 Do the recipients (``To:``, ``Cc:``) of a message get placed on the nosy | |
| 277 list? If ``new`` is used, then the recipients will only be added when a | |
| 278 message creates a new issue. If ``yes``, then the recipients will be added | |
| 279 on followups too. If ``no``, they're never added to the nosy. | |
| 280 Allowed values: ``yes``, ``no``, ``new`` | |
| 281 | |
| 282 You may generate a new default config file using the ``roundup-admin | |
| 283 genconfig`` command. | |
| 284 | |
|
1360
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
285 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
286 Tracker Schema |
| 1098 | 287 ============== |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
288 |
|
3039
70c9954f619f
formatting fixes
Richard Jones <richard@users.sourceforge.net>
parents:
3037
diff
changeset
|
289 .. note:: |
|
70c9954f619f
formatting fixes
Richard Jones <richard@users.sourceforge.net>
parents:
3037
diff
changeset
|
290 if you modify the schema, you'll most likely need to edit the |
|
70c9954f619f
formatting fixes
Richard Jones <richard@users.sourceforge.net>
parents:
3037
diff
changeset
|
291 `web interface`_ HTML template files and `detectors`_ to reflect |
|
70c9954f619f
formatting fixes
Richard Jones <richard@users.sourceforge.net>
parents:
3037
diff
changeset
|
292 your changes. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
293 |
| 1091 | 294 A tracker schema defines what data is stored in the tracker's database. |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
295 Schemas are defined using Python code in the ``schema.py`` module of your |
|
2153
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
296 tracker. |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
297 |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
298 The ``schema.py`` module |
|
2153
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
299 ------------------------ |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
300 |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
301 The ``schema.py`` module contains two functions: |
|
2153
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
302 |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
303 **open** |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
304 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
|
305 **schema** of the tracker. It defines the **Classes** and **properties** |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
306 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
|
307 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
|
308 them. |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
309 **init** |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
310 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
|
311 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
|
312 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
|
313 info about how this works. |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
314 |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
315 |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
316 The "classic" schema |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
317 -------------------- |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
318 |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
319 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
|
320 of ``'setkey'``):: |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
321 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
322 pri = Class(db, "priority", name=String(), order=String()) |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
323 pri.setkey("name") |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
324 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
325 stat = Class(db, "status", name=String(), order=String()) |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
326 stat.setkey("name") |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
327 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
328 keyword = Class(db, "keyword", name=String()) |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
329 keyword.setkey("name") |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
330 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
331 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
|
332 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
|
333 phone=String()) |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
334 user.setkey("username") |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
335 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
336 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
|
337 date=Date(), recipients=Multilink("user"), |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
338 files=Multilink("file")) |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
339 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
340 file = FileClass(db, "file", name=String(), type=String()) |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
341 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
342 issue = IssueClass(db, "issue", topic=Multilink("keyword"), |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
343 status=Link("status"), assignedto=Link("user"), |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
344 priority=Link("priority")) |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
345 issue.setkey('title') |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
346 |
| 1832 | 347 |
| 348 What you can't do to the schema | |
| 349 ------------------------------- | |
| 350 | |
| 351 You must never: | |
| 352 | |
| 353 **Remove the users class** | |
|
2739
deb298529c2b
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2726
diff
changeset
|
354 This class is the only *required* class in Roundup. |
|
deb298529c2b
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2726
diff
changeset
|
355 |
|
deb298529c2b
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2726
diff
changeset
|
356 **Remove the "username", "address", "password" or "realname" user properties** |
|
deb298529c2b
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2726
diff
changeset
|
357 Various parts of Roundup require these properties. Don't remove them. |
| 1832 | 358 |
| 359 **Change the type of a property** | |
| 360 Property types must *never* be changed - the database simply doesn't take | |
| 361 this kind of action into account. Note that you can't just remove a | |
| 362 property and re-add it as a new type either. If you wanted to make the | |
| 363 assignedto property a Multilink, you'd need to create a new property | |
| 364 assignedto_list and remove the old assignedto property. | |
| 365 | |
| 366 | |
| 367 What you can do to the schema | |
| 368 ----------------------------- | |
| 369 | |
| 370 Your schema may be changed at any time before or after the tracker has been | |
| 371 initialised (or used). You may: | |
| 372 | |
| 373 **Add new properties to classes, or add whole new classes** | |
| 374 This is painless and easy to do - there are generally no repurcussions | |
| 375 from adding new information to a tracker's schema. | |
| 376 | |
| 377 **Remove properties** | |
| 378 Removing properties is a little more tricky - you need to make sure that | |
| 379 the property is no longer used in the `web interface`_ *or* by the | |
| 380 detectors_. | |
| 381 | |
| 382 | |
| 383 | |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
384 Classes and Properties - creating a new information store |
| 1098 | 385 --------------------------------------------------------- |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
386 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
387 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
|
388 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
389 priority |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
390 Defines the possible levels of urgency for issues. |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
391 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
392 status |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
393 Defines the possible states of processing the issue may be in. |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
394 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
395 keyword |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
396 Initially empty, will hold keywords useful for searching issues. |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
397 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
398 user |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
399 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
|
400 for all users using roundup. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
401 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
402 msg |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
403 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
|
404 generated by roundup. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
405 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
406 file |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
407 Initially empty, will hold all files attached to issues. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
408 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
409 issue |
| 1091 | 410 Initially empty, this is where the issue information is stored. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
411 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
412 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
|
413 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
|
414 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
|
415 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
|
416 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
|
417 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
|
418 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
419 |
| 1091 | 420 Class and Items |
| 1098 | 421 ~~~~~~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
422 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
423 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
|
424 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
|
425 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
|
426 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
427 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
|
428 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
|
429 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
|
430 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
431 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
432 Properties |
| 1098 | 433 ~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
434 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
435 A Class is comprised of one or more properties of the following types: |
| 1091 | 436 |
| 437 * 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
|
438 * 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
|
439 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
|
440 class. |
| 1091 | 441 * Date properties store date-and-time stamps. Their values are Timestamp |
| 442 objects. | |
| 443 * Number properties store numeric values. | |
| 444 * 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
|
445 * 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
|
446 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
|
447 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
|
448 * 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
|
449 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
|
450 |
|
3098
5b0f7f1cc3cb
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3080
diff
changeset
|
451 All Classes automatically have a number of properties by default: |
|
5b0f7f1cc3cb
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3080
diff
changeset
|
452 |
|
5b0f7f1cc3cb
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3080
diff
changeset
|
453 *creator* |
|
5b0f7f1cc3cb
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3080
diff
changeset
|
454 Link to the user that created the item. |
|
5b0f7f1cc3cb
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3080
diff
changeset
|
455 *creation* |
|
5b0f7f1cc3cb
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3080
diff
changeset
|
456 Date the item was created. |
|
5b0f7f1cc3cb
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3080
diff
changeset
|
457 *actor* |
|
5b0f7f1cc3cb
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3080
diff
changeset
|
458 Link to the user that last modified the item. |
|
5b0f7f1cc3cb
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3080
diff
changeset
|
459 *activity* |
|
5b0f7f1cc3cb
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3080
diff
changeset
|
460 Date the item was last modified. |
|
5b0f7f1cc3cb
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3080
diff
changeset
|
461 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
462 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
463 FileClass |
| 1098 | 464 ~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
465 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
466 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
|
467 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
|
468 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
|
469 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
|
470 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
|
471 tracker. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
472 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
473 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
474 IssueClass |
| 1098 | 475 ~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
476 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
477 IssueClasses automatically include the "messages", "files", "nosy", and |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
478 "superseder" properties. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
479 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
480 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
|
481 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
|
482 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
|
483 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
|
484 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
|
485 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
|
486 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
487 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
|
488 "creator" properties. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
489 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
490 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
|
491 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
|
492 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
|
493 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
|
494 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
|
495 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
496 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
497 setkey(property) |
| 1098 | 498 ~~~~~~~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
499 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
500 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
|
501 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
|
502 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
|
503 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
|
504 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
|
505 assign an issue to him, we could do either of:: |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
506 |
|
1570
93e0a565cee5
fix the "set" command usage statement
Richard Jones <richard@users.sourceforge.net>
parents:
1568
diff
changeset
|
507 roundup-admin set issue23 assignedto=2 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
508 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
509 or:: |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
510 |
|
1570
93e0a565cee5
fix the "set" command usage statement
Richard Jones <richard@users.sourceforge.net>
parents:
1568
diff
changeset
|
511 roundup-admin set issue23 assignedto=richard |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
512 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
513 Note, 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
|
514 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
515 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
|
516 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
|
517 (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
|
518 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
|
519 "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
|
520 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
521 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
522 create(information) |
| 1098 | 523 ~~~~~~~~~~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
524 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
525 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
|
526 in the "definitional" classes like "priority" and "status". |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
527 |
|
684
5b23ff865f3a
added a "detectors" directory...
Richard Jones <richard@users.sourceforge.net>
parents:
673
diff
changeset
|
528 |
|
2897
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
529 A note about ordering |
|
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
530 ~~~~~~~~~~~~~~~~~~~~~ |
|
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
531 |
|
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
532 When we sort items in the hyperdb, we use one of a number of methods, |
|
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
533 depending on the properties being sorted on: |
|
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
534 |
|
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
535 1. If it's a String, Number, Date or Interval property, we just sort the |
|
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
536 scalar value of the property. Strings are sorted case-sensitively. |
|
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
537 2. If it's a Link property, we sort by either the linked item's "order" |
|
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
538 property (if it has one) or the linked item's "id". |
|
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
539 3. Mulitlinks sort similar to #2, but we start with the first Multilink |
|
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
540 list item, and if they're the same, we sort by the second item, and |
|
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
541 so on. |
|
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
542 |
|
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
543 Note that if an "order" property is defined on a Class that is used for |
|
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
544 sorting, all items of that Class *must* have a value against the "order" |
|
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
545 property, or sorting will result in random ordering. |
|
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
546 |
|
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
547 |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
548 Examples of adding to your schema |
| 1098 | 549 --------------------------------- |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
550 |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
551 TODO |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
552 |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
553 |
|
684
5b23ff865f3a
added a "detectors" directory...
Richard Jones <richard@users.sourceforge.net>
parents:
673
diff
changeset
|
554 Detectors - adding behaviour to your tracker |
| 1098 | 555 ============================================ |
|
909
ef9c759c243e
Fix to hasPermission, thanks Stefan Seefeld.
Richard Jones <richard@users.sourceforge.net>
parents:
907
diff
changeset
|
556 .. _detectors: |
|
684
5b23ff865f3a
added a "detectors" directory...
Richard Jones <richard@users.sourceforge.net>
parents:
673
diff
changeset
|
557 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
558 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
|
559 you're free to add and remove them any time, even after the database is |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
560 initialised via the ``roundup-admin initialise`` command. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
561 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
562 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
|
563 (**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
|
564 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
|
565 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
|
566 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
|
567 for you are: |
|
907
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
568 |
|
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
569 **nosyreaction.py** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
570 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
|
571 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
|
572 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
|
573 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
|
574 (such as adding new authors, etc.) |
|
907
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
575 **statusauditor.py** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
576 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
|
577 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
|
578 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
|
579 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
|
580 defined. |
|
1777
fbe08359511a
customisation doc update
Richard Jones <richard@users.sourceforge.net>
parents:
1773
diff
changeset
|
581 **messagesummary.py** |
|
fbe08359511a
customisation doc update
Richard Jones <richard@users.sourceforge.net>
parents:
1773
diff
changeset
|
582 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
|
583 content. |
|
fbe08359511a
customisation doc update
Richard Jones <richard@users.sourceforge.net>
parents:
1773
diff
changeset
|
584 **userauditor.py** |
|
fbe08359511a
customisation doc update
Richard Jones <richard@users.sourceforge.net>
parents:
1773
diff
changeset
|
585 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
|
586 roles lists). |
|
fbe08359511a
customisation doc update
Richard Jones <richard@users.sourceforge.net>
parents:
1773
diff
changeset
|
587 |
|
fbe08359511a
customisation doc update
Richard Jones <richard@users.sourceforge.net>
parents:
1773
diff
changeset
|
588 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
|
589 or remove these detectors. |
|
907
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
590 |
|
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
591 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
|
592 interface for detectors. |
|
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
593 |
|
909
ef9c759c243e
Fix to hasPermission, thanks Stefan Seefeld.
Richard Jones <richard@users.sourceforge.net>
parents:
907
diff
changeset
|
594 __ design.html |
|
907
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
595 |
| 2209 | 596 |
| 597 Detector API | |
| 598 ------------ | |
| 599 | |
| 600 Auditors are called with the arguments:: | |
| 601 | |
| 602 audit(db, cl, itemid, newdata) | |
| 603 | |
| 604 where ``db`` is the database, ``cl`` is an instance of Class or | |
| 605 IssueClass within the database, and ``newdata`` is a dictionary mapping | |
| 606 property names to values. | |
| 607 | |
| 608 For a ``create()`` operation, the ``itemid`` argument is None and | |
| 609 newdata contains all of the initial property values with which the item | |
| 610 is about to be created. | |
| 611 | |
| 612 For a ``set()`` operation, newdata contains only the names and values of | |
| 613 properties that are about to be changed. | |
| 614 | |
| 615 For a ``retire()`` or ``restore()`` operation, newdata is None. | |
| 616 | |
| 617 Reactors are called with the arguments:: | |
| 618 | |
| 619 react(db, cl, itemid, olddata) | |
| 620 | |
| 621 where ``db`` is the database, ``cl`` is an instance of Class or | |
| 622 IssueClass within the database, and ``olddata`` is a dictionary mapping | |
| 623 property names to values. | |
| 624 | |
| 625 For a ``create()`` operation, the ``itemid`` argument is the id of the | |
| 626 newly-created item and ``olddata`` is None. | |
| 627 | |
| 628 For a ``set()`` operation, ``olddata`` contains the names and previous | |
| 629 values of properties that were changed. | |
| 630 | |
| 631 For a ``retire()`` or ``restore()`` operation, ``itemid`` is the id of | |
| 632 the retired or restored item and ``olddata`` is None. | |
| 633 | |
| 634 | |
|
2193
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
635 Additional Detectors Ready For Use |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
636 ---------------------------------- |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
637 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
638 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
|
639 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
|
640 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
|
641 |
|
907
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
642 **newissuecopy.py** |
|
684
5b23ff865f3a
added a "detectors" directory...
Richard Jones <richard@users.sourceforge.net>
parents:
673
diff
changeset
|
643 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
|
644 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
|
645 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
|
646 email errors! |
|
2193
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
647 **creator_resolution.py** |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
648 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
|
649 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
|
650 "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
|
651 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
|
652 **email_auditor.py** |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
653 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
|
654 extension .eml. |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
655 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
|
656 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
|
657 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
|
658 information, see the detector code - it has a length explanation. |
| 1091 | 659 |
|
684
5b23ff865f3a
added a "detectors" directory...
Richard Jones <richard@users.sourceforge.net>
parents:
673
diff
changeset
|
660 |
|
2129
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
661 Auditor or Reactor? |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
662 ------------------- |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
663 |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
664 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
|
665 |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
666 **Auditors** |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
667 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
|
668 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
|
669 **Reactors** |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
670 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
|
671 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
|
672 detector loops. |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
673 |
|
2138
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
674 |
|
2129
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
675 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
|
676 --------------------------------------- |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
677 |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
678 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
|
679 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
|
680 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
|
681 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
|
682 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
|
683 |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
684 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
|
685 |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
686 from roundup.exceptions import Reject |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
687 |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
688 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
|
689 |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
690 raise Reject |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
691 |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
692 |
|
2138
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
693 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
|
694 ----------------------------- |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
695 |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
696 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
|
697 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
|
698 |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
699 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
|
700 ``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
|
701 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
|
702 is not required). |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
703 |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
704 |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
705 Database Content |
| 1098 | 706 ================ |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
707 |
|
3039
70c9954f619f
formatting fixes
Richard Jones <richard@users.sourceforge.net>
parents:
3037
diff
changeset
|
708 .. note:: |
|
70c9954f619f
formatting fixes
Richard Jones <richard@users.sourceforge.net>
parents:
3037
diff
changeset
|
709 if you modify the content of definitional classes, you'll most |
|
70c9954f619f
formatting fixes
Richard Jones <richard@users.sourceforge.net>
parents:
3037
diff
changeset
|
710 likely need to edit the tracker `detectors`_ to reflect your changes. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
711 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
712 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
|
713 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
|
714 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
|
715 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
|
716 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
717 **Changing content before tracker initialisation** |
|
3240
09fbb09bddd4
filename change
Richard Jones <richard@users.sourceforge.net>
parents:
3229
diff
changeset
|
718 Edit the initial_data.py module in your tracker to alter the items |
|
09fbb09bddd4
filename change
Richard Jones <richard@users.sourceforge.net>
parents:
3229
diff
changeset
|
719 created using the ``create( ... )`` methods. |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
720 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
721 **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
|
722 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
|
723 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
|
724 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
|
725 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
726 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
|
727 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
|
728 question. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
729 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
730 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
|
731 requires database content changes. |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
732 |
|
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
733 |
|
2003
a291bf753037
maintenance -> admin guide
Richard Jones <richard@users.sourceforge.net>
parents:
1998
diff
changeset
|
734 Security / Access Controls |
|
a291bf753037
maintenance -> admin guide
Richard Jones <richard@users.sourceforge.net>
parents:
1998
diff
changeset
|
735 ========================== |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
736 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
737 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
|
738 |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
739 - Create (everything) |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
740 - Edit (everything) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
741 - View (everything) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
742 |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
743 Every Class you define in your tracker's schema also gets an Create, Edit |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
744 and View Permission of its own. |
|
2076
2a4309450202
security fixes and doc updates
Richard Jones <richard@users.sourceforge.net>
parents:
2069
diff
changeset
|
745 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
746 The default interfaces define: |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
747 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
748 - Web Registration |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
749 - Web Access |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
750 - Web Roles |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
751 - Email Registration |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
752 - Email Access |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
753 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
754 These are hooked into the default Roles: |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
755 |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
756 - Admin (Create, Edit, View and everything; Web Roles) |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
757 - User (Web Access; Email Access) |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
758 - Anonymous (Web Registration; Email Registration) |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
759 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
760 And finally, the "admin" user gets the "Admin" Role, and the "anonymous" |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
761 user gets "Anonymous" assigned when the tracker is installed. |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
762 |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
763 For the "User" Role, the "classic" tracker defines: |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
764 |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
765 - Create, Edit and View issue, file, msg, query, keyword |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
766 - View priority, status |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
767 - View user |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
768 - Edit their own record |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
769 |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
770 And the "Anonymous" Role is defined as: |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
771 |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
772 - Create user (for registration) |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
773 - View issue, file, msg, query, keyword, priority, status |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
774 |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
775 Put together, these settings appear in the tracker's ``schema.py`` file:: |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
776 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
777 # |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
778 # TRACKER SECURITY SETTINGS |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
779 # |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
780 # See the configuration and customisation document for information |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
781 # about security setup. |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
782 |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
783 # |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
784 # REGULAR USERS |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
785 # |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
786 # Give the regular users access to the web and email interface |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
787 p = db.security.getPermission('Web Access') |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
788 db.security.addPermissionToRole('User', p) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
789 p = db.security.getPermission('Email Access') |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
790 db.security.addPermissionToRole('User', p) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
791 |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
792 # Assign the access and edit Permissions for issue, file and message |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
793 # to regular users now |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
794 for cl in 'issue', 'file', 'msg', 'query', 'keyword': |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
795 p = db.security.getPermission('View', cl) |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
796 db.security.addPermissionToRole('User', p) |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
797 p = db.security.getPermission('Edit', cl) |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
798 db.security.addPermissionToRole('User', p) |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
799 p = db.security.getPermission('Create', cl) |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
800 db.security.addPermissionToRole('User', p) |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
801 for cl in 'priority', 'status': |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
802 p = db.security.getPermission('View', cl) |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
803 db.security.addPermissionToRole('User', p) |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
804 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
805 # 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
|
806 # if you don't want them to |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
807 p = db.security.getPermission('View', 'user') |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
808 db.security.addPermissionToRole('User', p) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
809 |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
810 # Users should be able to edit their own details. Note that this |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
811 # permission is limited to only the situation where the Viewed or |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
812 # Edited item is their own. |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
813 def own_record(db, userid, itemid): |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
814 '''Determine whether the userid matches the item being accessed.''' |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
815 return userid == itemid |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
816 p = db.security.addPermission(name='View', klass='user', check=own_record, |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
817 description="User is allowed to view their own user details") |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
818 p = db.security.addPermission(name='Edit', klass='user', check=own_record, |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
819 description="User is allowed to edit their own user details") |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
820 db.security.addPermissionToRole('User', p) |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
821 |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
822 # |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
823 # ANONYMOUS USER PERMISSIONS |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
824 # |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
825 # Let anonymous users access the web interface. Note that almost all |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
826 # trackers will need this Permission. The only situation where it's not |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
827 # required is in a tracker that uses an HTTP Basic Authenticated front-end. |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
828 p = db.security.getPermission('Web Access') |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
829 db.security.addPermissionToRole('Anonymous', p) |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
830 |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
831 # Let anonymous users access the email interface (note that this implies |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
832 # that they will be registered automatically, hence they will need the |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
833 # "Create" user Permission below) |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
834 p = db.security.getPermission('Email Access') |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
835 db.security.addPermissionToRole('Anonymous', p) |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
836 |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
837 # Assign the appropriate permissions to the anonymous user's Anonymous |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
838 # Role. Choices here are: |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
839 # - Allow anonymous users to register |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
840 p = db.security.getPermission('Create', 'user') |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
841 db.security.addPermissionToRole('Anonymous', p) |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
842 |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
843 # Allow anonymous users access to view issues (and the related, linked |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
844 # information) |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
845 for cl in 'issue', 'file', 'msg', 'keyword', 'priority', 'status': |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
846 p = db.security.getPermission('View', cl) |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
847 db.security.addPermissionToRole('Anonymous', p) |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
848 |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
849 # [OPTIONAL] |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
850 # Allow anonymous users access to create or edit "issue" items (and the |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
851 # related file and message items) |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
852 #for cl in 'issue', 'file', 'msg': |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
853 # p = db.security.getPermission('Create', cl) |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
854 # db.security.addPermissionToRole('Anonymous', p) |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
855 # p = db.security.getPermission('Edit', cl) |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
856 # db.security.addPermissionToRole('Anonymous', p) |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
857 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
858 |
|
3120
ac1803a09920
far more merging from HEAD than is good
Richard Jones <richard@users.sourceforge.net>
parents:
3098
diff
changeset
|
859 Automatic Permission Checks |
|
ac1803a09920
far more merging from HEAD than is good
Richard Jones <richard@users.sourceforge.net>
parents:
3098
diff
changeset
|
860 --------------------------- |
|
ac1803a09920
far more merging from HEAD than is good
Richard Jones <richard@users.sourceforge.net>
parents:
3098
diff
changeset
|
861 |
|
ac1803a09920
far more merging from HEAD than is good
Richard Jones <richard@users.sourceforge.net>
parents:
3098
diff
changeset
|
862 Permissions are automatically checked when information is rendered |
|
ac1803a09920
far more merging from HEAD than is good
Richard Jones <richard@users.sourceforge.net>
parents:
3098
diff
changeset
|
863 through the web. This includes: |
|
ac1803a09920
far more merging from HEAD than is good
Richard Jones <richard@users.sourceforge.net>
parents:
3098
diff
changeset
|
864 |
|
ac1803a09920
far more merging from HEAD than is good
Richard Jones <richard@users.sourceforge.net>
parents:
3098
diff
changeset
|
865 1. View checks for properties when being rendered via the ``plain()`` or |
|
ac1803a09920
far more merging from HEAD than is good
Richard Jones <richard@users.sourceforge.net>
parents:
3098
diff
changeset
|
866 similar methods. If the check fails, the text "[hidden]" will be |
|
ac1803a09920
far more merging from HEAD than is good
Richard Jones <richard@users.sourceforge.net>
parents:
3098
diff
changeset
|
867 displayed. |
|
ac1803a09920
far more merging from HEAD than is good
Richard Jones <richard@users.sourceforge.net>
parents:
3098
diff
changeset
|
868 2. Edit checks for properties when the edit field is being rendered via |
|
ac1803a09920
far more merging from HEAD than is good
Richard Jones <richard@users.sourceforge.net>
parents:
3098
diff
changeset
|
869 the ``field()`` or similar methods. If the check fails, the property |
|
ac1803a09920
far more merging from HEAD than is good
Richard Jones <richard@users.sourceforge.net>
parents:
3098
diff
changeset
|
870 will be rendered via the ``plain()`` method (see point 1. for subsequent |
|
ac1803a09920
far more merging from HEAD than is good
Richard Jones <richard@users.sourceforge.net>
parents:
3098
diff
changeset
|
871 checking performed) |
|
ac1803a09920
far more merging from HEAD than is good
Richard Jones <richard@users.sourceforge.net>
parents:
3098
diff
changeset
|
872 3. View checks are performed in index pages for each item being displayed |
|
ac1803a09920
far more merging from HEAD than is good
Richard Jones <richard@users.sourceforge.net>
parents:
3098
diff
changeset
|
873 such that if the user does not have permission, the row is not rendered. |
|
ac1803a09920
far more merging from HEAD than is good
Richard Jones <richard@users.sourceforge.net>
parents:
3098
diff
changeset
|
874 4. View checks are performed at the top of item pages for the Item being |
|
ac1803a09920
far more merging from HEAD than is good
Richard Jones <richard@users.sourceforge.net>
parents:
3098
diff
changeset
|
875 displayed. If the user does not have permission, the text "You are not |
|
ac1803a09920
far more merging from HEAD than is good
Richard Jones <richard@users.sourceforge.net>
parents:
3098
diff
changeset
|
876 allowed to view this page." will be displayed. |
|
ac1803a09920
far more merging from HEAD than is good
Richard Jones <richard@users.sourceforge.net>
parents:
3098
diff
changeset
|
877 5. View checks are performed at the top of index pages for the Class being |
|
ac1803a09920
far more merging from HEAD than is good
Richard Jones <richard@users.sourceforge.net>
parents:
3098
diff
changeset
|
878 displayed. If the user does not have permission, the text "You are not |
|
ac1803a09920
far more merging from HEAD than is good
Richard Jones <richard@users.sourceforge.net>
parents:
3098
diff
changeset
|
879 allowed to view this page." will be displayed. |
|
ac1803a09920
far more merging from HEAD than is good
Richard Jones <richard@users.sourceforge.net>
parents:
3098
diff
changeset
|
880 |
|
ac1803a09920
far more merging from HEAD than is good
Richard Jones <richard@users.sourceforge.net>
parents:
3098
diff
changeset
|
881 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
882 New User Roles |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
883 -------------- |
|
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 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
|
886 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
887 - NEW_WEB_USER_ROLES |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
888 - NEW_EMAIL_USER_ROLES |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
889 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
890 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
891 Changing Access Controls |
|
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 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
894 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
|
895 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
|
896 interface if they register through email. |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
897 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
898 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
|
899 current Role and Permission configuration in your tracker. |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
900 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
901 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
902 Adding a new Permission |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
903 ~~~~~~~~~~~~~~~~~~~~~~~ |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
904 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
905 When adding a new Permission, you will need to: |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
906 |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
907 1. add it to your tracker's ``schema.py`` so it is created, using |
|
2076
2a4309450202
security fixes and doc updates
Richard Jones <richard@users.sourceforge.net>
parents:
2069
diff
changeset
|
908 ``security.addPermission``, for example:: |
|
2a4309450202
security fixes and doc updates
Richard Jones <richard@users.sourceforge.net>
parents:
2069
diff
changeset
|
909 |
|
2a4309450202
security fixes and doc updates
Richard Jones <richard@users.sourceforge.net>
parents:
2069
diff
changeset
|
910 self.security.addPermission(name="View", klass='frozzle', |
|
2a4309450202
security fixes and doc updates
Richard Jones <richard@users.sourceforge.net>
parents:
2069
diff
changeset
|
911 description="User is allowed to access frozzles") |
|
2a4309450202
security fixes and doc updates
Richard Jones <richard@users.sourceforge.net>
parents:
2069
diff
changeset
|
912 |
|
2a4309450202
security fixes and doc updates
Richard Jones <richard@users.sourceforge.net>
parents:
2069
diff
changeset
|
913 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
|
914 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
|
915 "``roundup-admin security``") |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
916 3. add it to the relevant HTML interface templates |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
917 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
|
918 interfaces module |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
919 |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
920 The ``addPermission`` method takes a couple of optional parameters: |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
921 |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
922 **properties** |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
923 A sequence of property names that are the only properties to apply the |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
924 new Permission to (eg. ``... klass='user', properties=('name', |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
925 'email') ...``) |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
926 **check** |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
927 A function to be execute which returns boolean determining whether the |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
928 Permission is allowed. The function has the signature ``check(db, userid, |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
929 itemid)`` where ``db`` is a handle on the open database, ``userid`` is |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
930 the user attempting access and ``itemid`` is the specific item being |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
931 accessed. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
932 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
933 Example Scenarios |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
934 ~~~~~~~~~~~~~~~~~ |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
935 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
936 **automatic registration of users in the e-mail gateway** |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
937 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
|
938 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
|
939 (with no password, so they won't be able to log in through the web |
|
3039
70c9954f619f
formatting fixes
Richard Jones <richard@users.sourceforge.net>
parents:
3037
diff
changeset
|
940 until an admin sets their password). This is the default behaviour |
|
70c9954f619f
formatting fixes
Richard Jones <richard@users.sourceforge.net>
parents:
3037
diff
changeset
|
941 in the tracker templates that ship with Roundup. |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
942 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
943 **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
|
944 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
|
945 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
|
946 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
|
947 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
|
948 "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
|
949 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
|
950 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
|
951 address - will not be available - they're *anonymous*. |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
952 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
953 **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
|
954 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
|
955 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
|
956 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
|
957 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
|
958 auditor. See the example |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
959 `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
|
960 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
961 **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
|
962 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
|
963 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
|
964 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
|
965 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
|
966 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
|
967 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
|
968 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
969 <option tal:condition="python:request.user.hasPermission('Closer')" |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
970 value="resolved">Resolved</option> |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
971 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
972 **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
|
973 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
|
974 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
|
975 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
|
976 interface. |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
977 |
|
1317
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
978 **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
|
979 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
|
980 editing users:: |
|
1317
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
981 |
|
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
982 db.security.addRole(name='User Admin', description='Managing users') |
|
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
983 p = db.security.getPermission('Edit', 'user') |
|
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
984 db.security.addPermissionToRole('User Admin', p) |
|
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
985 |
|
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
986 and assign the Role to the users who need the permission. |
|
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
987 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
988 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
989 Web Interface |
| 1098 | 990 ============= |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
991 |
| 1125 | 992 .. contents:: |
| 993 :local: | |
| 994 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
995 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
|
996 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
|
997 (``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
|
998 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
|
999 path inside the scope of the CGI handler) and pass control on to the |
| 2915 | 1000 ``roundup.cgi.client.Client`` class - which handles the rest of the |
| 1001 access through its ``main()`` method. This means that you can do pretty | |
| 1002 much anything you want as a web interface to your tracker. | |
| 1003 | |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1004 |
| 2910 | 1005 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1006 Repercussions of changing the tracker schema |
| 1098 | 1007 --------------------------------------------- |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1008 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1009 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
|
1010 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
|
1011 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1012 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
|
1013 have properties added or removed, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1014 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
|
1015 "home" page's content arguments. |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1016 |
| 2910 | 1017 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1018 How requests are processed |
| 1098 | 1019 -------------------------- |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1020 |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1021 The basic processing of a web request proceeds as follows: |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1022 |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1023 1. figure out who we are, defaulting to the "anonymous" user |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1024 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
|
1025 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
|
1026 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
|
1027 output |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1028 |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1029 In some situations, exceptions occur: |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1030 |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1031 - 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
|
1032 - 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
|
1033 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
|
1034 - 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
|
1035 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
|
1036 - 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
|
1037 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
|
1038 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
|
1039 the action to take place |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1040 - 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
|
1041 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
|
1042 client |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1043 |
| 2910 | 1044 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1045 Determining web context |
| 1098 | 1046 ----------------------- |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1047 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1048 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
|
1049 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
|
1050 identifier is examined. Typical URL paths look like: |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1051 |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1052 1. ``/tracker/issue`` |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1053 2. ``/tracker/issue1`` |
|
2589
809758599cdc
oops, double-@
Richard Jones <richard@users.sourceforge.net>
parents:
2588
diff
changeset
|
1054 3. ``/tracker/@@file/style.css`` |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1055 4. ``/cgi-bin/roundup.cgi/tracker/file1`` |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1056 5. ``/cgi-bin/roundup.cgi/tracker/file1/kitten.png`` |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1057 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
1058 where the "tracker identifier" is "tracker" in the above cases. That means |
|
2589
809758599cdc
oops, double-@
Richard Jones <richard@users.sourceforge.net>
parents:
2588
diff
changeset
|
1059 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
|
1060 "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
|
1061 entry long - longer paths are handled differently. |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1062 |
|
2227
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1063 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
|
1064 context`_ below for more information about how it may be used. |
|
2589
809758599cdc
oops, double-@
Richard Jones <richard@users.sourceforge.net>
parents:
2588
diff
changeset
|
1065 b. if the path starts with "@@file" (as in example 3, |
|
809758599cdc
oops, double-@
Richard Jones <richard@users.sourceforge.net>
parents:
2588
diff
changeset
|
1066 "/tracker/@@file/style.css"), then the additional path entry, |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1067 "style.css" specifies the filename of a static file we're to serve up |
|
2589
809758599cdc
oops, double-@
Richard Jones <richard@users.sourceforge.net>
parents:
2588
diff
changeset
|
1068 from the tracker TEMPLATES (or STATIC_FILES, if configured) directory. |
|
809758599cdc
oops, double-@
Richard Jones <richard@users.sourceforge.net>
parents:
2588
diff
changeset
|
1069 This is usually the tracker's "html" directory. Raises a SendStaticFile |
|
809758599cdc
oops, double-@
Richard Jones <richard@users.sourceforge.net>
parents:
2588
diff
changeset
|
1070 exception. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1071 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
|
1072 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
|
1073 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
|
1074 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
|
1075 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
|
1076 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
|
1077 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
|
1078 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
|
1079 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
|
1080 This raises a ``SendFile`` exception. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1081 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1082 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
|
1083 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
|
1084 |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1085 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
|
1086 defaults to: |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1087 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1088 - only classname suplied: "index" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1089 - full item designator supplied: "item" |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1090 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1091 |
|
2227
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1092 The "home" Context |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1093 ------------------ |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1094 |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1095 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
|
1096 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
|
1097 list or specific issue). |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1098 |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1099 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
|
1100 interface. You'd probably have: |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1101 |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1102 - 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
|
1103 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
|
1104 - 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
|
1105 "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
|
1106 page up, you use the URL: |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1107 |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1108 <tracker url>/home?@template=navigation |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1109 |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
1110 |
|
2134
00dfd8b50773
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2129
diff
changeset
|
1111 Serving static content |
|
00dfd8b50773
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2129
diff
changeset
|
1112 ---------------------- |
|
00dfd8b50773
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2129
diff
changeset
|
1113 |
|
00dfd8b50773
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2129
diff
changeset
|
1114 See the previous section `determining web context`_ where it describes |
|
2589
809758599cdc
oops, double-@
Richard Jones <richard@users.sourceforge.net>
parents:
2588
diff
changeset
|
1115 ``@@file`` paths. |
|
2134
00dfd8b50773
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2129
diff
changeset
|
1116 |
|
00dfd8b50773
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2129
diff
changeset
|
1117 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1118 Performing actions in web requests |
| 1098 | 1119 ---------------------------------- |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1120 |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1121 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
|
1122 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
|
1123 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
|
1124 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
|
1125 of: |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
1126 |
| 1125 | 1127 **login** |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
1128 Attempt to log a user in. |
|
1278
0c0494deb09f
doc for the retire action
Richard Jones <richard@users.sourceforge.net>
parents:
1270
diff
changeset
|
1129 |
| 1125 | 1130 **logout** |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
1131 Log the user out - make them "anonymous". |
|
1278
0c0494deb09f
doc for the retire action
Richard Jones <richard@users.sourceforge.net>
parents:
1270
diff
changeset
|
1132 |
| 1125 | 1133 **register** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1134 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
|
1135 log them in. |
|
1278
0c0494deb09f
doc for the retire action
Richard Jones <richard@users.sourceforge.net>
parents:
1270
diff
changeset
|
1136 |
| 1125 | 1137 **edit** |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1138 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
|
1139 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
|
1140 |
| 1125 | 1141 **new** |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1142 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
|
1143 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
|
1144 |
|
1278
0c0494deb09f
doc for the retire action
Richard Jones <richard@users.sourceforge.net>
parents:
1270
diff
changeset
|
1145 **retire** |
|
0c0494deb09f
doc for the retire action
Richard Jones <richard@users.sourceforge.net>
parents:
1270
diff
changeset
|
1146 Retire the item in the database. |
|
0c0494deb09f
doc for the retire action
Richard Jones <richard@users.sourceforge.net>
parents:
1270
diff
changeset
|
1147 |
| 1125 | 1148 **editCSV** |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
1149 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
|
1150 *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
|
1151 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
|
1152 features. |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
1153 |
| 1125 | 1154 **search** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1155 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
|
1156 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1157 - 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
|
1158 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
|
1159 them to :filter. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1160 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1161 - 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
|
1162 user's query list. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1163 |
|
2017
31d920b31642
Update customization examples too, expand upgrade notice a bit.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2016
diff
changeset
|
1164 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
|
1165 "Xxx" is the name of the action) class in the ``roundup.cgi.actions`` module. |
| 2915 | 1166 These classes are registered with ``roundup.cgi.client.Client``. If you need |
| 1167 to define new actions, you may add them there (see `defining new | |
|
2017
31d920b31642
Update customization examples too, expand upgrade notice a bit.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2016
diff
changeset
|
1168 web actions`_). |
|
31d920b31642
Update customization examples too, expand upgrade notice a bit.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2016
diff
changeset
|
1169 |
|
31d920b31642
Update customization examples too, expand upgrade notice a bit.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2016
diff
changeset
|
1170 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
|
1171 the action is permissible given the current user. The base permission checks |
|
2991
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
1172 for each action are: |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1173 |
| 1125 | 1174 **login** |
|
2991
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
1175 Determine whether the user has the "Web Access" Permission. |
| 1125 | 1176 **logout** |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
1177 No permission checks are made. |
| 1125 | 1178 **register** |
|
2991
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
1179 Determine whether the user has the "Web Registration" Permission. |
| 1125 | 1180 **edit** |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1181 Determine whether the user has permission to edit this item. If we're |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1182 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
|
1183 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
|
1184 special Permission "Web Roles". |
| 1125 | 1185 **new** |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1186 Determine whether the user has permission to create this item. No |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1187 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
|
1188 be created if the user has the "Web Registration" Permission. |
| 1125 | 1189 **editCSV** |
|
2991
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
1190 Determine whether the user has permission to edit this class. |
| 1125 | 1191 **search** |
|
2991
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
1192 Determine whether the user has permission to 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
|
1193 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1194 |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1195 Special form variables |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1196 ---------------------- |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1197 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1198 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
|
1199 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
|
1200 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1201 - 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
|
1202 - 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
|
1203 properties, |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1204 - 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
|
1205 current item. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1206 - 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
|
1207 - 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
|
1208 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
|
1209 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1210 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
|
1211 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
|
1212 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1213 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
|
1214 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1215 ``<propname>`` |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1216 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
|
1217 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1218 ``<designator>"@"<propname>`` |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1219 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
|
1220 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1221 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
|
1222 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1223 ``<classname><N>`` |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1224 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
|
1225 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1226 ``<classname>"-"<N>`` |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1227 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
|
1228 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
|
1229 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
|
1230 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
|
1231 item. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1232 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1233 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
|
1234 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
|
1235 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1236 ``@required`` |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1237 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
|
1238 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
|
1239 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
|
1240 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1241 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
|
1242 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
|
1243 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
|
1244 <designator>. |
|
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 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
|
1247 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
|
1248 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1249 ``@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
|
1250 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
|
1251 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
|
1252 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
|
1253 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
|
1254 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
|
1255 property. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1256 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1257 ``@link@<propname>=<designator>`` |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1258 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
|
1259 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
|
1260 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
|
1261 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
|
1262 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
|
1263 form variable. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1264 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1265 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
|
1266 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
|
1267 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
|
1268 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1269 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
|
1270 single key for 'klass', where the key field is |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1271 specified in schema.py. |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1272 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1273 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
|
1274 comma-separated list of keys for 'klass', where the |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1275 key field is specified in schema.py. |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1276 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1277 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
|
1278 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
|
1279 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
|
1280 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1281 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
|
1282 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
|
1283 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
|
1284 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
|
1285 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
|
1286 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1287 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
|
1288 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
|
1289 appropriate |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1290 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1291 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
|
1292 designator. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1293 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1294 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
|
1295 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1296 @note |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1297 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
|
1298 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1299 @link@messages=msg-1 |
| 1918 | 1300 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
|
1301 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1302 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
|
1303 "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
|
1304 time, respectively. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1305 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1306 @file |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1307 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
|
1308 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1309 @link@files=file-1 |
| 1918 | 1310 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
|
1311 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1312 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
|
1313 uploads. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1314 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1315 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
|
1316 specified, the action:: |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1317 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1318 @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
|
1319 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1320 is also performed. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1321 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1322 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
|
1323 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
|
1324 returning. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1325 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1326 |
| 1091 | 1327 Default templates |
| 1098 | 1328 ----------------- |
| 1091 | 1329 |
|
1952
c40ed9113285
Applied Stefan Seefeld's html4/xhtml patch with some changes.
Richard Jones <richard@users.sourceforge.net>
parents:
1918
diff
changeset
|
1330 The default templates are html4 compliant. If you wish to change them to be |
|
2921
ad4fb8a14a97
more doc updates, not so many TODOs any more
Richard Jones <richard@users.sourceforge.net>
parents:
2915
diff
changeset
|
1331 xhtml compliant, you'll need to change the ``html_version`` configuration |
|
ad4fb8a14a97
more doc updates, not so many TODOs any more
Richard Jones <richard@users.sourceforge.net>
parents:
2915
diff
changeset
|
1332 variable in ``config.ini`` to ``'xhtml'`` instead of ``'html4'``. |
|
1952
c40ed9113285
Applied Stefan Seefeld's html4/xhtml patch with some changes.
Richard Jones <richard@users.sourceforge.net>
parents:
1918
diff
changeset
|
1333 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1334 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
|
1335 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
|
1336 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
|
1337 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1338 **page.html** |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1339 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
|
1340 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
|
1341 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
|
1342 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
|
1343 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
|
1344 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
|
1345 title. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1346 **home.html** |
| 1091 | 1347 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
|
1348 **home.classlist.html** |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1349 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
|
1350 tracker |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1351 **classname.item.html** |
| 1091 | 1352 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
|
1353 **classname.index.html** |
| 1091 | 1354 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
|
1355 **classname.search.html** |
| 1091 | 1356 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
|
1357 **_generic.index.html** |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1358 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
|
1359 ``*classname*.index`` available |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1360 **_generic.help.html** |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1361 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
|
1362 ``*classname*.help`` |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1363 **user.register.html** |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1364 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
|
1365 page |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1366 **style.css.html** |
| 1091 | 1367 a static file that is served up as-is |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1368 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1369 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
|
1370 |
|
3039
70c9954f619f
formatting fixes
Richard Jones <richard@users.sourceforge.net>
parents:
3037
diff
changeset
|
1371 Remember that you can create any template extension you want to, |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1372 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
|
1373 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
|
1374 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
|
1375 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
1376 http://your.tracker.example/tracker/issue?@template=test |
|
1147
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
1377 |
|
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
1378 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
|
1379 |
|
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
1380 |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1381 How the templates work |
| 1098 | 1382 ---------------------- |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1383 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1384 |
| 1214 | 1385 Basic Templating Actions |
| 1386 ~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 1387 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1388 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
|
1389 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
|
1390 The basic TAL commands are: |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1391 |
| 1125 | 1392 **tal:define="variable expression; variable expression; ..."** |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1393 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
|
1394 example:: |
|
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 <html tal:define="title request/description"> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1397 <head><title tal:content="title"></title></head> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1398 </html> |
|
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 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
|
1401 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
|
1402 <html> tag may then use the "title" variable. |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1403 |
| 1125 | 1404 **tal:condition="expression"** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1405 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
|
1406 example:: |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1407 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1408 <p tal:condition="python:request.user.hasPermission('View', 'issue')"> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1409 Display some issue information. |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1410 </p> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1411 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1412 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
|
1413 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
|
1414 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
|
1415 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
|
1416 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
|
1417 spaces!). |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1418 |
| 1125 | 1419 **tal:repeat="variable expression"** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1420 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
|
1421 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
|
1422 special "repeat" variable for each element. For example:: |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1423 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1424 <tr tal:repeat="u user/list"> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1425 <td tal:content="u/id"></td> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1426 <td tal:content="u/username"></td> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1427 <td tal:content="u/realname"></td> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1428 </tr> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1429 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1430 The example would iterate over the sequence of users returned by |
|
2855
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
1431 "user/list" and define the local variable "u" for each entry. Using |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
1432 the repeat command creates a new variable called "repeat" which you |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
1433 may access to gather information about the iteration. See the section |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
1434 below on `the repeat variable`_. |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1435 |
| 1125 | 1436 **tal:replace="expression"** |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1437 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
|
1438 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1439 <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
|
1440 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1441 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
|
1442 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
|
1443 resultant output would be "Bruce". |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1444 |
| 1125 | 1445 **tal:content="expression"** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1446 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
|
1447 For example:: |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1448 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1449 <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
|
1450 </span> |
|
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 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
|
1453 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
|
1454 resultant output would be "<span>Bruce</span>". |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1455 |
| 1125 | 1456 **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
|
1457 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
|
1458 example:: |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1459 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1460 <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
|
1461 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1462 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
|
1463 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
|
1464 be something like "user123". |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1465 |
| 1125 | 1466 **tal:omit-tag="expression"** |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1467 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
|
1468 example:: |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1469 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1470 <span tal:omit-tag="python:1">Hello, world!</span> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1471 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1472 would result in output of:: |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1473 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1474 Hello, world! |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
1475 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1476 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
|
1477 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
|
1478 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1479 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
|
1480 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
|
1481 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
|
1482 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
|
1483 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
|
1484 illegal tag placement to effect the repeat). |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1485 |
|
2296
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1486 .. _TAL: |
|
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1487 .. _Template Attribute Language: |
|
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1488 http://dev.zope.org/Wikis/DevSite/Projects/ZPT/TAL%20Specification%201.4 |
| 1214 | 1489 |
| 2910 | 1490 |
| 1214 | 1491 Templating Expressions |
| 1492 ~~~~~~~~~~~~~~~~~~~~~~ | |
| 1493 | |
|
2296
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1494 Templating Expressions are covered by `Template Attribute Language |
|
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1495 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
|
1496 attribute values may be one of the following forms: |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1497 |
| 1125 | 1498 **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
|
1499 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
|
1500 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
|
1501 ``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
|
1502 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
|
1503 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
|
1504 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
|
1505 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
|
1506 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
|
1507 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
|
1508 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
|
1509 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1510 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
|
1511 "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
|
1512 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
|
1513 case of ``tal:attributes``). |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1514 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1515 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
|
1516 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
|
1517 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
|
1518 the case of ``tal:replace``). |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1519 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1520 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
|
1521 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
|
1522 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
|
1523 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
|
1524 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1525 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
|
1526 ``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
|
1527 expressions. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1528 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1529 **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
|
1530 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
|
1531 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
|
1532 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
|
1533 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1534 **Python Expressions** - eg. ``python: 1+1`` |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1535 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
|
1536 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
|
1537 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
|
1538 ``checklist`` is a method. |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1539 |
|
1448
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
1540 Modifiers: |
|
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
1541 |
|
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
1542 **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
|
1543 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
|
1544 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
|
1545 ``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
|
1546 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
|
1547 to the web browser for rendering. |
|
1448
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
1548 |
|
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
1549 **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
|
1550 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
|
1551 expression. |
|
1448
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
1552 |
|
2296
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1553 .. _TALES: |
|
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1554 .. _Template Attribute Language Expression Syntax: |
|
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1555 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
|
1556 |
| 2910 | 1557 |
| 1214 | 1558 Template Macros |
| 1559 ~~~~~~~~~~~~~~~ | |
| 1560 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1561 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
|
1562 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
|
1563 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
|
1564 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1565 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
|
1566 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
|
1567 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
|
1568 Attribute Language`_, or METAL. The macro commands are: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1569 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1570 **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
|
1571 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
|
1572 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
|
1573 example:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1574 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1575 <html metal:define-macro="page"> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1576 ... |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1577 </html> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1578 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1579 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
|
1580 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
|
1581 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
|
1582 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
|
1583 ``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
|
1584 "page" template. |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1585 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1586 **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
|
1587 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
|
1588 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
|
1589 For example:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1590 |
| 1214 | 1591 <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
|
1592 ... |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1593 </tal:block> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1594 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1595 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
|
1596 "page" template. |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1597 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1598 **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
|
1599 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
|
1600 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
|
1601 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
|
1602 so:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1603 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1604 <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
|
1605 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1606 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
|
1607 like this:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1608 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1609 <title metal:fill-slot="head_title">My Title</title> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1610 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1611 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
|
1612 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
|
1613 |
|
2296
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1614 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
|
1615 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
|
1616 *fill-slots* tags may have all manner of TAL inside them). |
| 1214 | 1617 |
|
2296
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1618 .. _METAL: |
|
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1619 .. _Macro Expansion Template Attribute Language: |
|
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
1620 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
|
1621 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1622 Information available to templates |
| 1098 | 1623 ---------------------------------- |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1624 |
|
3039
70c9954f619f
formatting fixes
Richard Jones <richard@users.sourceforge.net>
parents:
3037
diff
changeset
|
1625 This is implemented by ``roundup.cgi.templating.RoundupPageTemplate`` |
| 1125 | 1626 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1627 The following variables are available to templates. |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1628 |
| 1125 | 1629 **context** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1630 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
|
1631 or a `hyperdb item wrapper`_ |
| 1125 | 1632 **request** |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1633 Includes information about the current request, including: |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1634 - the current index information (``filterspec``, ``filter`` args, |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1635 ``properties``, etc) parsed out of the form. |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1636 - methods for easy filterspec link generation |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
1637 - *user*, the current user item as an HTMLItem instance |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1638 - *form* |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1639 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
|
1640 to value |
|
1254
77920c42aeb9
Expose the tracker config as a variable for templating
Richard Jones <richard@users.sourceforge.net>
parents:
1252
diff
changeset
|
1641 **config** |
|
2921
ad4fb8a14a97
more doc updates, not so many TODOs any more
Richard Jones <richard@users.sourceforge.net>
parents:
2915
diff
changeset
|
1642 This variable holds all the values defined in the tracker config.ini |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1643 file (eg. TRACKER_NAME, etc.) |
| 1125 | 1644 **db** |
|
1254
77920c42aeb9
Expose the tracker config as a variable for templating
Richard Jones <richard@users.sourceforge.net>
parents:
1252
diff
changeset
|
1645 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
|
1646 **templates** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1647 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
|
1648 *use-macro* commands. |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1649 **utils** |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
1650 This variable makes available some utility functions like batching. |
| 1125 | 1651 **nothing** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1652 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
|
1653 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
|
1654 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
|
1655 ``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
|
1656 example:: |
| 1100 | 1657 |
| 1658 <span tal:attributes="class nothing">Hello, World!</span> | |
| 1659 | |
| 1660 would result in:: | |
| 1661 | |
| 1662 <span>Hello, World!</span> | |
| 1663 | |
| 1125 | 1664 **default** |
| 1100 | 1665 Also a special variable - if an expression evaluates to this, then the |
| 1666 existing HTML in the template will not be replaced or removed, it will | |
| 1667 remain. So:: | |
| 1668 | |
| 1669 <span tal:replace="default">Hello, World!</span> | |
| 1670 | |
| 1671 would result in:: | |
| 1672 | |
| 1673 <span>Hello, World!</span> | |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1674 |
|
2526
dfe0bde4ff7f
"Information available to templates": 'true' and 'false' constants
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2511
diff
changeset
|
1675 **true**, **false** |
|
dfe0bde4ff7f
"Information available to templates": 'true' and 'false' constants
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2511
diff
changeset
|
1676 Boolean constants that may be used in `templating expressions`_ |
|
dfe0bde4ff7f
"Information available to templates": 'true' and 'false' constants
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2511
diff
changeset
|
1677 instead of ``python:1`` and ``python:0``. |
|
2540
bad572863a85
"Information available to templates": i18n
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2526
diff
changeset
|
1678 **i18n** |
|
bad572863a85
"Information available to templates": i18n
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2526
diff
changeset
|
1679 Internationalization service, providing two string translation methods: |
|
bad572863a85
"Information available to templates": i18n
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2526
diff
changeset
|
1680 |
|
bad572863a85
"Information available to templates": i18n
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2526
diff
changeset
|
1681 **gettext** (*message*) |
|
bad572863a85
"Information available to templates": i18n
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2526
diff
changeset
|
1682 Return the localized translation of message |
|
bad572863a85
"Information available to templates": i18n
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2526
diff
changeset
|
1683 **ngettext** (*singular*, *plural*, *number*) |
|
bad572863a85
"Information available to templates": i18n
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2526
diff
changeset
|
1684 Like ``gettext()``, but consider plural forms. If a translation |
|
bad572863a85
"Information available to templates": i18n
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2526
diff
changeset
|
1685 is found, apply the plural formula to *number*, and return the |
|
bad572863a85
"Information available to templates": i18n
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2526
diff
changeset
|
1686 resulting message (some languages have more than two plural forms). |
|
bad572863a85
"Information available to templates": i18n
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2526
diff
changeset
|
1687 If no translation is found, return singular if *number* is 1; |
|
bad572863a85
"Information available to templates": i18n
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2526
diff
changeset
|
1688 return plural otherwise. |
|
bad572863a85
"Information available to templates": i18n
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2526
diff
changeset
|
1689 |
|
bad572863a85
"Information available to templates": i18n
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2526
diff
changeset
|
1690 This function requires python2.3; in earlier python versions |
|
bad572863a85
"Information available to templates": i18n
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2526
diff
changeset
|
1691 may not work as expected. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1692 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1693 The context variable |
| 1098 | 1694 ~~~~~~~~~~~~~~~~~~~~ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1695 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1696 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
|
1697 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
|
1698 |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1699 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
|
1700 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
|
1701 `hyperdb class wrapper`_. |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1702 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
|
1703 `hyperdb item wrapper`_. |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1704 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1705 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
|
1706 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
|
1707 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1708 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
|
1709 appear if the property is displayed through ``context/property`` or |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1710 ``context/property/field``. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1711 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
|
1712 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
|
1713 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
|
1714 "context/id". |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1715 |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1716 Hyperdb class wrapper |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1717 ::::::::::::::::::::: |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1718 |
|
3039
70c9954f619f
formatting fixes
Richard Jones <richard@users.sourceforge.net>
parents:
3037
diff
changeset
|
1719 This is implemented by the ``roundup.cgi.templating.HTMLClass`` |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1720 class. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1721 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1722 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
|
1723 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
|
1724 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
|
1725 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
|
1726 mind. |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1727 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1728 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
|
1729 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
|
1730 from the CGI form. |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1731 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1732 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
|
1733 |
|
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 Method Description |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1736 =========== ============================================================= |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1737 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
|
1738 properties. |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1739 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
|
1740 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
|
1741 propnames lists the names of the properties of this class. |
|
2858
0357a9c93933
fix filter() doc
Richard Jones <richard@users.sourceforge.net>
parents:
2855
diff
changeset
|
1742 filter lists of items from this class, filtered and sorted. Two |
|
0357a9c93933
fix filter() doc
Richard Jones <richard@users.sourceforge.net>
parents:
2855
diff
changeset
|
1743 options are avaible for sorting: |
|
0357a9c93933
fix filter() doc
Richard Jones <richard@users.sourceforge.net>
parents:
2855
diff
changeset
|
1744 |
|
0357a9c93933
fix filter() doc
Richard Jones <richard@users.sourceforge.net>
parents:
2855
diff
changeset
|
1745 1. by the current *request* filterspec/filter/sort/group args |
|
0357a9c93933
fix filter() doc
Richard Jones <richard@users.sourceforge.net>
parents:
2855
diff
changeset
|
1746 2. by the "filterspec", "sort" and "group" keyword args. |
|
0357a9c93933
fix filter() doc
Richard Jones <richard@users.sourceforge.net>
parents:
2855
diff
changeset
|
1747 "filterspec" is ``{propname: value(s)}``. "sort" and |
|
0357a9c93933
fix filter() doc
Richard Jones <richard@users.sourceforge.net>
parents:
2855
diff
changeset
|
1748 "group" are ``(dir, prop)`` where dir is '+', '-' or None |
|
0357a9c93933
fix filter() doc
Richard Jones <richard@users.sourceforge.net>
parents:
2855
diff
changeset
|
1749 and prop is a prop name or None. |
|
0357a9c93933
fix filter() doc
Richard Jones <richard@users.sourceforge.net>
parents:
2855
diff
changeset
|
1750 |
|
0357a9c93933
fix filter() doc
Richard Jones <richard@users.sourceforge.net>
parents:
2855
diff
changeset
|
1751 eg. ``issue.filter(filterspec={"priority": "1"}, |
|
0357a9c93933
fix filter() doc
Richard Jones <richard@users.sourceforge.net>
parents:
2855
diff
changeset
|
1752 sort=('activity', '+'))`` |
|
0357a9c93933
fix filter() doc
Richard Jones <richard@users.sourceforge.net>
parents:
2855
diff
changeset
|
1753 |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1754 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
|
1755 "help" template. |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1756 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
|
1757 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
|
1758 history returns 'New node - no history' :) |
|
1136
7e193bbda38e
added generic item editing
Richard Jones <richard@users.sourceforge.net>
parents:
1133
diff
changeset
|
1759 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
|
1760 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
|
1761 =========== ============================================================= |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1762 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1763 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
|
1764 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
|
1765 expression. For example:: |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1766 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1767 python:context['list'] |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1768 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1769 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
|
1770 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1771 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1772 Hyperdb item wrapper |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1773 :::::::::::::::::::: |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1774 |
|
3039
70c9954f619f
formatting fixes
Richard Jones <richard@users.sourceforge.net>
parents:
3037
diff
changeset
|
1775 This is implemented by the ``roundup.cgi.templating.HTMLItem`` |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1776 class. |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1777 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1778 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
|
1779 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1780 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
|
1781 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
|
1782 from the CGI form. |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1783 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1784 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
|
1785 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1786 =============== ======================================================== |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1787 Method Description |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1788 =============== ======================================================== |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1789 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
|
1790 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
|
1791 implemented**) |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1792 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
|
1793 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
|
1794 for the query |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1795 hasPermission specific to the "user" class - determine whether the |
|
2991
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
1796 user has a Permission. The signature is:: |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
1797 |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
1798 hasPermission(self, permission, [classname=], |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
1799 [property=], [itemid=]) |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
1800 |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
1801 where the classname defaults to the current context. |
|
1136
7e193bbda38e
added generic item editing
Richard Jones <richard@users.sourceforge.net>
parents:
1133
diff
changeset
|
1802 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
|
1803 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
|
1804 is_retired is the item retired? |
|
2180
58b6d1747973
Web interface tweaks.
Richard Jones <richard@users.sourceforge.net>
parents:
2159
diff
changeset
|
1805 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
|
1806 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
|
1807 =============== ======================================================== |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1808 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1809 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
|
1810 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
|
1811 expression. For example:: |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1812 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1813 python:context['journal'] |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1814 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1815 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
|
1816 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1817 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1818 Hyperdb property wrapper |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1819 :::::::::::::::::::::::: |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1820 |
|
3039
70c9954f619f
formatting fixes
Richard Jones <richard@users.sourceforge.net>
parents:
3037
diff
changeset
|
1821 This is implemented by subclasses of the |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1822 ``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
|
1823 ``HTMLNumberProperty``, and so on). |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1824 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1825 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
|
1826 value may be either: |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1827 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1828 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
|
1829 the hyperdb |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1830 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
|
1831 the CGI form |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1832 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1833 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1834 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
|
1835 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1836 =============== ======================================================== |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1837 Attribute Description |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1838 =============== ======================================================== |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1839 _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
|
1840 _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
|
1841 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
|
1842 =============== ======================================================== |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1843 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1844 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
|
1845 |
|
1773
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1846 =========== ================================================================ |
|
1780
d2801a2b0a77
Initial implementation (half-baked) at new Tracker instance.
Richard Jones <richard@users.sourceforge.net>
parents:
1777
diff
changeset
|
1847 Method Description |
|
1773
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1848 =========== ================================================================ |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1849 plain render a "plain" representation of the property. This method |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1850 may take two arguments: |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1851 |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1852 escape |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1853 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
|
1854 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
|
1855 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
|
1856 option is used in the template. The following ``tal:content`` |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1857 expressions are all equivalent:: |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1858 |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1859 "structure python:msg.content.plain(escape=1)" |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1860 "python:msg.content.plain()" |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1861 "msg/content/plain" |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1862 "msg/content" |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1863 |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1864 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
|
1865 complex expression. |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1866 |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1867 hyperlink |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1868 If true, turn URLs, email addresses and hyperdb item |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1869 designators in the text into hyperlinks (default: no). Note |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1870 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
|
1871 want to use this ``tal:content`` expression:: |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1872 |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1873 "structure python:msg.content.plain(hyperlink=1)" |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1874 |
|
2958
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
1875 The text is automatically HTML-escaped before the hyperlinking |
|
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
1876 transformation done in the plain() method. |
|
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
1877 |
|
1773
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1878 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
|
1879 |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1880 "structure msg/content/hyperlinked" |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1881 |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1882 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
|
1883 most types this is a text entry box, but for Booleans it's a |
|
2958
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
1884 tri-state yes/no/neither selection. This method may take some |
|
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
1885 arguments: |
|
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
1886 |
|
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
1887 size |
|
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
1888 Sets the width in characters of the edit field |
|
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
1889 |
|
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
1890 format (Date properties only) |
|
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
1891 Sets the format of the date in the field - uses the same |
|
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
1892 format string argument as supplied to the ``pretty`` method |
|
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
1893 below. |
|
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
1894 |
|
1773
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1895 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
|
1896 as StructuredText (requires the StructureText module to be |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1897 installed separately) |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1898 multiline only on String properties - render a multiline form edit |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1899 field for the property |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1900 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
|
1901 as an obscured email address |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1902 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
|
1903 for the property, used for confirmation that the user typed |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1904 the password correctly. Generates a field with name |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1905 "name:confirm". |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1906 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
|
1907 property |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1908 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
|
1909 and now |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1910 local only on Date properties - return this date as a new property |
| 2007 | 1911 with some timezone offset, for example:: |
| 1912 | |
| 1913 python:context.creation.local(10) | |
| 1914 | |
| 1915 will render the date with a +10 hour offset. | |
| 2088 | 1916 pretty Date properties - render the date as "dd Mon YYYY" (eg. "19 |
| 1917 Mar 2004"). Takes an optional format argument, for example:: | |
| 1918 | |
| 1919 python:context.activity.pretty('%Y-%m-%d') | |
| 1920 | |
| 1921 Will format as "2004-03-19" instead. | |
| 1922 | |
| 1923 Interval properties - render the interval in a pretty | |
|
2958
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
1924 format (eg. "yesterday"). The format arguments are those used |
|
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
1925 in the standard ``strftime`` call (see the `Python Library |
|
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
1926 Reference: time module`__) |
|
1773
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1927 menu only on Link and Multilink properties - render a form select |
|
3128
f0051e4bc8b7
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3124
diff
changeset
|
1928 list for this property. Takes a number of optional arguments |
|
f0051e4bc8b7
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3124
diff
changeset
|
1929 |
|
f0051e4bc8b7
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3124
diff
changeset
|
1930 size |
|
f0051e4bc8b7
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3124
diff
changeset
|
1931 is used to limit the length of the list labels |
|
f0051e4bc8b7
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3124
diff
changeset
|
1932 height |
|
f0051e4bc8b7
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3124
diff
changeset
|
1933 is used to set the <select> tag's "size" attribute |
|
f0051e4bc8b7
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3124
diff
changeset
|
1934 showid |
|
f0051e4bc8b7
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3124
diff
changeset
|
1935 includes the item ids in the list labels |
|
f0051e4bc8b7
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3124
diff
changeset
|
1936 additional |
|
f0051e4bc8b7
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3124
diff
changeset
|
1937 lists properties which should be included in the label |
|
f0051e4bc8b7
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3124
diff
changeset
|
1938 sort_on |
|
f0051e4bc8b7
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3124
diff
changeset
|
1939 indicates the property to sort the list on as (direction, |
|
f0051e4bc8b7
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3124
diff
changeset
|
1940 property) where direction is '+' or '-'. |
|
f0051e4bc8b7
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3124
diff
changeset
|
1941 |
|
f0051e4bc8b7
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3124
diff
changeset
|
1942 The remaining keyword arguments are used as conditions for |
|
f0051e4bc8b7
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3124
diff
changeset
|
1943 filtering the items in the list - they're passed as the |
|
f0051e4bc8b7
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3124
diff
changeset
|
1944 "filterspec" argument to a Class.filter() call. |
|
2883
1ca5ebe9b16a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2858
diff
changeset
|
1945 sorted only on Multilink properties - produce a list of the linked |
|
1ca5ebe9b16a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2858
diff
changeset
|
1946 items sorted by some property, for example:: |
|
1ca5ebe9b16a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2858
diff
changeset
|
1947 |
|
1ca5ebe9b16a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2858
diff
changeset
|
1948 python:context.files.sorted('creation') |
|
1ca5ebe9b16a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2858
diff
changeset
|
1949 |
|
1ca5ebe9b16a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2858
diff
changeset
|
1950 Will list the files by upload date. |
|
1773
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
1951 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
|
1952 items in reverse order |
|
2180
58b6d1747973
Web interface tweaks.
Richard Jones <richard@users.sourceforge.net>
parents:
2159
diff
changeset
|
1953 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
|
1954 =========== ================================================================ |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
1955 |
|
2958
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
1956 __ http://docs.python.org/lib/module-time.html |
|
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
1957 |
|
2138
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
1958 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
|
1959 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
|
1960 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
|
1961 |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
1962 context/title/field |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
1963 |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
1964 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
|
1965 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
|
1966 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
|
1967 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
|
1968 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
|
1969 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1970 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1971 The request variable |
| 1098 | 1972 ~~~~~~~~~~~~~~~~~~~~ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1973 |
|
3039
70c9954f619f
formatting fixes
Richard Jones <richard@users.sourceforge.net>
parents:
3037
diff
changeset
|
1974 This is implemented by the ``roundup.cgi.templating.HTMLRequest`` |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1975 class. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1976 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1977 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
|
1978 request. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1979 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1980 .. 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
|
1981 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1982 =========== ============================================================ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1983 Variable Holds |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1984 =========== ============================================================ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1985 form the CGI form as a cgi.FieldStorage |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1986 env the CGI environment variables |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
1987 base the base URL for this tracker |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1988 user a HTMLUser instance for this user |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1989 classname the current classname (possibly None) |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1990 template the current template (suffix, also possibly None) |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1991 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
|
1992 =========== ============================================================ |
| 1083 | 1993 |
| 1994 **Index page specific variables (indexing arguments)** | |
| 1995 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1996 =========== ============================================================ |
| 1083 | 1997 Variable Holds |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1998 =========== ============================================================ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
1999 columns dictionary of the columns to display in an index page |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
2000 show a convenience access to columns - request/show/colname will |
| 1098 | 2001 be true if the columns should be displayed, false otherwise |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
2002 sort index sort column (direction, column name) |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
2003 group index grouping property (direction, column name) |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
2004 filter properties to filter the index on |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
2005 filterspec values to filter the index on |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
2006 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
|
2007 =========== ============================================================ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
2008 |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2009 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
|
2010 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2011 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2012 Method Description |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2013 =============== ======================================================== |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2014 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
|
2015 page title |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2016 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
|
2017 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
|
2018 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
|
2019 of the templating |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2020 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
|
2021 list of items (see `hyperdb item wrapper`_, and |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2022 `batching`_) |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2023 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2024 |
| 1142 | 2025 The form variable |
| 2026 ::::::::::::::::: | |
| 2027 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2028 The form variable is a bit special because it's actually a python |
| 1142 | 2029 FieldStorage object. That means that you have two ways to access its |
| 2030 contents. For example, to look up the CGI form value for the variable | |
| 2031 "name", use the path expression:: | |
| 2032 | |
| 2033 request/form/name/value | |
| 2034 | |
| 2035 or the python expression:: | |
| 2036 | |
| 2037 python:request.form['name'].value | |
| 2038 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2039 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
|
2040 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
|
2041 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
|
2042 "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
|
2043 ``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
|
2044 best to know beforehand what you're dealing with. |
| 1142 | 2045 |
| 2046 | |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
2047 The db variable |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
2048 ~~~~~~~~~~~~~~~ |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
2049 |
|
3039
70c9954f619f
formatting fixes
Richard Jones <richard@users.sourceforge.net>
parents:
3037
diff
changeset
|
2050 This is implemented by the ``roundup.cgi.templating.HTMLDatabase`` |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2051 class. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2052 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2053 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
|
2054 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
|
2055 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
2056 db/user |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
2057 python:db.user |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
2058 |
|
1711
3c3e44aacdb4
Documentation fixes.
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1680
diff
changeset
|
2059 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
|
2060 ``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
|
2061 ``request/user``), but it can be useful in detectors or interfaces. |
|
3c3e44aacdb4
Documentation fixes.
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1680
diff
changeset
|
2062 |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
2063 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
|
2064 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2065 |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2066 The templates variable |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2067 ~~~~~~~~~~~~~~~~~~~~~~ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
2068 |
|
3039
70c9954f619f
formatting fixes
Richard Jones <richard@users.sourceforge.net>
parents:
3037
diff
changeset
|
2069 This is implemented by the ``roundup.cgi.templating.Templates`` |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2070 class. |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2071 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2072 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
|
2073 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
|
2074 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
|
2075 expression:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2076 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2077 templates/name |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2078 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2079 or the python expression:: |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2080 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2081 templates[name] |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2082 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2083 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
|
2084 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
|
2085 macro (called "macro_name"), use the path expression:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2086 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2087 templates/name/macros/macro_name |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2088 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2089 or the python expression:: |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2090 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2091 templates[name].macros[macro_name] |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2092 |
|
2855
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2093 The repeat variable |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2094 ~~~~~~~~~~~~~~~~~~~ |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2095 |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2096 The repeat variable holds an entry for each active iteration. That is, if |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2097 you have a ``tal:repeat="user db/users"`` command, then there will be a |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2098 repeat variable entry called "user". This may be accessed as either:: |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2099 |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2100 repeat/user |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2101 python:repeat['user'] |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2102 |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2103 The "user" entry has a number of methods available for information: |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2104 |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2105 =============== ========================================================= |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2106 Method Description |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2107 =============== ========================================================= |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2108 first True if the current item is the first in the sequence. |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2109 last True if the current item is the last in the sequence. |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2110 even True if the current item is an even item in the sequence. |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2111 odd True if the current item is an odd item in the sequence. |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2112 number Current position in the sequence, starting from 1. |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2113 letter Current position in the sequence as a letter, a through |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2114 z, then aa through zz, and so on. |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2115 Letter Same as letter(), except uppercase. |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2116 roman Current position in the sequence as lowercase roman |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2117 numerals. |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2118 Roman Same as roman(), except uppercase. |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2119 =============== ========================================================= |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
2120 |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2121 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2122 The utils variable |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2123 ~~~~~~~~~~~~~~~~~~ |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2124 |
|
3039
70c9954f619f
formatting fixes
Richard Jones <richard@users.sourceforge.net>
parents:
3037
diff
changeset
|
2125 This is implemented by the |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2126 ``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
|
2127 as described below. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2128 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2129 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2130 Method Description |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2131 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2132 Batch return a batch object using the supplied list |
|
2180
58b6d1747973
Web interface tweaks.
Richard Jones <richard@users.sourceforge.net>
parents:
2159
diff
changeset
|
2133 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
|
2134 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
|
2135 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2136 |
|
1270
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2137 You may add additional utility methods by writing them in your tracker |
| 2915 | 2138 ``extensions`` directory and registering them with the templating system |
| 2139 using ``instance.registerUtil`` (see `adding a time log to your issues`_ for | |
| 2140 an example of this). | |
|
2886
0998d1b48182
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
2883
diff
changeset
|
2141 |
|
1270
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
2142 |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2143 Batching |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2144 :::::::: |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2145 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2146 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
|
2147 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
|
2148 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2149 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
|
2150 overlap=0) |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2151 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2152 or, to get the current index batch:: |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2153 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2154 request/batch |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2155 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2156 The parameters are: |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2157 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2158 ========= ============================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2159 Parameter Usage |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2160 ========= ============================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2161 sequence a list of HTMLItems |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2162 size how big to make the sequence. |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2163 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
|
2164 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
|
2165 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
|
2166 then it is combined with this batch |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2167 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
|
2168 ========= ============================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2169 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2170 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
|
2171 addition, it has several more attributes: |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2172 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2173 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2174 Attribute Description |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2175 =============== ======================================================== |
|
3039
70c9954f619f
formatting fixes
Richard Jones <richard@users.sourceforge.net>
parents:
3037
diff
changeset
|
2176 start indicates the start index of the batch. *Unlike |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2177 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
|
2178 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
|
2179 index* |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2180 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
|
2181 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
|
2182 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2183 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2184 And several methods: |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2185 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2186 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2187 Method Description |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2188 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2189 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
|
2190 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
|
2191 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
|
2192 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
|
2193 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2194 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2195 An example of batching:: |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2196 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2197 <table class="otherinfo"> |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2198 <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
|
2199 <tr tal:define="keywords db/keyword/list" |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2200 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
|
2201 <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
|
2202 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
|
2203 keyword here</td> |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2204 </tr> |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2205 </table> |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2206 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2207 ... 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
|
2208 the "keyword" class (well, their "name" anyway). |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
2209 |
| 2910 | 2210 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2211 Displaying Properties |
| 1098 | 2212 --------------------- |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2213 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2214 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
|
2215 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
|
2216 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
|
2217 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
|
2218 view, that property may be displayed in an editable field. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2219 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2220 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2221 Index Views |
| 1098 | 2222 ----------- |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2223 |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2224 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
|
2225 classes. The template used is "*classname*.index". |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2226 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2227 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2228 Index View Specifiers |
| 1098 | 2229 ~~~~~~~~~~~~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2230 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2231 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
|
2232 been added for clarity):: |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2233 |
|
3037
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2234 /issue?status=unread,in-progress,resolved& |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2235 topic=security,ui& |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2236 @group=priority& |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2237 @sort=-activity& |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2238 @filters=status,topic& |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2239 @columns=title,status,fixer |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2240 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2241 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
|
2242 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
|
2243 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
|
2244 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
|
2245 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
|
2246 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
|
2247 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
|
2248 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
|
2249 headings in the table. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2250 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2251 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
|
2252 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
|
2253 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
|
2254 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2255 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
|
2256 "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
|
2257 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
|
2258 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
|
2259 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
|
2260 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
|
2261 "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
|
2262 "status", and "fixer" properties. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2263 |
|
3037
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2264 ============ ============================================================= |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2265 Argument Description |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2266 ============ ============================================================= |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2267 @sort sort by prop name, optionally preceeded with '-' to give |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2268 descending or nothing for ascending sorting. |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2269 @group group by prop name, optionally preceeded with '-' or to sort |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2270 in descending or nothing for ascending order. |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2271 @columns selects the columns that should be displayed. Default is |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2272 all. |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2273 @filter indicates which properties are being used in filtering. |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2274 Default is none. |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2275 propname selects the values the item properties given by propname must |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2276 have (very basic search/filter). |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2277 @search_text if supplied, performs a full-text search (message bodies, |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2278 issue titles, etc) |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2279 ============ ============================================================= |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2280 |
| 2910 | 2281 |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
2282 Searching Views |
| 1098 | 2283 --------------- |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2284 |
|
3039
70c9954f619f
formatting fixes
Richard Jones <richard@users.sourceforge.net>
parents:
3037
diff
changeset
|
2285 .. note:: |
|
70c9954f619f
formatting fixes
Richard Jones <richard@users.sourceforge.net>
parents:
3037
diff
changeset
|
2286 if you add a new column to the ``@columns`` form variable potentials |
|
70c9954f619f
formatting fixes
Richard Jones <richard@users.sourceforge.net>
parents:
3037
diff
changeset
|
2287 then you will need to add the column to the appropriate `index views`_ |
|
70c9954f619f
formatting fixes
Richard Jones <richard@users.sourceforge.net>
parents:
3037
diff
changeset
|
2288 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
|
2289 |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2290 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
|
2291 "*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
|
2292 ``@action`` variable. The "search" action: |
|
1245
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
2293 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2294 - 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
|
2295 searching |
|
3037
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2296 - sets the ``@filter`` variable correctly |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2297 - saves the query off if ``@query_name`` is set. |
|
1245
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
2298 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2299 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
|
2300 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
|
2301 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
|
2302 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
|
2303 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
|
2304 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
|
2305 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
|
2306 |
|
3037
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2307 If the search view does specify the "search" ``@action``, then it may also |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2308 provide an additional argument: |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2309 |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2310 ============ ============================================================= |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2311 Argument Description |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2312 ============ ============================================================= |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2313 @query_name if supplied, the index parameters (including @search_text) |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2314 will be saved off as a the query item and registered against |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2315 the user's queries property. Note that the *classic* template |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2316 schema has this ability, but the *minimal* template schema |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2317 does not. |
|
714f2a60a97e
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
2318 ============ ============================================================= |
|
1245
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
2319 |
|
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
2320 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2321 Item Views |
| 1098 | 2322 ---------- |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2323 |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2324 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
|
2325 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
|
2326 "history" section. |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2327 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2328 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2329 Editor Section |
| 1098 | 2330 ~~~~~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2331 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2332 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
|
2333 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
|
2334 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2335 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
|
2336 "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
|
2337 template):: |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2338 |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2339 <table class="form"> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2340 <tr> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
2341 <th>Title</th> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2342 <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
|
2343 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2344 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2345 <tr> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
2346 <th>Priority</th> |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2347 <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
|
2348 <th>Status</th> |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2349 <td tal:content="structure context/status/menu">status</td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2350 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2351 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2352 <tr> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
2353 <th>Superseder</th> |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2354 <td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2355 <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
|
2356 <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
|
2357 <span tal:condition="context/superseder"> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2358 <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
|
2359 </span> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2360 </td> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
2361 <th>Nosy List</th> |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2362 <td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2363 <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
|
2364 <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
|
2365 </td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2366 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2367 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2368 <tr> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
2369 <th>Assigned To</th> |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2370 <td tal:content="structure context/assignedto/menu"> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2371 assignedto menu |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2372 </td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2373 <td> </td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2374 <td> </td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2375 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2376 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2377 <tr> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
2378 <th>Change Note</th> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2379 <td colspan="3"> |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
2380 <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
|
2381 </td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2382 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2383 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2384 <tr> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
2385 <th>File</th> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2386 <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
|
2387 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2388 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2389 <tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2390 <td> </td> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2391 <td colspan="3" tal:content="structure context/submit"> |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2392 submit button will go here |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2393 </td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2394 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2395 </table> |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2396 |
|
673
604c84696461
link() htmltemplate function now has a "showid" option for links & multilinks.
Richard Jones <richard@users.sourceforge.net>
parents:
659
diff
changeset
|
2397 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2398 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
|
2399 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
|
2400 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
|
2401 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
|
2402 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2403 |
| 1638 | 2404 Form values |
| 2405 ::::::::::: | |
| 2406 | |
| 2407 We have a number of ways to pull properties out of the form in order to | |
| 2408 meet the various needs of: | |
| 2409 | |
| 2410 1. editing the current item (perhaps an issue item) | |
| 2411 2. editing information related to the current item (eg. messages or | |
| 2412 attached files) | |
| 2413 3. creating new information to be linked to the current item (eg. time | |
| 2414 spent on an issue) | |
| 2415 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2416 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
|
2417 ":" or "@", and other text ("required") is fixed. |
| 1638 | 2418 |
| 2419 Properties are specified as form variables: | |
| 2420 | |
| 2421 ``<propname>`` | |
| 2422 property on the current context item | |
| 2423 | |
| 2424 ``<designator>:<propname>`` | |
| 2425 property on the indicated item (for editing related information) | |
| 2426 | |
| 2427 ``<classname>-<N>:<propname>`` | |
| 2428 property on the Nth new item of classname (generally for creating new | |
| 2429 items to attach to the current item) | |
| 2430 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2431 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
|
2432 the special form values: |
| 1638 | 2433 |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2434 ``@required`` |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2435 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
|
2436 raised. |
| 1638 | 2437 |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2438 ``@remove@<propname>=id(s)`` |
| 1638 | 2439 The ids will be removed from the multilink property. |
| 2440 | |
| 2441 ``:add:<propname>=id(s)`` | |
| 2442 The ids will be added to the multilink property. | |
| 2443 | |
| 2444 ``:link:<propname>=<designator>`` | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2445 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
|
2446 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
|
2447 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
|
2448 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
|
2449 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
|
2450 newly created item of class <designator> (where <designator> must be |
| 1638 | 2451 <classname>-<N>). |
| 2452 | |
| 2453 Any of the form variables may be prefixed with a classname or | |
| 2454 designator. | |
| 2455 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2456 Two special form values are supported for backwards compatibility: |
| 1638 | 2457 |
| 2458 ``:note`` | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2459 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
|
2460 context item. This is ALWAYS designated "msg-1". |
| 1638 | 2461 ``:file`` |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2462 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
|
2463 :note. This is ALWAYS designated "file-1". |
| 1638 | 2464 |
| 2465 | |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2466 Spool Section |
| 1098 | 2467 ~~~~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2468 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2469 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
|
2470 of an issue. |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2471 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2472 TODO |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2473 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2474 |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2475 History Section |
| 1098 | 2476 ~~~~~~~~~~~~~~~ |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2477 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2478 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
|
2479 journal. This is generally generated with the template:: |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2480 |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2481 <tal:block tal:replace="structure context/history" /> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2482 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2483 *To be done:* |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2484 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2485 *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
|
2486 templating through the "journal" method of the item*:: |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2487 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2488 <tal:block tal:repeat="entry context/journal"> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2489 a journal entry |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2490 </tal:block> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2491 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
2492 *where each journal entry is an HTMLJournalEntry.* |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2493 |
| 2910 | 2494 |
| 1098 | 2495 Defining new web actions |
| 2496 ------------------------ | |
| 2497 | |
|
2016
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2498 You may define new actions to be triggered by the ``@action`` form variable. |
| 2915 | 2499 These are added to the tracker ``extensions`` directory and registered |
| 2500 using ``instance.registerAction``. | |
| 2501 | |
| 2502 All the existing Actions are defined in ``roundup.cgi.actions``. | |
|
2016
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2503 |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2504 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
|
2505 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
|
2506 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
|
2507 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
|
2508 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2509 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
|
2510 issues`_" for an example. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2511 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2512 |
|
2016
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2513 Define the new action class |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2514 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2515 |
| 2915 | 2516 Create a new action class in your tracker's ``extensions`` directory, for |
| 2517 example ``myaction.py``:: | |
|
2016
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2518 |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2519 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
|
2520 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
|
2521 ''' 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
|
2522 ''' |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2523 |
| 2915 | 2524 The *self.client* attribute is an instance of ``roundup.cgi.client.Client``. |
| 2525 See the docstring of that class for details of what it can do. | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2526 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2527 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
|
2528 It may then: |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2529 |
|
2016
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2530 - 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
|
2531 - 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
|
2532 next |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2533 - 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
|
2534 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
|
2535 |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2536 |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2537 Register the action class |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2538 ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2539 |
| 2915 | 2540 The class is now written, but isn't available to the user until you register |
| 2541 it with the following code appended to your ``myaction.py`` file:: | |
| 2542 | |
| 2543 def init(instance): | |
| 2544 instance.registerAction('myaction', myActionClass) | |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2545 |
|
2016
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
2546 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
|
2547 |
| 2915 | 2548 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2549 Use the new action |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2550 ~~~~~~~~~~~~~~~~~~ |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2551 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2552 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
|
2553 |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2554 <input type="hidden" name="@action" value="myaction"> |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2555 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2556 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
|
2557 |
|
2046
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
2558 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
|
2559 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
2560 |
|
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
2561 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
|
2562 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
|
2563 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
|
2564 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
|
2565 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
|
2566 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
|
2567 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
|
2568 |
|
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
2569 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
|
2570 |
|
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
2571 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
|
2572 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
|
2573 spreadsheet or database). |
|
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
2574 |
|
910
299f4890427d
documentation reorg post-new-security
Richard Jones <richard@users.sourceforge.net>
parents:
909
diff
changeset
|
2575 |
| 2910 | 2576 8-bit character set support in Web interface |
| 2577 -------------------------------------------- | |
| 2578 | |
| 2579 The web interface uses UTF-8 default. It may be overridden in both forms | |
| 2580 and a browser cookie. | |
| 2581 | |
| 2582 - In forms, use the ``@charset`` variable. | |
| 2583 - To use the cookie override, have the ``roundup_charset`` cookie set. | |
| 2584 | |
| 2585 In both cases, the value is a valid charset name (eg. ``utf-8`` or | |
| 2586 ``kio8-r``). | |
| 2587 | |
| 2588 Inside Roundup, all strings are stored and processed in utf-8. | |
| 2589 Unfortunately, some older browsers do not work properly with | |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2590 utf-8-encoded pages (e.g. Netscape Navigator 4 displays wrong |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2591 characters in form fields). This version allows one to change |
| 2910 | 2592 the character set for http transfers. To do so, you may add |
| 2593 the following code to your ``page.html`` template:: | |
| 2594 | |
| 2595 <tal:block define="uri string:${request/base}${request/env/PATH_INFO}"> | |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2596 <a tal:attributes="href python:request.indexargs_url(uri, |
| 2910 | 2597 {'@charset':'utf-8'})">utf-8</a> |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2598 <a tal:attributes="href python:request.indexargs_url(uri, |
| 2910 | 2599 {'@charset':'koi8-r'})">koi8-r</a> |
| 2600 </tal:block> | |
| 2601 | |
| 2602 (substitute ``koi8-r`` with appropriate charset for your language). | |
| 2603 Charset preference is kept in the browser cookie ``roundup_charset``. | |
| 2604 | |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2605 ``meta http-equiv`` lines added to the tracker templates in version 0.6.0 |
| 2910 | 2606 should be changed to include actual character set name:: |
| 2607 | |
| 2608 <meta http-equiv="Content-Type" | |
| 2609 tal:attributes="content string:text/html;; charset=${request/client/charset}" | |
| 2610 /> | |
| 2611 | |
| 2612 The charset is also sent in the http header. | |
| 2613 | |
| 2614 | |
| 1100 | 2615 Examples |
| 2616 ======== | |
| 2617 | |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2618 .. contents:: |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2619 :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
|
2620 :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
|
2621 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2622 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2623 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
|
2624 -------------------------------------- |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2625 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2626 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
|
2627 the database. |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2628 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2629 |
| 1228 | 2630 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
|
2631 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 1100 | 2632 |
|
3124
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2633 This example shows how to add a simple field (a due date) to the default |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2634 classic schema. It does not add any additional behaviour, such as enforcing |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2635 the due date, or causing automatic actions to fire if the due date passes. |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2636 |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2637 |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2638 1. modify the schema:: |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2639 |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2640 issue = IssueClass(db, "issue", |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2641 assignedto=Link("user"), topic=Multilink("keyword"), |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2642 priority=Link("priority"), status=Link("status"), |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2643 due_dat=Date()) |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2644 |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2645 2. add an edit field to the issue.item.html template:: |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2646 |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2647 <tr> |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2648 <th>Due Date</th> |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2649 <td tal:content="structure context/due_date/field" /> |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2650 </tr> |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2651 |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2652 3. add the property to the issue.index.html page:: |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2653 |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2654 (in the heading row) |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2655 <th tal:condition="request/show/due_date">Due Date</th> |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2656 (in the data row) |
|
3128
f0051e4bc8b7
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3124
diff
changeset
|
2657 <td tal:condition="request/show/due_date" tal:content="i/due_date" /> |
|
3124
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2658 |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2659 4. add the property to the issue.search.html page:: |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2660 |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2661 <tr tal:define="name string:due_date"> |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2662 <th i18n:translate="">Due Date:</th> |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2663 <td metal:use-macro="search_input"></td> |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2664 <td metal:use-macro="column_input"></td> |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2665 <td metal:use-macro="sort_input"></td> |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2666 <td metal:use-macro="group_input"></td> |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2667 </tr> |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2668 |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2669 |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2670 Adding a new constrained field to the classic schema |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2671 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
2672 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2673 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
|
2674 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
|
2675 |
| 1098 | 2676 |
| 2677 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
|
2678 :::::::::::: |
| 1098 | 2679 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2680 To make the classic schema of Roundup useful as a TODO tracking system |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2681 for a group of systems administrators, it needs an extra data field per |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2682 issue: a category. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2683 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2684 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
|
2685 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
|
2686 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
|
2687 best). |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2688 |
| 1098 | 2689 |
| 2690 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
|
2691 :::::::::::::::::::::::::::::: |
| 1098 | 2692 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2693 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
|
2694 plain string, nothing fancy. To change what is in the database you need |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2695 to add some lines to the ``schema.py`` file of your tracker instance. |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2696 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
|
2697 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2698 # 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
|
2699 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2700 add:: |
| 1098 | 2701 |
| 2702 category = Class(db, "category", name=String()) | |
| 2703 category.setkey("name") | |
| 2704 | |
| 2705 Here we are setting up a chunk of the database which we are calling | |
| 2706 "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
|
2707 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
|
2708 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
|
2709 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
|
2710 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
|
2711 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
|
2712 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
|
2713 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2714 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
|
2715 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
|
2716 categories off on its own, which isn't much use. We need to link it in |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2717 with the issues. To do that, find the lines |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
2718 in ``schema.py`` which set up the "issue" class, and then add a link to |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2719 the category:: |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2720 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2721 issue = IssueClass(db, "issue", ... , |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2722 category=Multilink("category"), ... ) |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2723 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2724 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
|
2725 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
|
2726 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
|
2727 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2728 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
|
2729 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
|
2730 |
| 1098 | 2731 |
|
1235
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2732 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
|
2733 ::::::::::::::::::::::::::::::::: |
|
1235
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2734 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2735 If you haven't initialised the database with the ``roundup-admin`` |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2736 "initialise" command, then you can add the following to the tracker |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2737 ``initial_data.py`` under the comment:: |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2738 |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2739 # add any additional database creation steps here - but only if you |
|
1235
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2740 # 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
|
2741 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2742 Add:: |
|
1235
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2743 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2744 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
|
2745 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
|
2746 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
|
2747 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
|
2748 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2749 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
|
2750 ``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
|
2751 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2752 % 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
|
2753 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
|
2754 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
|
2755 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
|
2756 1 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2757 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
|
2758 2 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2759 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
|
2760 3 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2761 roundup> exit... |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2762 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
|
2763 |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
2764 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
|
2765 |
|
1235
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
2766 |
| 1098 | 2767 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
|
2768 :::::::::::::::::::::::::::::::::::::: |
| 1098 | 2769 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2770 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
|
2771 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
|
2772 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
|
2773 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
|
2774 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2775 We therefore need to change the security of the category objects. This |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2776 is also done in ``schema.py``. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2777 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2778 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
|
2779 them to various roles. Simply add the new "category" to both lists:: |
| 1098 | 2780 |
| 2781 # Assign the access and edit permissions for issue, file and message | |
| 2782 # to regular users now | |
| 2783 for cl in 'issue', 'file', 'msg', 'category': | |
| 2784 p = db.security.getPermission('View', cl) | |
|
2991
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
2785 db.security.addPermissionToRole('User', 'View', cl) |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
2786 db.security.addPermissionToRole('User', 'Edit', cl) |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
2787 db.security.addPermissionToRole('User', 'Create', cl) |
| 1098 | 2788 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2789 These lines assign the "View" and "Edit" Permissions to the "User" role, |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2790 so that normal users can view and edit "category" objects. |
| 1098 | 2791 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2792 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
|
2793 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
|
2794 interface stuff. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2795 |
| 1098 | 2796 |
| 2797 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
|
2798 :::::::::::::::::::::::::::::::: |
| 1098 | 2799 |
| 2800 We need to give the users the ability to create new categories, and the | |
| 2801 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
|
2802 bar, under the "Issues" area. The file that defines how this area looks |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2803 is ``html/page.html``, which is what we are going to be editing next. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2804 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2805 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
|
2806 "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
|
2807 excluded in the output depending on whether the condition in the |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2808 classblock is met. We are going to add the category code at the end of |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2809 the classblock for the *issue* class:: |
| 1098 | 2810 |
| 2811 <p class="classblock" | |
| 2812 tal:condition="python:request.user.hasPermission('View', 'category')"> | |
| 2813 <b>Categories</b><br> | |
| 2814 <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
|
2815 href="category?@template=item">New Category<br></a> |
| 1098 | 2816 </p> |
| 2817 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2818 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
|
2819 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
|
2820 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
|
2821 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
|
2822 get that. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2823 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2824 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
|
2825 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
|
2826 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
|
2827 they will get a link to another page which will let the user add new |
| 1098 | 2828 categories. |
| 2829 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2830 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
|
2831 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
|
2832 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
|
2833 now. I just claim that it is so I can add more links in this section |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2834 later on. However, to fix the problem you could change the condition in |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2835 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
|
2836 would see the "Categories" stuff. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2837 |
| 1098 | 2838 |
| 2839 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
|
2840 :::::::::::::::::::::::::::::::::::: |
| 1098 | 2841 |
| 2842 We defined code in the previous section which let users with the | |
| 2843 appropriate permissions see a link to a page which would let them edit | |
| 2844 conditions. Now we have to write that page. | |
| 2845 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2846 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
|
2847 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
|
2848 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
|
2849 write now. |
| 1098 | 2850 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2851 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
|
2852 of the code at all, but is useful for debugging. If you load a page in a |
| 1098 | 2853 browser and look at the page source, you can see which sections come |
| 2854 from which files by looking for these comments:: | |
| 2855 | |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2856 <!-- category.item --> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2857 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2858 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
|
2859 trappings:: |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2860 |
| 1214 | 2861 <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
|
2862 <title metal:fill-slot="head_title">Category editing</title> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2863 <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
|
2864 <h2>Category editing</h2> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2865 </td> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2866 <td class="content" metal:fill-slot="content"> |
| 1098 | 2867 |
| 2868 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
|
2869 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
|
2870 form through only once. This is to stop users hitting the send button |
| 1098 | 2871 multiple times when they are impatient and thus having the form sent |
| 2872 multiple times:: | |
| 2873 | |
| 2874 <form method="POST" onSubmit="return submit_once()" | |
| 2875 enctype="multipart/form-data"> | |
| 2876 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2877 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
|
2878 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
|
2879 they better put something in it, otherwise the whole form is pointless:: |
| 1098 | 2880 |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2881 <input type="hidden" name="@required" value="name"> |
| 1098 | 2882 |
| 2883 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
|
2884 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
|
2885 happening:: |
| 1098 | 2886 |
| 2887 <table class="form"> | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2888 <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
|
2889 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2890 Next, we need the field into which the user is going to enter the new |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2891 category. The ``context.name.field(size=60)`` bit tells Roundup to |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2892 generate a normal HTML field of size 60, and the contents of that field |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2893 will be the "name" variable of the current context (namely "category"). |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2894 The upshot of this is that when the user types something in |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2895 to the form, a new category will be created with that name:: |
| 1098 | 2896 |
| 2897 <tr> | |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
2898 <th>Name</th> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2899 <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
|
2900 name</td> |
| 1098 | 2901 </tr> |
| 2902 | |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2903 Then a submit button so that the user can submit the new category:: |
| 1098 | 2904 |
| 2905 <tr> | |
| 2906 <td> </td> | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2907 <td colspan="3" tal:content="structure context/submit"> |
| 1098 | 2908 submit button will go here |
| 2909 </td> | |
| 2910 </tr> | |
| 2911 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2912 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
|
2913 stuff:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2914 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2915 </td> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2916 </tal:block> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2917 |
| 1098 | 2918 So putting it all together, and closing the table and form we get:: |
| 2919 | |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2920 <!-- category.item --> |
| 1214 | 2921 <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
|
2922 <title metal:fill-slot="head_title">Category editing</title> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2923 <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
|
2924 <h2>Category editing</h2> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2925 </td> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2926 <td class="content" metal:fill-slot="content"> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2927 <form method="POST" onSubmit="return submit_once()" |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2928 enctype="multipart/form-data"> |
| 1098 | 2929 |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2930 <table class="form"> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2931 <tr><th class="header" colspan="2">Category</th></tr> |
| 1098 | 2932 |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2933 <tr> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
2934 <th>Name</th> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2935 <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
|
2936 name</td> |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2937 </tr> |
| 1098 | 2938 |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2939 <tr> |
|
1829
4e4afbe3cd30
Move '<input type="hidden">' elements into a block.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1825
diff
changeset
|
2940 <td> |
|
4e4afbe3cd30
Move '<input type="hidden">' elements into a block.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1825
diff
changeset
|
2941 |
|
4e4afbe3cd30
Move '<input type="hidden">' elements into a block.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1825
diff
changeset
|
2942 <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
|
2943 </td> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2944 <td colspan="3" tal:content="structure context/submit"> |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2945 submit button will go here |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2946 </td> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2947 </tr> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2948 </table> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2949 </form> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2950 </td> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2951 </tal:block> |
| 1098 | 2952 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2953 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
|
2954 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
|
2955 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
|
2956 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
|
2957 |
| 1098 | 2958 |
| 2959 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
|
2960 :::::::::::::::::::::::::::::::: |
| 1098 | 2961 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2962 We now have the ability to create issues to our heart's content, but |
| 1098 | 2963 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
|
2964 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
|
2965 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
|
2966 is created. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2967 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2968 Just like ``category.issue.html``, this file defines a form which has a |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2969 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
|
2970 stuff, it is entirely up to your sense of aesthetics:: |
| 1098 | 2971 |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
2972 <th>Category</th> |
| 1098 | 2973 <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
|
2974 <span tal:replace="structure db/category/classhelp" /> |
| 1098 | 2975 </td> |
| 2976 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2977 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
|
2978 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
|
2979 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
|
2980 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
|
2981 issue). |
| 1098 | 2982 |
| 2983 The classhelp lines generate a link (labelled "list") to a popup window | |
| 2984 which contains the list of currently known categories. | |
| 2985 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2986 |
| 1098 | 2987 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
|
2988 ::::::::::::::::::::::: |
| 1098 | 2989 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2990 Now we can add categories, and create issues with categories. The next |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2991 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
|
2992 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
|
2993 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
|
2994 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
2995 If you look for "Search Issues" in the ``html/page.html`` file, you will |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2996 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
|
2997 ``<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
|
2998 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
|
2999 ``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
|
3000 change. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3001 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3002 If you look at this file it should begin to seem familiar, although it |
|
1730
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
3003 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
|
3004 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
|
3005 |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
3006 <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
|
3007 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
|
3008 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
|
3009 <th>Priority:</th> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
3010 <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
|
3011 <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
|
3012 <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
|
3013 <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
|
3014 </tr> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
3015 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3016 The definitions in the ``<tr>`` opening tag are used by the macros: |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3017 |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3018 - ``search_select`` expands to a drop-down box with all categories using |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3019 ``db_klass`` and ``db_content``. |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3020 - ``column_input`` expands to a checkbox for selecting what columns |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3021 should be displayed. |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3022 - ``sort_input`` expands to a radio button for selecting what property |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3023 should be sorted on. |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3024 - ``group_input`` expands to a radio button for selecting what property |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3025 should be grouped on. |
|
1730
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
3026 |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
3027 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
|
3028 |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
3029 <tr> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
3030 <th>Category:</th> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
3031 <td> |
| 1098 | 3032 <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
|
3033 <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
|
3034 <option value="">------------</option> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
3035 <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
|
3036 <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
|
3037 <option value="3">weave</option> |
| 1098 | 3038 </select> |
|
1730
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
3039 </td> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
3040 <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
|
3041 <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
|
3042 <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
|
3043 </tr> |
| 1098 | 3044 |
| 3045 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
|
3046 ::::::::::::::::::::::::::::::::::: |
| 1098 | 3047 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3048 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
|
3049 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
|
3050 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
|
3051 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
|
3052 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
|
3053 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3054 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
|
3055 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
|
3056 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
|
3057 forth. |
| 1098 | 3058 |
| 3059 Firstly we need to add an appropriate header to the start of the table:: | |
| 3060 | |
| 3061 <th tal:condition="request/show/category">Category</th> | |
| 3062 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3063 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
|
3064 Category column if the user has selected not to see it. |
| 1098 | 3065 |
| 3066 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
|
3067 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
|
3068 that every issue gets assigned to "i" in turn. |
| 1098 | 3069 |
| 3070 The new part of code to display the category will look like this:: | |
| 3071 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3072 <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
|
3073 tal:content="i/category"></td> |
| 1098 | 3074 |
| 3075 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
|
3076 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
|
3077 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
|
3078 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3079 Finally we have to edit ``html/page.html`` again. This time, we need to |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3080 tell it that when the user clicks on "Unassigned Issues" or "All Issues", |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3081 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
|
3082 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
|
3083 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
|
3084 tells roundup which fields of the issue to display. Simply add |
| 1098 | 3085 "category" to that list and it all should work. |
| 3086 | |
| 1262 | 3087 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
|
3088 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 1262 | 3089 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3090 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
|
3091 be able to give a summary of the total time spent on a particular issue. |
| 1262 | 3092 |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
3093 1. Add a new class to your tracker ``schema.py``:: |
| 1262 | 3094 |
| 3095 # storage for time logging | |
| 3096 timelog = Class(db, "timelog", period=Interval()) | |
| 3097 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3098 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
|
3099 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
|
3100 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3101 2. Link to the new class from your issue class (again, in |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
3102 ``schema.py``):: |
| 1262 | 3103 |
| 3104 issue = IssueClass(db, "issue", | |
| 3105 assignedto=Link("user"), topic=Multilink("keyword"), | |
| 3106 priority=Link("priority"), status=Link("status"), | |
| 3107 times=Multilink("timelog")) | |
| 3108 | |
| 3109 the "times" property is the new link to the "timelog" class. | |
| 3110 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3111 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
|
3112 interface we'll have a new entry field. This is a special field |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3113 because unlike the other fields in the ``issue.item`` template, it |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
3114 affects a different item (a timelog item) and not the template's |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3115 item (an issue). We have a special syntax for form fields that affect |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
3116 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
|
3117 documentation on `special form variables`_). In particular, we add a |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3118 field to capture a new timelog item's period:: |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
3119 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
3120 <tr> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
3121 <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
|
3122 <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
|
3123 <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
|
3124 </td> |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
3125 </tr> |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
3126 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
3127 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
|
3128 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
|
3129 like this:: |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
3130 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
3131 <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
|
3132 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
3133 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
|
3134 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
|
3135 added to it. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
3136 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3137 4. We want to display a total of the timelog times that have been |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3138 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
|
3139 some Python code, since it's beyond the scope of PageTemplates to |
| 2915 | 3140 perform such calculations. We do this by adding a module ``timespent.py`` |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3141 to the ``extensions`` directory in our tracker. The contents of this |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3142 file is as follows:: |
| 2915 | 3143 |
| 3144 def totalTimeSpent(times): | |
| 3145 ''' Call me with a list of timelog items (which have an | |
| 3146 Interval "period" property) | |
|
1270
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
3147 ''' |
| 2915 | 3148 total = Interval('0d') |
| 3149 for time in times: | |
| 3150 total += time.period._value | |
| 3151 return total | |
| 3152 | |
| 3153 def init(instance): | |
| 3154 instance.registerUtil('totalTimeSpent', totalTimeSpent) | |
| 3155 | |
| 3156 We will now be able to access the ``totalTimeSpent`` function via the | |
| 3157 ``utils`` variable in our templates, as shown in the next step. | |
|
1270
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
3158 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3159 5. Display the timelog for an issue:: |
| 1262 | 3160 |
| 3161 <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
|
3162 <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
|
3163 <tal:block |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3164 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
|
3165 </th></tr> |
| 1262 | 3166 <tr><th>Date</th><th>Period</th><th>Logged By</th></tr> |
| 3167 <tr tal:repeat="time context/times"> | |
| 3168 <td tal:content="time/creation"></td> | |
| 3169 <td tal:content="time/period"></td> | |
| 3170 <td tal:content="time/creator"></td> | |
| 3171 </tr> | |
| 3172 </table> | |
| 3173 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3174 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
|
3175 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
|
3176 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
|
3177 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
|
3178 and 40 minutes). |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3179 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3180 8. If you're using a persistent web server - ``roundup-server`` or |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3181 ``mod_python`` for example - then you'll need to restart that to pick up |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3182 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
|
3183 time logging interface. |
| 1262 | 3184 |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3185 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3186 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
|
3187 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3188 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3189 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
|
3190 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
|
3191 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
|
3192 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
|
3193 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3194 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
|
3195 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
|
3196 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
|
3197 |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
3198 2. Add the new issue class to your tracker's ``schema.py`` - in this |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3199 example, we're adding a "system support" class. Just after the "issue" |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3200 class definition, add:: |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3201 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3202 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
|
3203 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
|
3204 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
|
3205 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
|
3206 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3207 3. Copy the existing ``issue.*`` (item, search and index) templates in the |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3208 tracker's ``html`` to ``support.*``. Edit them so they use the properties |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3209 defined in the ``support`` class. Be sure to check for hidden form |
|
2159
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
3210 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
|
3211 required properties. |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
3212 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3213 4. Edit the modules in the ``detectors``, adding lines to their ``init`` |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3214 functions where appropriate. Look for ``audit`` and ``react`` registrations |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3215 on the ``issue`` class, and duplicate them for ``support``. |
|
2159
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
3216 |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
3217 5. Create a new sidebar box for the new support class. Duplicate the |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3218 existing issues one, changing the ``issue`` class name to ``support``. |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3219 |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3220 6. Re-start your tracker and start using the new ``support`` class. |
|
2159
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
3221 |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
3222 |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
3223 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
|
3224 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
|
3225 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
|
3226 |
|
2991
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
3227 db.security.addPermissionToRole('SysAdmin', 'View', 'support') |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
3228 db.security.addPermissionToRole('SysAdmin', 'Create', 'support') |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
3229 db.security.addPermissionToRole('SysAdmin', 'Edit', 'support') |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3230 |
|
2159
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
3231 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
|
3232 users, and add "SysAdmin" to their Roles list. |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
3233 |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
3234 Alternatively, you might want to change the Edit/View permissions granted |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3235 for the ``issue`` class so that it's only available to users with the "System" |
|
2159
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
3236 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
|
3237 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
|
3238 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3239 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3240 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
|
3241 ----------------------------- |
|
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 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
|
3244 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3245 |
|
3229
5ce9c9a1399d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3131
diff
changeset
|
3246 .. note:: You will need to either have an "admin" user in your external |
|
5ce9c9a1399d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3131
diff
changeset
|
3247 password source *or* have one of your regular users have |
|
5ce9c9a1399d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3131
diff
changeset
|
3248 the Admin Role assigned. If you need to assign the Role *after* |
|
5ce9c9a1399d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3131
diff
changeset
|
3249 making the changes below, you may use the ``roundup-admin`` |
|
5ce9c9a1399d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3131
diff
changeset
|
3250 program to edit a user's details. |
|
5ce9c9a1399d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3131
diff
changeset
|
3251 |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3252 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
|
3253 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
|
3254 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
|
3255 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
|
3256 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
|
3257 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
|
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 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
|
3260 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3261 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
|
3262 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
|
3263 need to override the standard ``verifyPassword`` method defined in |
| 2915 | 3264 ``roundup.cgi.actions.LoginAction`` and register the new class. The |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3265 following is added as ``externalpassword.py`` in the tracker ``extensions`` |
| 2915 | 3266 directory:: |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3267 |
|
3229
5ce9c9a1399d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3131
diff
changeset
|
3268 import os, crypt |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3269 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
|
3270 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3271 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
|
3272 def verifyPassword(self, userid, password): |
| 2915 | 3273 '''Look through the file, line by line, looking for a |
| 3274 name that matches. | |
| 3275 ''' | |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3276 # 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
|
3277 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
|
3278 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3279 # 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
|
3280 # 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
|
3281 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
|
3282 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3283 # 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
|
3284 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
|
3285 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
|
3286 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
|
3287 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
|
3288 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3289 # 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
|
3290 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
|
3291 |
| 2915 | 3292 def init(instance): |
| 3293 instance.registerAction('login', ExternalPasswordLoginAction) | |
| 3294 | |
| 3295 You should also remove the redundant password fields from the ``user.item`` | |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3296 template. |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3297 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3298 |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3299 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
|
3300 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3301 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3302 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
|
3303 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
|
3304 and primary user group. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3305 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3306 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
|
3307 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
|
3308 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
|
3309 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
|
3310 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
|
3311 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3312 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
|
3313 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
|
3314 described in the previous example, `using an external password |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3315 validation source`_. We keep the user lists in sync using a fairly |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3316 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
|
3317 immediate access is needed. In short, it: |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3318 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3319 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
|
3320 2. compares that list to the current roundup user list: |
|
1299
b2d04ce03802
Email improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
1293
diff
changeset
|
3321 |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3322 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
|
3323 b. entries with mismatching real names are *updated* |
| 1293 | 3324 c. entries only exist in the passwd file are *created* |
|
1299
b2d04ce03802
Email improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
1293
diff
changeset
|
3325 |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3326 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
|
3327 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3328 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
|
3329 to ``retire()`` or ``set()``. The creation operation requires more |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3330 information though - the user's email address and their Roundup Roles. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3331 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
|
3332 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
|
3333 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
|
3334 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
|
3335 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3336 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
|
3337 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
|
3338 tracker we're to work on:: |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3339 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3340 import sys, os, smtplib |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3341 from roundup import instance, date |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3342 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3343 # open the tracker |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3344 tracker_home = sys.argv[1] |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3345 tracker = instance.open(tracker_home) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3346 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3347 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
|
3348 |
|
3229
5ce9c9a1399d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3131
diff
changeset
|
3349 # read in the users from the "passwd.txt" file |
|
5ce9c9a1399d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3131
diff
changeset
|
3350 file = os.path.join(tracker_home, 'passwd.txt') |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3351 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
|
3352 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3353 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
|
3354 appear in the file):: |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3355 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3356 # 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
|
3357 # "real" users |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3358 ignore = ['ekmmon', 'bfast', 'csrmail'] |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3359 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3360 # 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
|
3361 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
|
3362 'cs_pool', 'anonymous', 'system_pool', 'automated'] |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3363 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3364 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
|
3365 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3366 roles = { |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3367 '501': 'User,Tech', # tech |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3368 '502': 'User', # finance |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3369 '503': 'User,CSR', # customer service reps |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3370 '504': 'User', # sales |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3371 '505': 'User', # marketing |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3372 } |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3373 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3374 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
|
3375 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
|
3376 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
|
3377 now do all the work:: |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3378 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3379 # open the database |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3380 db = tracker.open('admin') |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3381 try: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3382 # 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
|
3383 msg = [] |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3384 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3385 # 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
|
3386 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
|
3387 if user in ignore: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3388 # this user shouldn't appear in our tracker |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3389 continue |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3390 keep.append(user) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3391 try: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3392 # see if the user exists in the tracker |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3393 uid = db.user.lookup(user) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3394 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3395 # 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
|
3396 if real != db.user.get(uid, 'realname'): |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3397 db.user.set(uid, realname=real) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3398 msg.append('FIX %s - %s'%(user, real)) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3399 except KeyError: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3400 # nope, the user doesn't exist |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3401 db.user.create(username=user, realname=real, |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3402 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
|
3403 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
|
3404 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3405 # 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
|
3406 # "keep" list - retire those who aren't |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3407 for uid in db.user.list(): |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3408 user = db.user.get(uid, 'username') |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3409 if user not in keep: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3410 db.user.retire(uid) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3411 msg.append('RET %s'%user) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3412 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3413 # 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
|
3414 if msg: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3415 # create the email |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3416 msg = '''Subject: %s user database maintenance |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3417 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3418 %s |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3419 '''%(db.config.TRACKER_NAME, '\n'.join(msg)) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3420 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3421 # send the email |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3422 smtp = smtplib.SMTP(db.config.MAILHOST) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3423 addr = db.config.ADMIN_EMAIL |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3424 smtp.sendmail(addr, addr, msg) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3425 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3426 # now we're done - commit the changes |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3427 db.commit() |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3428 finally: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3429 # always close the database cleanly |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3430 db.close() |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3431 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3432 And that's it! |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3433 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3434 |
|
1680
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3435 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
|
3436 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
1680
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3437 |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3438 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
|
3439 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
|
3440 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
|
3441 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
|
3442 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
|
3443 for more information about doing this. |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3444 |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3445 To authenticate off the LDAP store (rather than using the passwords in the |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3446 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
|
3447 extension to the cgi interface. You'd do this by overriding the method called |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3448 ``verifyPassword`` on the ``LoginAction`` class in your tracker's |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3449 ``extensions`` directory (see `using an external password validation |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3450 source`_). The method is implemented by default as:: |
|
1680
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3451 |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3452 def verifyPassword(self, userid, password): |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3453 ''' Verify the password that the user has supplied |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3454 ''' |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3455 stored = self.db.user.get(self.userid, 'password') |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3456 if password == stored: |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3457 return 1 |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3458 if not password and not stored: |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3459 return 1 |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3460 return 0 |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3461 |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3462 So you could reimplement this as something like:: |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3463 |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3464 def verifyPassword(self, userid, password): |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3465 ''' Verify the password that the user has supplied |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3466 ''' |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3467 # 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
|
3468 username = self.db.user.get(self.userid, 'username') |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3469 # 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
|
3470 |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
3471 |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3472 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
|
3473 ---------------------------- |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3474 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3475 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
|
3476 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3477 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3478 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
|
3479 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
|
3480 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
|
3481 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3482 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
|
3483 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3484 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
|
3485 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
|
3486 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
|
3487 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
|
3488 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
|
3489 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
|
3490 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
|
3491 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3492 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
|
3493 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
|
3494 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3495 <tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3496 <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
|
3497 <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
|
3498 </tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3499 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3500 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
|
3501 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
|
3502 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3503 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
|
3504 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
|
3505 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
|
3506 # 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
|
3507 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
|
3508 try: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3509 # 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
|
3510 sendto = [] |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3511 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
|
3512 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
|
3513 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
|
3514 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
|
3515 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3516 # 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
|
3517 # 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
|
3518 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
|
3519 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3520 # 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
|
3521 # 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
|
3522 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
|
3523 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
|
3524 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
|
3525 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
|
3526 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3527 # 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
|
3528 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
|
3529 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
|
3530 # 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
|
3531 # 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
|
3532 # 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
|
3533 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
|
3534 continue |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3535 # 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
|
3536 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
|
3537 # 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
|
3538 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
|
3539 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
|
3540 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3541 # 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
|
3542 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
|
3543 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
|
3544 else: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3545 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
|
3546 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3547 # 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
|
3548 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
|
3549 # 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
|
3550 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
|
3551 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
|
3552 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3553 # 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
|
3554 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
|
3555 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3556 # 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
|
3557 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
|
3558 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3559 # 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
|
3560 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
|
3561 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
|
3562 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
|
3563 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3564 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
|
3565 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
|
3566 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3567 # 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
|
3568 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
|
3569 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3570 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
|
3571 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3572 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
|
3573 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3574 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3575 Sometimes tracker admins want to control the states to which users may |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3576 move issues. You can do this by following these steps: |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3577 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3578 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
|
3579 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
|
3580 template:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3581 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3582 <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
|
3583 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3584 This will force users to select a status. |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3585 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3586 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
|
3587 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3588 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
|
3589 ...) |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3590 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3591 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
|
3592 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3593 a. through the web using the class list -> status class editor, or |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3594 b. using the ``roundup-admin`` "set" command. |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3595 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3596 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
|
3597 ``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
|
3598 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3599 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
|
3600 ''' 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
|
3601 property. |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3602 ''' |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3603 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
|
3604 return |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3605 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
|
3606 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
|
3607 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
|
3608 return |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3609 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
|
3610 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
|
3611 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
|
3612 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
|
3613 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3614 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
|
3615 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
|
3616 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3617 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
|
3618 from:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3619 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3620 <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
|
3621 <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
|
3622 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3623 to:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3624 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3625 <th>Status</th> |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3626 <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
|
3627 <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
|
3628 <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
|
3629 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
|
3630 <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
|
3631 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
|
3632 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
|
3633 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
|
3634 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
|
3635 </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
|
3636 </select> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3637 <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
|
3638 tal:replace="structure context/status/menu" /> |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
3639 </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
|
3640 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3641 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
|
3642 |
| 1262 | 3643 |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3644 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
|
3645 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3646 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3647 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
|
3648 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
|
3649 resolved. To achieve this: |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3650 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3651 1. Create a new property on the ``issue`` class: |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3652 ``blockers=Multilink("issue")``. To do this, edit the definition of |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3653 this class in your tracker's ``schema.py`` file. Change this:: |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3654 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3655 issue = IssueClass(db, "issue", |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3656 assignedto=Link("user"), topic=Multilink("keyword"), |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3657 priority=Link("priority"), status=Link("status")) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3658 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3659 to this, adding the blockers entry:: |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3660 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3661 issue = IssueClass(db, "issue", |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3662 blockers=Multilink("issue"), |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3663 assignedto=Link("user"), topic=Multilink("keyword"), |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3664 priority=Link("priority"), status=Link("status")) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3665 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3666 2. Add the new ``blockers`` property to the ``issue.item.html`` edit |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3667 page, using something like:: |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3668 |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
3669 <th>Waiting On</th> |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3670 <td> |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3671 <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
|
3672 size=20)" /> |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3673 <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
|
3674 <span tal:condition="context/blockers" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3675 tal:repeat="blk context/blockers"> |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3676 <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
|
3677 tal:content="blk/id"></a> |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3678 </span> |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3679 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3680 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
|
3681 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
|
3682 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
|
3683 the "superseders" field. |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3684 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3685 3. Create a new detector module (see below) which enforces the rules: |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3686 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3687 - 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
|
3688 - 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
|
3689 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3690 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
|
3691 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3692 def blockresolution(db, cl, nodeid, newvalues): |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3693 ''' 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
|
3694 ''' |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3695 if nodeid is None: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3696 blockers = [] |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3697 else: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3698 blockers = cl.get(nodeid, 'blockers') |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3699 blockers = newvalues.get('blockers', blockers) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3700 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3701 # 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
|
3702 # changed |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3703 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
|
3704 return |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3705 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3706 # get the resolved state ID |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3707 resolved_id = db.status.lookup('resolved') |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3708 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3709 # format the info |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3710 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
|
3711 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
|
3712 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
|
3713 if len(blockers) == 1: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3714 s = 'issue %s is'%s |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3715 else: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3716 s = 'issues %s are'%s |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3717 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3718 # 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
|
3719 if newvalues['status'] == resolved_id: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3720 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
|
3721 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3722 def resolveblockers(db, cl, nodeid, newvalues): |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3723 ''' 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
|
3724 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
|
3725 ''' |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3726 if not newvalues.has_key('status'): |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3727 return |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3728 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3729 # get the resolved state ID |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3730 resolved_id = db.status.lookup('resolved') |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3731 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3732 # interesting? |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3733 if newvalues['status'] != resolved_id: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3734 return |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3735 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3736 # 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
|
3737 # their blockers list |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3738 issues = cl.find(blockers=nodeid) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3739 for issueid in issues: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3740 blockers = cl.get(issueid, 'blockers') |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3741 if nodeid in blockers: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3742 blockers.remove(nodeid) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3743 cl.set(issueid, blockers=blockers) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3744 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3745 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3746 def init(db): |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3747 # 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
|
3748 db.issue.audit('create', blockresolution) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3749 db.issue.audit('set', blockresolution) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3750 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3751 # can only happen on a set |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3752 db.issue.react('set', resolveblockers) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3753 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3754 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
|
3755 "detectors" directory. |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3756 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3757 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
|
3758 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
|
3759 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
|
3760 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
|
3761 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
|
3762 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3763 <a href="issue?@sort=-activity&@group=priority&@filter=status& |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3764 @columns=id,activity,title,creator,assignedto,status& |
| 2409 | 3765 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
|
3766 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3767 modify it to add the "blockers" info to the URL (note, both the |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3768 "@filter" *and* "blockers" values must be specified)@@ |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3769 |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3770 <a href="issue?@sort=-activity&@group=priority&@filter=status,blockers& |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3771 blockers=-1&@columns=id,activity,title,creator,assignedto,status& |
| 2409 | 3772 status=-1,1,2,3,4,5,6,7">Show All</a><br> |
| 3773 | |
|
3039
70c9954f619f
formatting fixes
Richard Jones <richard@users.sourceforge.net>
parents:
3037
diff
changeset
|
3774 The above examples are line-wrapped on the trailing & and should |
|
70c9954f619f
formatting fixes
Richard Jones <richard@users.sourceforge.net>
parents:
3037
diff
changeset
|
3775 be unwrapped. |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3776 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3777 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
|
3778 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
|
3779 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
|
3780 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
|
3781 another issue's "blockers" property. |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3782 |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3783 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
|
3784 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3785 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3786 Let's say we need the ability to automatically add users to the nosy |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3787 list based |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3788 on the occurance of a topic. Every user should be allowed to edit their |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3789 own list of topics for which they want to be added to the nosy list. |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3790 |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3791 Below, we'll show that this change can be done with minimal |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3792 understanding of the Roundup system, using only copy and paste. |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3793 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3794 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
|
3795 allow per-user recording of the lists of topics for which he wants to |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3796 be put on the nosy list, a change in the user view allowing them to edit |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3797 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
|
3798 list when a topic is set. |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3799 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3800 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
|
3801 :::::::::::::::::::::::::: |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3802 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3803 The change to make in the database, is that for any user there should be |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3804 a list of topics for which he wants to be put on the nosy list. Adding |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3805 a ``Multilink`` of ``keyword`` seems to fullfill this (note that within |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3806 the code, topics are called ``keywords``.) As such, all that has to be |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3807 done is to add a new field to the definition of ``user`` within the |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
3808 file ``schema.py``. We will call this new field ``nosy_keywords``, and |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3809 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
|
3810 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3811 user = Class(db, "user", |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3812 username=String(), password=Password(), |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3813 address=String(), realname=String(), |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3814 phone=String(), organisation=String(), |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3815 alternate_addresses=String(), |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3816 queries=Multilink('query'), roles=String(), |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3817 timezone=String(), |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3818 nosy_keywords=Multilink('keyword')) |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3819 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3820 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
|
3821 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3822 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3823 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
|
3824 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
|
3825 to the user view, as is generated by the file ``html/user.item.html``. |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3826 We can easily |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3827 see that the topic field in the issue view has very similar editing |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3828 requirements as our nosy topics, both being lists of topics. As |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3829 such, we look for Topics in ``issue.item.html``, and extract the |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3830 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
|
3831 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
|
3832 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
|
3833 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3834 <tr> |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3835 <th>Nosy Topics</th> |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3836 <td> |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3837 <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
|
3838 <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
|
3839 </td> |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3840 </tr> |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3841 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3842 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3843 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
|
3844 :::::::::::::::::::::::::::::::::::::::::::::: |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3845 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3846 The more difficult part is the logic to add |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3847 the users to the nosy list when required. |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3848 We choose to perform this action whenever the topics on an |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3849 item are set (this includes the creation of items). |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3850 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
|
3851 ``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
|
3852 ``detectors/nosy_keyword_reaction.py``. |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3853 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
|
3854 to the nosy list. A look through the code reveals that the |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3855 ``nosyreaction`` function actually sends the e-mail. |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3856 We don't need this. Therefore, we can change the ``init`` function to:: |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3857 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3858 def init(db): |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3859 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
|
3860 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
|
3861 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3862 After that, we rename the ``updatenosy`` function to ``update_kw_nosy``. |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3863 The first two blocks of code in that function relate to setting |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3864 ``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
|
3865 functionality is left in the new auditor. The following block of |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3866 code, which handled adding the assignedto user(s) to the nosy list in |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3867 ``updatenosy``, should be replaced by a block of code to add the |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3868 interested users to the nosy list. We choose here to loop over all |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3869 new topics, than looping over all users, |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3870 and assign the user to the nosy list when the topic occurs in the user's |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3871 ``nosy_keywords``. The next part in ``updatenosy`` -- adding the author |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3872 and/or recipients of a message to the nosy list -- is obviously not |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3873 relevant here and is thus deleted from the new auditor. The last |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3874 part, copying the new nosy list to ``newvalues``, can stay as is. |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3875 This results in the following function:: |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3876 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3877 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
|
3878 '''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
|
3879 ''' |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3880 # 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
|
3881 current = {} |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3882 if nodeid is None: |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3883 ok = ('new', 'yes') |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3884 else: |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3885 ok = ('yes',) |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3886 # 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
|
3887 # changed |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3888 if not newvalues.has_key('nosy'): |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3889 nosy = cl.get(nodeid, 'nosy') |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3890 for value in nosy: |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3891 if not current.has_key(value): |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3892 current[value] = 1 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3893 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3894 # 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
|
3895 if newvalues.has_key('nosy'): |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3896 nosy = newvalues.get('nosy', []) |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3897 for value in nosy: |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3898 if not db.hasnode('user', value): |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3899 continue |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3900 if not current.has_key(value): |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3901 current[value] = 1 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3902 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3903 # 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
|
3904 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
|
3905 topic_ids = newvalues['topic'] |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3906 for topic in topic_ids: |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3907 # loop over all users, |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3908 # 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
|
3909 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
|
3910 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
|
3911 found = 0 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3912 for kw in nosy_kw: |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3913 if kw == topic: |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3914 found = 1 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3915 if found: |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3916 current[user_id] = 1 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3917 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3918 # 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
|
3919 newvalues['nosy'] = current.keys() |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3920 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3921 These two function are the only ones needed in the file. |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3922 |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3923 TODO: update this example to use the ``find()`` Class method. |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3924 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3925 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
|
3926 ::::::: |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3927 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3928 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
|
3929 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3930 Multiple additions |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3931 When a user, after automatic selection, is manually removed |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3932 from the nosy list, he is added to the nosy list again when the |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3933 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
|
3934 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
|
3935 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
|
3936 interest on a new topic. |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3937 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3938 The code could also be changed to only trigger on the ``create()`` |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3939 event, rather than also on the ``set()`` event, thus only setting |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3940 the nosy list when the issue is created. |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3941 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3942 Scalability |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3943 In the auditor, there is a loop over all users. For a site with |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3944 only few users this will pose no serious problem; however, with |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3945 many users this will be a serious performance bottleneck. |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3946 A way out would be to link from the topics to the users who |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3947 selected these topics as nosy topics. This will eliminate the |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
3948 loop over all users. |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
3949 |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3950 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
|
3951 ----------------------------------- |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3952 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3953 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
|
3954 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3955 |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
3956 1. In your tracker's ``schema.py``, create a new Role, say "Developer":: |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3957 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3958 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
|
3959 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3960 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
|
3961 "issue":: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3962 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3963 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
|
3964 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
|
3965 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3966 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
|
3967 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3968 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
|
3969 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3970 4. In the issue item edit page (``html/issue.item.html`` in your tracker |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3971 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
|
3972 list:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3973 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3974 <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
|
3975 <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
|
3976 <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
|
3977 <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
|
3978 '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
|
3979 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
|
3980 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
|
3981 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
|
3982 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
|
3983 </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
|
3984 </select> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3985 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3986 For extra security, you may wish to setup an auditor to enforce the |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3987 Permission requirement (install this as ``assignedtoFixer.py`` in your |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3988 tracker ``detectors`` directory):: |
|
2156
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 def assignedtoMustBeFixer(db, cl, nodeid, newvalues): |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
3991 ''' Ensure the assignedto value in newvalues is used with the |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3992 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
|
3993 ''' |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3994 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
|
3995 # 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
|
3996 return |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3997 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
3998 # 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
|
3999 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
|
4000 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
|
4001 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
|
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 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
|
4004 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
|
4005 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
|
4006 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4007 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
|
4008 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
|
4009 |
|
3124
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
4010 |
|
1954
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
4011 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
|
4012 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
1954
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
4013 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
4014 In this case, users registering themselves are granted Provisional |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
4015 access, meaning they |
|
1954
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
4016 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
|
4017 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
|
4018 and has limited access. One of the Permissions they have is the new "Edit |
|
3124
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
4019 Own" on issues (regular users have "Edit".) |
|
1954
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
4020 |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
4021 First up, we create the new Role and Permission structure in |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
4022 ``schema.py``:: |
|
1954
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
4023 |
|
3124
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
4024 # |
|
1954
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
4025 # New users not approved by the admin |
|
3124
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
4026 # |
|
1954
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
4027 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
|
4028 description='New user registered via web or email') |
|
2991
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
4029 |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
4030 # These users need to be able to view and create issues but only edit |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
4031 # and view their own |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
4032 db.security.addPermissionToRole('Provisional User', 'Create', 'issue') |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
4033 def own_issue(db, userid, itemid): |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
4034 '''Determine whether the userid matches the creator of the issue.''' |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
4035 return userid == db.issue.get(itemid, 'creator') |
|
3080
abdeb9b0e53a
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3039
diff
changeset
|
4036 p = db.security.addPermission(name='Edit', klass='issue', |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
4037 check=own_issue, description='Can only edit own issues') |
|
1954
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
4038 db.security.addPermissionToRole('Provisional User', p) |
|
3080
abdeb9b0e53a
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3039
diff
changeset
|
4039 p = db.security.addPermission(name='View', klass='issue', |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
4040 check=own_issue, description='Can only view own issues') |
|
1954
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
4041 db.security.addPermissionToRole('Provisional User', p) |
|
2991
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
4042 |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
4043 # Assign the Permissions for issue-related classes |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
4044 for cl in 'file', 'msg', 'query', 'keyword': |
|
3124
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
4045 db.security.addPermissionToRole('Provisional User', 'View', cl) |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
4046 db.security.addPermissionToRole('Provisional User', 'Edit', cl) |
|
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
4047 db.security.addPermissionToRole('Provisional User', 'Create', cl) |
|
2991
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
4048 for cl in 'priority', 'status': |
|
3124
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
4049 db.security.addPermissionToRole('Provisional User', 'View', cl) |
|
1954
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
4050 |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
4051 # and give the new users access to the web and email interface |
|
2991
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
4052 db.security.addPermissionToRole('Provisional User', 'Web Access') |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
4053 db.security.addPermissionToRole('Provisional User', 'Email Access') |
|
1954
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
4054 |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
4055 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
4056 Then, in ``config.ini``, we change the Role assigned to newly-registered |
|
1954
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
4057 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
|
4058 |
|
2921
ad4fb8a14a97
more doc updates, not so many TODOs any more
Richard Jones <richard@users.sourceforge.net>
parents:
2915
diff
changeset
|
4059 [main] |
|
ad4fb8a14a97
more doc updates, not so many TODOs any more
Richard Jones <richard@users.sourceforge.net>
parents:
2915
diff
changeset
|
4060 ... |
|
ad4fb8a14a97
more doc updates, not so many TODOs any more
Richard Jones <richard@users.sourceforge.net>
parents:
2915
diff
changeset
|
4061 new_web_user_roles = 'Provisional User' |
|
ad4fb8a14a97
more doc updates, not so many TODOs any more
Richard Jones <richard@users.sourceforge.net>
parents:
2915
diff
changeset
|
4062 new_email_user_roles = 'Provisional User' |
|
1954
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
4063 |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
4064 |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4065 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
|
4066 --------------------------------- |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4067 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4068 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
|
4069 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4070 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
4071 Add a column to the ``item.index.html`` template. |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4072 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4073 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
|
4074 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4075 <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
|
4076 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
|
4077 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4078 "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
|
4079 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4080 <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
|
4081 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
|
4082 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
4083 ... and so on. |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4084 |
|
1966
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
4085 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
|
4086 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
1966
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
4087 |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
4088 A simple ``tal:attributes`` statement will do the bulk of the work here. In |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
4089 the ``issue.index.html`` template, add this to the ``<tr>`` that |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
4090 displays the rows of data:: |
|
1966
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
4091 |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
4092 <tr tal:attributes="class string:priority-${i/priority/plain}"> |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
4093 |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
4094 and then in your stylesheet (``style.css``) specify the colouring for the |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
4095 different priorities, as follows:: |
|
1966
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
4096 |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
4097 tr.priority-critical td { |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
4098 background-color: red; |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
4099 } |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
4100 |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
4101 tr.priority-urgent td { |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
4102 background-color: orange; |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
4103 } |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
4104 |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
4105 and so on, with far less offensive colours :) |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
4106 |
|
2009
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4107 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
|
4108 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
2009
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4109 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4110 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
|
4111 ``issue.item.html``: |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4112 |
|
2726
aa95c79cff8b
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2589
diff
changeset
|
4113 1. add a form around the listing table (separate from the existing |
|
aa95c79cff8b
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2589
diff
changeset
|
4114 index-page form), so at the top it reads:: |
|
2009
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4115 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4116 <form method="POST" tal:attributes="action request/classname"> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4117 <table class="list"> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4118 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4119 and at the bottom of that table:: |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4120 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4121 </table> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4122 </form |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4123 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4124 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
|
4125 navigation table or the subsequent form table. |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4126 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4127 2. in the display for the issue property, change:: |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4128 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4129 <td tal:condition="request/show/status" |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4130 tal:content="python:i.status.plain() or default"> </td> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4131 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4132 to:: |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4133 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4134 <td tal:condition="request/show/status" |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4135 tal:content="structure i/status/field"> </td> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4136 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4137 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
|
4138 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
4139 3. after the ``tal:block`` which lists the index items (marked by |
|
2009
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4140 ``tal:repeat="i batch"``) add a new table row:: |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4141 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4142 <tr> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4143 <td tal:attributes="colspan python:len(request.columns)"> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4144 <input type="submit" value=" Save Changes "> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4145 <input type="hidden" name="@action" value="edit"> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4146 <tal:block replace="structure request/indexargs_form" /> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4147 </td> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4148 </tr> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4149 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4150 which gives us a submit button, indicates that we are performing an edit |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
4151 on any changed statuses. The final ``tal:block`` will make sure that the |
|
2009
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4152 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
|
4153 rendering the next page (the results of the editing). |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
4154 |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4155 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4156 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
|
4157 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4158 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
4159 Alter the ``issue.item`` template section for messages to:: |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4160 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4161 <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
|
4162 <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
|
4163 <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
|
4164 <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
|
4165 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
|
4166 <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
|
4167 <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
|
4168 <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
|
4169 <td> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4170 <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
|
4171 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
|
4172 </td> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4173 </tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4174 </table> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4175 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4176 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4177 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
|
4178 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4179 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4180 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
|
4181 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
|
4182 our template alongside the summary display, and then introduce a switch |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
4183 that shows either the one or the other. We'll use a new form variable, |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4184 ``@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
|
4185 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4186 <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
|
4187 <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
|
4188 <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
|
4189 <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
|
4190 <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
|
4191 </th> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4192 </tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4193 <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
|
4194 <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
|
4195 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
|
4196 <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
|
4197 <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
|
4198 <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
|
4199 <td> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4200 <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
|
4201 </td> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4202 </tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4203 </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
|
4204 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4205 <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
|
4206 <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
|
4207 <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
|
4208 <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
|
4209 </th> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4210 </tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4211 <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
|
4212 <tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4213 <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
|
4214 <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
|
4215 <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
|
4216 (<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
|
4217 </th> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4218 </tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4219 <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
|
4220 </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
|
4221 </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
|
4222 </table> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4223 |
|
3124
8b0669b96c8d
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3120
diff
changeset
|
4224 |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4225 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
|
4226 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4227 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4228 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
|
4229 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
|
4230 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
|
4231 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
|
4232 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
|
4233 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4234 <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
|
4235 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
|
4236 <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
|
4237 <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
|
4238 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4239 <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
|
4240 <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
|
4241 <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
|
4242 </form> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4243 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4244 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
|
4245 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
|
4246 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4247 <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
|
4248 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
|
4249 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
|
4250 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
|
4251 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4252 <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
|
4253 <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
|
4254 <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
|
4255 . |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4256 . |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4257 . |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4258 </form> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4259 |
|
3131
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
4260 Note that later in the form, I use the value of "cat" to decide which |
|
96086801bd61
merge from HEAD
Richard Jones <richard@users.sourceforge.net>
parents:
3128
diff
changeset
|
4261 form elements should be displayed. For example:: |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4262 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4263 <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
|
4264 <tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4265 <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
|
4266 <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
|
4267 </tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4268 <tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4269 <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
|
4270 <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
|
4271 </tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4272 </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
|
4273 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4274 ... 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
|
4275 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
|
4276 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4277 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
|
4278 usually to validate user choices and determine what page is next. Now encode |
| 2915 | 4279 those actions in a new ``Action`` class (see `defining new web actions`_):: |
| 4280 | |
| 4281 from roundup.cgi.actions import Action | |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4282 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4283 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
|
4284 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
|
4285 ''' 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
|
4286 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
|
4287 ''' |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4288 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
|
4289 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
|
4290 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
|
4291 return |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4292 # 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
|
4293 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
|
4294 |
| 2915 | 4295 def init(instance): |
| 4296 instance.registerAction('page1_submit', Page1SubmitAction) | |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4297 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4298 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
|
4299 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
|
4300 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4301 |
| 1098 | 4302 ------------------- |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
4303 |
|
686
c52122f38c9b
Documentation cleanup, added info for potential (and current) developers
Richard Jones <richard@users.sourceforge.net>
parents:
684
diff
changeset
|
4304 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
|
4305 |
|
c52122f38c9b
Documentation cleanup, added info for potential (and current) developers
Richard Jones <richard@users.sourceforge.net>
parents:
684
diff
changeset
|
4306 .. _`Table of Contents`: index.html |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
4307 .. _`design documentation`: design.html |
|
2572
d15b71b8a85a
more logging goodness
Richard Jones <richard@users.sourceforge.net>
parents:
2540
diff
changeset
|
4308 .. _`admin guide`: admin_guide.html |
|
d15b71b8a85a
more logging goodness
Richard Jones <richard@users.sourceforge.net>
parents:
2540
diff
changeset
|
4309 |
