Mercurial > p > roundup > code
annotate doc/customizing.txt @ 7294:114a78ba67a5
Typo fix.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Tue, 02 May 2023 19:29:46 -0400 |
| parents | b97d6a4fba85 |
| children | f25f47c3c624 |
| rev | line source |
|---|---|
|
6586
24e2eeb2ed9a
Add meta description to some doc pages.
John Rouillard <rouilj@ieee.org>
parents:
6583
diff
changeset
|
1 .. meta:: |
|
6774
e7b4ad2c57ac
landmarks, skiplink, remove bad attrs, autocomplete search
John Rouillard <rouilj@ieee.org>
parents:
6752
diff
changeset
|
2 :description: |
|
6586
24e2eeb2ed9a
Add meta description to some doc pages.
John Rouillard <rouilj@ieee.org>
parents:
6583
diff
changeset
|
3 How to customize and extend the Roundup Issue |
|
24e2eeb2ed9a
Add meta description to some doc pages.
John Rouillard <rouilj@ieee.org>
parents:
6583
diff
changeset
|
4 Tracker. Includes many cookbook and how-to |
|
24e2eeb2ed9a
Add meta description to some doc pages.
John Rouillard <rouilj@ieee.org>
parents:
6583
diff
changeset
|
5 examples. Reference for the design and internals |
|
24e2eeb2ed9a
Add meta description to some doc pages.
John Rouillard <rouilj@ieee.org>
parents:
6583
diff
changeset
|
6 needed to understand and extend the examples to meet |
|
24e2eeb2ed9a
Add meta description to some doc pages.
John Rouillard <rouilj@ieee.org>
parents:
6583
diff
changeset
|
7 new needs. |
|
24e2eeb2ed9a
Add meta description to some doc pages.
John Rouillard <rouilj@ieee.org>
parents:
6583
diff
changeset
|
8 |
|
4033
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
3968
diff
changeset
|
9 :tocdepth: 2 |
|
bca7c59ac400
Enhance documentation generation.
Stefan Seefeld <stefan@seefeld.name>
parents:
3968
diff
changeset
|
10 |
|
1215
f83efa574177
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1214
diff
changeset
|
11 =================== |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
12 Customising Roundup |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
13 =================== |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
14 |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
15 .. 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
|
16 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
|
17 |
|
c52122f38c9b
Documentation cleanup, added info for potential (and current) developers
Richard Jones <richard@users.sourceforge.net>
parents:
684
diff
changeset
|
18 .. contents:: |
|
4888
b07014d6a7aa
docs: Fix table of contents on customizing page
anatoly techtonik <techtonik@gmail.com>
parents:
4880
diff
changeset
|
19 :depth: 2 |
|
b07014d6a7aa
docs: Fix table of contents on customizing page
anatoly techtonik <techtonik@gmail.com>
parents:
4880
diff
changeset
|
20 :local: |
|
686
c52122f38c9b
Documentation cleanup, added info for potential (and current) developers
Richard Jones <richard@users.sourceforge.net>
parents:
684
diff
changeset
|
21 |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
22 What You Can Do |
| 1098 | 23 =============== |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
24 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
25 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
|
26 `design documentation`_. |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
27 |
|
1850
6e80f8f760a4
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1832
diff
changeset
|
28 Customisation of Roundup can take one of six forms: |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
29 |
|
3276
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
30 1. `tracker configuration`_ changes |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
31 2. database, or `tracker schema`_ changes |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
32 3. "definition" class `database content`_ changes |
|
5980
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
33 4. behavioural changes through detectors_, extensions_ and interfaces.py_ |
|
2003
a291bf753037
maintenance -> admin guide
Richard Jones <richard@users.sourceforge.net>
parents:
1998
diff
changeset
|
34 5. `security / access controls`_ |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
35 6. change the `web interface`_ |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
36 |
|
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
37 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
|
38 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
|
39 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
|
40 includes adding or removing properties from classes. |
|
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
41 |
|
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
42 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
43 Trackers in a Nutshell |
| 1098 | 44 ====================== |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
45 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
46 Trackers have the following structure: |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
47 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
48 .. index:: |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
49 single: tracker; structure db directory |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
50 single: tracker; structure detectors directory |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
51 single: tracker; structure extensions directory |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
52 single: tracker; structure html directory |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
53 single: tracker; structure html directory |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
54 single: tracker; structure lib directory |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
55 |
| 1098 | 56 =================== ======================================================== |
| 57 Tracker File Description | |
| 58 =================== ======================================================== | |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
59 config.ini Holds the basic `tracker configuration`_ |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
60 schema.py Holds the `tracker schema`_ |
|
2921
ad4fb8a14a97
more doc updates, not so many TODOs any more
Richard Jones <richard@users.sourceforge.net>
parents:
2915
diff
changeset
|
61 initial_data.py Holds any data to be entered into the database when the |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
62 tracker is initialised (optional) |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
63 interfaces.py Allows `modifying the core of Roundup`_ (optional) |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
64 db/ Holds the tracker's database |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
65 db/files/ Holds the tracker's upload files and messages |
|
6160
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
66 db/backend_name Names the database back-end for the tracker (obsolete). |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
67 Use the ``backend`` setting in the ``[rdbms]`` |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
68 section of ``config.ini`` instead. |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
69 detectors/ `Auditors and reactors`_ for this tracker |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
70 extensions/ Additional `actions`_ and `templating utilities`_ |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
71 html/ Web interface templates, images and style sheets |
|
3772
13e8825da493
Documentation update for common lib directory
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3769
diff
changeset
|
72 lib/ optional common imports for detectors and extensions |
| 1098 | 73 =================== ======================================================== |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
74 |
|
3117
460eb0209a9e
Permissions improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
3097
diff
changeset
|
75 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
76 .. index:: config.ini |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
77 .. index:: configuration; see config.ini |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
78 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
79 Tracker Configuration |
| 1098 | 80 ===================== |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
81 |
| 2910 | 82 The ``config.ini`` located in your tracker home contains the basic |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
83 configuration for the web and e-mail components of Roundup's interfaces. |
| 2910 | 84 |
|
3276
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
85 Changes to the data captured by your tracker is controlled by the `tracker |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
86 schema`_. Some configuration is also performed using permissions - see the |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
87 `security / access controls`_ section. For example, to allow users to |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
88 automatically register through the email interface, you must grant the |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
89 "Anonymous" Role the "Email Access" Permission. |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
90 |
| 6163 | 91 .. index:: |
| 92 single: config.ini; sections | |
| 93 see: configuration; config.ini | |
|
6160
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
94 |
| 5367 | 95 The following is taken from the `Python Library Reference`__ (July 18, 2018) |
| 2910 | 96 section "ConfigParser -- Configuration file parser": |
| 97 | |
| 5367 | 98 The configuration file consists of sections, led by a [section] header |
| 99 and followed by name: value entries, with continuations in the style | |
| 100 of RFC 822 (see section 3.1.1, “LONG HEADER FIELDS”); name=value is | |
| 101 also accepted. Note that leading whitespace is removed from | |
| 102 values. The optional values can contain format strings which refer to | |
| 103 other values in the same section, or values in a special DEFAULT | |
| 104 section. Additional defaults can be provided on initialization and | |
| 105 retrieval. Lines beginning with '#' or ';' are ignored and may be | |
| 106 used to provide comments. | |
| 2910 | 107 |
| 108 For example:: | |
| 109 | |
| 110 [My Section] | |
|
2911
ca6206cc74d9
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2910
diff
changeset
|
111 foodir = %(dir)s/whatever |
|
ca6206cc74d9
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2910
diff
changeset
|
112 dir = frob |
|
ca6206cc74d9
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2910
diff
changeset
|
113 |
|
ca6206cc74d9
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2910
diff
changeset
|
114 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
|
115 resulting in "foodir" being "frob/whatever". |
| 2910 | 116 |
| 5367 | 117 __ https://docs.python.org/2/library/configparser.html |
|
1245
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
118 |
|
6160
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
119 Example configuration settings are below. This is a partial |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
120 list. Documentation on all the settings is included in the |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
121 ``config.ini`` file. |
|
5231
8743b7226dc7
Fix issue with retreiving raw template files using the @@file mechanism.
John Rouillard <rouilj@ieee.org>
parents:
5227
diff
changeset
|
122 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
123 .. index:: config.ini; sections main |
|
6160
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
124 |
| 2910 | 125 Section **main** |
| 126 database -- ``db`` | |
| 127 Database directory path. The path may be either absolute or relative | |
| 128 to the directory containig this config file. | |
| 129 | |
| 130 templates -- ``html`` | |
| 131 Path to the HTML templates directory. The path may be either absolute | |
|
5154
f608eeecf638
issue2550891: Allow subdir in template value. Anthony (antmail)
John Rouillard <rouilj@ieee.org>
parents:
5135
diff
changeset
|
132 or relative to the directory containing this config file. |
| 2910 | 133 |
|
3922
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
134 static_files -- default *blank* |
|
5231
8743b7226dc7
Fix issue with retreiving raw template files using the @@file mechanism.
John Rouillard <rouilj@ieee.org>
parents:
5227
diff
changeset
|
135 A list of space separated directory paths (or a single directory). |
|
8743b7226dc7
Fix issue with retreiving raw template files using the @@file mechanism.
John Rouillard <rouilj@ieee.org>
parents:
5227
diff
changeset
|
136 These directories hold additional static files available via Web UI. |
|
8743b7226dc7
Fix issue with retreiving raw template files using the @@file mechanism.
John Rouillard <rouilj@ieee.org>
parents:
5227
diff
changeset
|
137 These directories may contain sitewide images, CSS stylesheets etc. If |
|
8743b7226dc7
Fix issue with retreiving raw template files using the @@file mechanism.
John Rouillard <rouilj@ieee.org>
parents:
5227
diff
changeset
|
138 a '-' is included, the list processing ends and the TEMPLATES |
|
8743b7226dc7
Fix issue with retreiving raw template files using the @@file mechanism.
John Rouillard <rouilj@ieee.org>
parents:
5227
diff
changeset
|
139 directory is not searched after the specified directories. If this |
|
8743b7226dc7
Fix issue with retreiving raw template files using the @@file mechanism.
John Rouillard <rouilj@ieee.org>
parents:
5227
diff
changeset
|
140 option is not set, all static files are taken from the TEMPLATES |
|
8743b7226dc7
Fix issue with retreiving raw template files using the @@file mechanism.
John Rouillard <rouilj@ieee.org>
parents:
5227
diff
changeset
|
141 directory. |
|
3922
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
142 |
| 2910 | 143 admin_email -- ``roundup-admin`` |
|
2914
c75a19894d3e
alex's feedback
Richard Jones <richard@users.sourceforge.net>
parents:
2911
diff
changeset
|
144 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
|
145 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
|
146 below is used. |
| 2910 | 147 |
| 148 dispatcher_email -- ``roundup-admin`` | |
| 149 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
|
150 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
|
151 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
|
152 below is used. |
| 2910 | 153 |
| 154 email_from_tag -- default *blank* | |
| 155 Additional text to include in the "name" part of the From: address used | |
| 156 in nosy messages. If the sending user is "Foo Bar", the From: line | |
| 157 is usually: ``"Foo Bar" <issue_tracker@tracker.example>`` | |
| 158 the EMAIL_FROM_TAG goes inside the "Foo Bar" quotes like so: | |
| 159 ``"Foo Bar EMAIL_FROM_TAG" <issue_tracker@tracker.example>`` | |
| 160 | |
| 161 new_web_user_roles -- ``User`` | |
| 162 Roles that a user gets when they register with Web User Interface. | |
| 163 This is a comma-separated list of role names (e.g. ``Admin,User``). | |
| 164 | |
| 165 new_email_user_roles -- ``User`` | |
| 166 Roles that a user gets when they register with Email Gateway. | |
| 167 This is a comma-separated string of role names (e.g. ``Admin,User``). | |
| 168 | |
| 169 error_messages_to -- ``user`` | |
| 170 Send error message emails to the ``dispatcher``, ``user``, or ``both``? | |
| 171 The dispatcher is configured using the DISPATCHER_EMAIL setting. | |
| 172 Allowed values: ``dispatcher``, ``user``, or ``both`` | |
| 173 | |
| 174 html_version -- ``html4`` | |
| 175 HTML version to generate. The templates are ``html4`` by default. | |
| 176 If you wish to make them xhtml, then you'll need to change this | |
| 177 var to ``xhtml`` too so all auto-generated HTML is compliant. | |
| 178 Allowed values: ``html4``, ``xhtml`` | |
| 179 | |
| 180 timezone -- ``0`` | |
| 181 Numeric timezone offset used when users do not choose their own | |
| 182 in their settings. | |
| 183 | |
| 184 instant_registration -- ``yes`` | |
| 185 Register new users instantly, or require confirmation via | |
| 186 email? | |
| 187 Allowed values: ``yes``, ``no`` | |
| 188 | |
|
3544
5cd1c83dea50
Features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
3535
diff
changeset
|
189 email_registration_confirmation -- ``yes`` |
|
5cd1c83dea50
Features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
3535
diff
changeset
|
190 Offer registration confirmation by email or only through the web? |
|
5cd1c83dea50
Features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
3535
diff
changeset
|
191 Allowed values: ``yes``, ``no`` |
|
5cd1c83dea50
Features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
3535
diff
changeset
|
192 |
|
5cd1c83dea50
Features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
3535
diff
changeset
|
193 indexer_stopwords -- default *blank* |
|
5cd1c83dea50
Features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
3535
diff
changeset
|
194 Additional stop-words for the full-text indexer specific to |
|
5cd1c83dea50
Features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
3535
diff
changeset
|
195 your tracker. See the indexer source for the default list of |
|
5cd1c83dea50
Features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
3535
diff
changeset
|
196 stop-words (e.g. ``A,AND,ARE,AS,AT,BE,BUT,BY, ...``). |
|
5cd1c83dea50
Features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
3535
diff
changeset
|
197 |
|
3922
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
198 umask -- ``02`` |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
199 Defines the file creation mode mask. |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
200 |
|
5047
b8a04cce88ff
Adding documentation for csv_field_size to the customizing tracker section issue2550669
John Rouillard <rouilj@ieee.org>
parents:
5004
diff
changeset
|
201 csv_field_size -- ``131072`` |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
202 Maximum size of a csv-field during import. Roundup's export |
|
5047
b8a04cce88ff
Adding documentation for csv_field_size to the customizing tracker section issue2550669
John Rouillard <rouilj@ieee.org>
parents:
5004
diff
changeset
|
203 format is a csv (comma separated values) variant. The csv |
|
b8a04cce88ff
Adding documentation for csv_field_size to the customizing tracker section issue2550669
John Rouillard <rouilj@ieee.org>
parents:
5004
diff
changeset
|
204 reader has a limit on the size of individual fields |
|
b8a04cce88ff
Adding documentation for csv_field_size to the customizing tracker section issue2550669
John Rouillard <rouilj@ieee.org>
parents:
5004
diff
changeset
|
205 starting with python 2.5. Set this to a higher value if you |
|
b8a04cce88ff
Adding documentation for csv_field_size to the customizing tracker section issue2550669
John Rouillard <rouilj@ieee.org>
parents:
5004
diff
changeset
|
206 get the error 'Error: field larger than field limit' during |
|
b8a04cce88ff
Adding documentation for csv_field_size to the customizing tracker section issue2550669
John Rouillard <rouilj@ieee.org>
parents:
5004
diff
changeset
|
207 import. |
|
b8a04cce88ff
Adding documentation for csv_field_size to the customizing tracker section issue2550669
John Rouillard <rouilj@ieee.org>
parents:
5004
diff
changeset
|
208 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
209 .. index:: config.ini; sections tracker |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
210 |
| 2910 | 211 Section **tracker** |
| 212 name -- ``Roundup issue tracker`` | |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
213 A descriptive name for your Roundup instance. |
| 2910 | 214 |
| 215 web -- ``http://host.example/demo/`` | |
| 216 The web address that the tracker is viewable at. | |
| 217 This will be included in information sent to users of the tracker. | |
| 218 The URL MUST include the cgi-bin part or anything else | |
| 219 that is required to get to the home page of the tracker. | |
| 220 You MUST include a trailing '/' in the URL. | |
| 221 | |
| 222 email -- ``issue_tracker`` | |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
223 Email address that mail to Roundup should go to. |
| 2910 | 224 |
|
3922
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
225 language -- default *blank* |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
226 Default locale name for this tracker. If this option is not set, the |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
227 language is determined by the environment variable LANGUAGE, LC_ALL, |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
228 LC_MESSAGES, or LANG, in that order of preference. |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
229 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
230 .. index:: config.ini; sections web |
|
6160
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
231 |
|
3548
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
232 Section **web** |
|
4088
34434785f308
Plug a number of security holes:
Richard Jones <richard@users.sourceforge.net>
parents:
4036
diff
changeset
|
233 allow_html_file -- ``no`` |
|
34434785f308
Plug a number of security holes:
Richard Jones <richard@users.sourceforge.net>
parents:
4036
diff
changeset
|
234 Setting this option enables Roundup to serve uploaded HTML |
|
34434785f308
Plug a number of security holes:
Richard Jones <richard@users.sourceforge.net>
parents:
4036
diff
changeset
|
235 file content *as HTML*. This is a potential security risk |
|
34434785f308
Plug a number of security holes:
Richard Jones <richard@users.sourceforge.net>
parents:
4036
diff
changeset
|
236 and is therefore disabled by default. Set to 'yes' if you |
|
34434785f308
Plug a number of security holes:
Richard Jones <richard@users.sourceforge.net>
parents:
4036
diff
changeset
|
237 trust *all* users uploading content to your tracker. |
|
34434785f308
Plug a number of security holes:
Richard Jones <richard@users.sourceforge.net>
parents:
4036
diff
changeset
|
238 |
|
3548
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
239 http_auth -- ``yes`` |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
240 Whether to use HTTP Basic Authentication, if present. |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
241 Roundup will use either the REMOTE_USER or HTTP_AUTHORIZATION |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
242 variables supplied by your web server (in that order). |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
243 Set this option to 'no' if you do not wish to use HTTP Basic |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
244 Authentication in your web interface. |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
245 |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
246 use_browser_language -- ``yes`` |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
247 Whether to use HTTP Accept-Language, if present. |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
248 Browsers send a language-region preference list. |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
249 It's usually set in the client's browser or in their |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
250 Operating System. |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
251 Set this option to 'no' if you want to ignore it. |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
252 |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
253 debug -- ``no`` |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
254 Setting this option makes Roundup display error tracebacks |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
255 in the user's browser rather than emailing them to the |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
256 tracker admin."), |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
257 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
258 .. index:: config.ini; sections rdbms |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
259 single: config.ini; database settings |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
260 |
| 2910 | 261 Section **rdbms** |
|
6160
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
262 Settings in this section are used to set the backend and configure |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
263 addition settings needed by RDBMs like SQLite, Postgresql and |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
264 MySQL backends. |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
265 |
| 6163 | 266 .. index:: |
| 267 single: postgres; select backend in config.ini | |
| 268 single: mysql; select backend in config.ini | |
| 269 single: sqlite; select backend in config.ini | |
| 270 single: anydbm; select backend in config.ini | |
| 271 see: database; postgres | |
| 272 see: database; mysql | |
| 273 see: database; sqlite | |
| 274 see: database; anydbm | |
| 275 | |
|
6160
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
276 backend -- set to value by init |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
277 The database backend such as anydbm, sqlite, mysql or postgres. |
| 2910 | 278 |
| 279 name -- ``roundup`` | |
| 280 Name of the database to use. | |
| 281 | |
| 282 host -- ``localhost`` | |
| 283 Database server host. | |
| 284 | |
| 285 port -- default *blank* | |
| 286 TCP port number of the database server. Postgresql usually resides on | |
| 287 port 5432 (if any), for MySQL default port number is 3306. Leave this | |
| 288 option empty to use backend default. | |
| 289 | |
| 290 user -- ``roundup`` | |
| 291 Database user name that Roundup should use. | |
| 292 | |
| 293 password -- ``roundup`` | |
| 294 Database user password. | |
| 295 | |
|
3922
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
296 read_default_file -- ``~/.my.cnf`` |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
297 Name of the MySQL defaults file. Only used in MySQL connections. |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
298 |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
299 read_default_group -- ``roundup`` |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
300 Name of the group to use in the MySQL defaults file. Only used in |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
301 MySQL connections. |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
302 |
| 6163 | 303 .. index:: |
| 304 single: sqlite; lock timeout | |
| 305 | |
|
6160
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
306 sqlite_timeout -- ``30`` |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
307 Number of seconds to wait when the SQLite database is locked. |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
308 Used only for SQLite. |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
309 |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
310 cache_size -- `100` |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
311 Size of the node cache (in elements) used to keep most recently used |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
312 data in memory. |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
313 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
314 .. index:: config.ini; sections logging |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
315 see: logging; config.ini, sections logging |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
316 |
| 2910 | 317 Section **logging** |
| 318 config -- default *blank* | |
| 319 Path to configuration file for standard Python logging module. If this | |
| 320 option is set, logging configuration is loaded from specified file; | |
| 321 options 'filename' and 'level' in this section are ignored. The path may | |
| 322 be either absolute or relative to the directory containig this config file. | |
| 323 | |
| 324 filename -- default *blank* | |
| 325 Log file name for minimal logging facility built into Roundup. If no file | |
| 326 name specified, log messages are written on stderr. If above 'config' | |
| 327 option is set, this option has no effect. The path may be either absolute | |
| 328 or relative to the directory containig this config file. | |
| 329 | |
| 330 level -- ``ERROR`` | |
| 331 Minimal severity level of messages written to log file. If above 'config' | |
| 332 option is set, this option has no effect. | |
| 333 Allowed values: ``DEBUG``, ``INFO``, ``WARNING``, ``ERROR`` | |
| 334 | |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
335 .. index:: config.ini; sections mail |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
336 |
| 2910 | 337 Section **mail** |
| 338 Outgoing email options. Used for nosy messages, password reset and | |
| 339 registration approval requests. | |
| 340 | |
| 341 domain -- ``localhost`` | |
| 342 Domain name used for email addresses. | |
| 343 | |
| 344 host -- default *blank* | |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
345 SMTP mail host that Roundup will use to send mail |
| 2910 | 346 |
| 347 username -- default *blank* | |
| 348 SMTP login name. Set this if your mail host requires authenticated access. | |
| 349 If username is not empty, password (below) MUST be set! | |
| 350 | |
| 351 password -- default *blank* | |
| 352 SMTP login password. | |
| 353 Set this if your mail host requires authenticated access. | |
| 354 | |
|
3878
6d14a3b4e295
allow admin to specify port and local hostname for SMTP connections
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3830
diff
changeset
|
355 port -- default *25* |
|
6d14a3b4e295
allow admin to specify port and local hostname for SMTP connections
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3830
diff
changeset
|
356 SMTP port on mail host. |
|
6d14a3b4e295
allow admin to specify port and local hostname for SMTP connections
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3830
diff
changeset
|
357 Set this if your mail host runs on a different port. |
|
6d14a3b4e295
allow admin to specify port and local hostname for SMTP connections
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3830
diff
changeset
|
358 |
|
6d14a3b4e295
allow admin to specify port and local hostname for SMTP connections
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3830
diff
changeset
|
359 local_hostname -- default *blank* |
|
6d14a3b4e295
allow admin to specify port and local hostname for SMTP connections
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3830
diff
changeset
|
360 The fully qualified domain name (FQDN) to use during SMTP sessions. If left |
|
6d14a3b4e295
allow admin to specify port and local hostname for SMTP connections
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3830
diff
changeset
|
361 blank, the underlying SMTP library will attempt to detect your FQDN. If your |
|
6d14a3b4e295
allow admin to specify port and local hostname for SMTP connections
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3830
diff
changeset
|
362 mail host requires something specific, specify the FQDN to use. |
|
6d14a3b4e295
allow admin to specify port and local hostname for SMTP connections
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3830
diff
changeset
|
363 |
| 2910 | 364 tls -- ``no`` |
| 365 If your SMTP mail host provides or requires TLS (Transport Layer Security) | |
| 366 then you may set this option to 'yes'. | |
| 367 Allowed values: ``yes``, ``no`` | |
| 368 | |
| 369 tls_keyfile -- default *blank* | |
| 370 If TLS is used, you may set this option to the name of a PEM formatted | |
| 371 file that contains your private key. The path may be either absolute or | |
| 372 relative to the directory containig this config file. | |
| 373 | |
| 374 tls_certfile -- default *blank* | |
| 375 If TLS is used, you may set this option to the name of a PEM formatted | |
| 376 certificate chain file. The path may be either absolute or relative | |
| 377 to the directory containig this config file. | |
| 378 | |
| 379 charset -- utf-8 | |
| 380 Character set to encode email headers with. We use utf-8 by default, as | |
| 381 it's the most flexible. Some mail readers (eg. Eudora) can't cope with | |
| 382 that, so you might need to specify a more limited character set | |
| 383 (eg. iso-8859-1). | |
| 384 | |
| 385 debug -- default *blank* | |
| 386 Setting this option makes Roundup to write all outgoing email messages | |
| 387 to this file *instead* of sending them. This option has the same effect | |
| 388 as environment variable SENDMAILDEBUG. Environment variable takes | |
| 389 precedence. The path may be either absolute or relative to the directory | |
| 390 containig this config file. | |
| 391 | |
|
3922
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
392 add_authorinfo -- ``yes`` |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
393 Add a line with author information at top of all messages send by |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
394 Roundup. |
|
3922
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
395 |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
396 add_authoremail -- ``yes`` |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
397 Add the mail address of the author to the author information at the |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
398 top of all messages. If this is false but add_authorinfo is true, |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
399 only the name of the actor is added which protects the mail address |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
400 of the actor from being exposed at mail archives, etc. |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
401 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
402 .. index:: config.ini; sections mailgw |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
403 single: mailgw; config |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
404 see: mail gateway; mailgw |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
405 |
| 2910 | 406 Section **mailgw** |
| 407 Roundup Mail Gateway options | |
| 408 | |
| 409 keep_quoted_text -- ``yes`` | |
| 410 Keep email citations when accepting messages. Setting this to ``no`` strips | |
| 411 out "quoted" text from the message. Signatures are also stripped. | |
| 412 Allowed values: ``yes``, ``no`` | |
| 413 | |
| 414 leave_body_unchanged -- ``no`` | |
| 415 Preserve the email body as is - that is, keep the citations *and* | |
| 416 signatures. | |
| 417 Allowed values: ``yes``, ``no`` | |
| 418 | |
| 419 default_class -- ``issue`` | |
| 420 Default class to use in the mailgw if one isn't supplied in email subjects. | |
| 421 To disable, leave the value blank. | |
| 422 | |
|
3922
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
423 language -- default *blank* |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
424 Default locale name for the tracker mail gateway. If this option is |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
425 not set, mail gateway will use the language of the tracker instance. |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
426 |
|
3417
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
427 subject_prefix_parsing -- ``strict`` |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
428 Controls the parsing of the [prefix] on subject lines in incoming emails. |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
429 ``strict`` will return an error to the sender if the [prefix] is not |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
430 recognised. ``loose`` will attempt to parse the [prefix] but just |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
431 pass it through as part of the issue title if not recognised. ``none`` |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
432 will always pass any [prefix] through as part of the issue title. |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
433 |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
434 subject_suffix_parsing -- ``strict`` |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
435 Controls the parsing of the [suffix] on subject lines in incoming emails. |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
436 ``strict`` will return an error to the sender if the [suffix] is not |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
437 recognised. ``loose`` will attempt to parse the [suffix] but just |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
438 pass it through as part of the issue title if not recognised. ``none`` |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
439 will always pass any [suffix] through as part of the issue title. |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
440 |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
441 subject_suffix_delimiters -- ``[]`` |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
442 Defines the brackets used for delimiting the commands suffix in a subject |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
443 line. |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
444 |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
445 subject_content_match -- ``always`` |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
446 Controls matching of the incoming email subject line against issue titles |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
447 in the case where there is no designator [prefix]. ``never`` turns off |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
448 matching. ``creation + interval`` or ``activity + interval`` will match |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
449 an issue for the interval after the issue's creation or last activity. |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
450 The interval is a standard Roundup interval. |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
451 |
|
4406
3a0395583de5
add missing config options
Richard Jones <richard@users.sourceforge.net>
parents:
4325
diff
changeset
|
452 subject_updates_title -- ``yes`` |
|
3a0395583de5
add missing config options
Richard Jones <richard@users.sourceforge.net>
parents:
4325
diff
changeset
|
453 Update issue title if incoming subject of email is different. |
|
3a0395583de5
add missing config options
Richard Jones <richard@users.sourceforge.net>
parents:
4325
diff
changeset
|
454 Setting this to ``no`` will ignore the title part of |
|
3a0395583de5
add missing config options
Richard Jones <richard@users.sourceforge.net>
parents:
4325
diff
changeset
|
455 the subject of incoming email messages. |
|
3a0395583de5
add missing config options
Richard Jones <richard@users.sourceforge.net>
parents:
4325
diff
changeset
|
456 |
|
3922
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
457 refwd_re -- ``(\s*\W?\s*(fw|fwd|re|aw|sv|ang)\W)+`` |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
458 Regular expression matching a single reply or forward prefix |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
459 prepended by the mailer. This is explicitly stripped from the |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
460 subject during parsing. Value is Python Regular Expression |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
461 (UTF8-encoded). |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
462 |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
463 origmsg_re -- `` ^[>|\s]*-----\s?Original Message\s?-----$`` |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
464 Regular expression matching start of an original message if quoted |
|
4656
bce631d8f24d
issue2550738: Fixes for various documentation typos, thanks Nathan Russell
John Kristensen <john@jerrykan.com>
parents:
4619
diff
changeset
|
465 in the body. Value is Python Regular Expression (UTF8-encoded). |
|
3922
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
466 |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
467 sign_re -- ``^[>|\s]*-- ?$`` |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
468 Regular expression matching the start of a signature in the message |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
469 body. Value is Python Regular Expression (UTF8-encoded). |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
470 |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
471 eol_re -- ``[\r\n]+`` |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
472 Regular expression matching end of line. Value is Python Regular |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
473 Expression (UTF8-encoded). |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
474 |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
475 blankline_re -- ``[\r\n]+\s*[\r\n]+`` |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
476 Regular expression matching a blank line. Value is Python Regular |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
477 Expression (UTF8-encoded). |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
478 |
|
4406
3a0395583de5
add missing config options
Richard Jones <richard@users.sourceforge.net>
parents:
4325
diff
changeset
|
479 ignore_alternatives -- ``no`` |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
480 When parsing incoming mails, Roundup uses the first |
|
4406
3a0395583de5
add missing config options
Richard Jones <richard@users.sourceforge.net>
parents:
4325
diff
changeset
|
481 text/plain part it finds. If this part is inside a |
|
3a0395583de5
add missing config options
Richard Jones <richard@users.sourceforge.net>
parents:
4325
diff
changeset
|
482 multipart/alternative, and this option is set, all other |
|
3a0395583de5
add missing config options
Richard Jones <richard@users.sourceforge.net>
parents:
4325
diff
changeset
|
483 parts of the multipart/alternative are ignored. The default |
|
3a0395583de5
add missing config options
Richard Jones <richard@users.sourceforge.net>
parents:
4325
diff
changeset
|
484 is to keep all parts and attach them to the issue. |
|
3a0395583de5
add missing config options
Richard Jones <richard@users.sourceforge.net>
parents:
4325
diff
changeset
|
485 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
486 .. index:: config.ini; sections php |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
487 |
|
3922
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
488 Section **pgp** |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
489 OpenPGP mail processing options |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
490 |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
491 enable -- ``no`` |
|
5494
b7fa56ced601
use gpg module instead of pyme module for PGP encryption
Christof Meerwald <cmeerw@cmeerw.org>
parents:
5367
diff
changeset
|
492 Enable PGP processing. Requires gpg. |
|
3922
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
493 |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
494 roles -- default *blank* |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
495 If specified, a comma-separated list of roles to perform PGP |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
496 processing on. If not specified, it happens for all users. |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
497 |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
498 homedir -- default *blank* |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
499 Location of PGP directory. Defaults to $HOME/.gnupg if not |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
500 specified. |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
501 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
502 |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
503 .. index:: config.ini; sections nosy |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
504 |
| 2910 | 505 Section **nosy** |
| 506 Nosy messages sending | |
| 507 | |
| 508 messages_to_author -- ``no`` | |
| 509 Send nosy messages to the author of the message. | |
|
4975
2fce201a2b47
Documentation: configuration messages_to_author value "nosy" now documented.
Bernhard Reiter <bernhard@intevation.de>
parents:
4941
diff
changeset
|
510 If ``yes`` is used, then messages are sent to the author |
|
2fce201a2b47
Documentation: configuration messages_to_author value "nosy" now documented.
Bernhard Reiter <bernhard@intevation.de>
parents:
4941
diff
changeset
|
511 even if not on the nosy list, same for ``new`` (but only for new messages). |
|
2fce201a2b47
Documentation: configuration messages_to_author value "nosy" now documented.
Bernhard Reiter <bernhard@intevation.de>
parents:
4941
diff
changeset
|
512 When set to ``nosy``, the nosy list controls sending messages to the author. |
|
2fce201a2b47
Documentation: configuration messages_to_author value "nosy" now documented.
Bernhard Reiter <bernhard@intevation.de>
parents:
4941
diff
changeset
|
513 Allowed values: ``yes``, ``no``, ``new``, ``nosy`` |
| 2910 | 514 |
| 515 signature_position -- ``bottom`` | |
| 516 Where to place the email signature. | |
| 517 Allowed values: ``top``, ``bottom``, ``none`` | |
| 518 | |
| 519 add_author -- ``new`` | |
| 520 Does the author of a message get placed on the nosy list automatically? | |
| 521 If ``new`` is used, then the author will only be added when a message | |
| 522 creates a new issue. If ``yes``, then the author will be added on | |
| 523 followups too. If ``no``, they're never added to the nosy. | |
| 524 Allowed values: ``yes``, ``no``, ``new`` | |
| 525 | |
| 526 add_recipients -- ``new`` | |
| 527 Do the recipients (``To:``, ``Cc:``) of a message get placed on the nosy | |
| 528 list? If ``new`` is used, then the recipients will only be added when a | |
| 529 message creates a new issue. If ``yes``, then the recipients will be added | |
| 530 on followups too. If ``no``, they're never added to the nosy. | |
| 531 Allowed values: ``yes``, ``no``, ``new`` | |
| 532 | |
|
3417
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
533 email_sending -- ``single`` |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
534 Controls the email sending from the nosy reactor. If ``multiple`` then |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
535 a separate email is sent to each recipient. If ``single`` then a single |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
536 email is sent with each recipient as a CC address. |
|
07c696890f55
mailgw subject parsing has configurable levels of strictness
Richard Jones <richard@users.sourceforge.net>
parents:
3409
diff
changeset
|
537 |
|
3922
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
538 max_attachment_size -- ``2147483647`` |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
539 Attachments larger than the given number of bytes won't be attached |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
540 to nosy mails. They will be replaced by a link to the tracker's |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
541 download page for the file. |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
542 |
|
586679a314f7
role checking for PGP mail and docs
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3904
diff
changeset
|
543 |
| 6163 | 544 .. index:: single: roundup-admin; config.ini update |
| 545 single: roundup-admin; config.ini create | |
| 546 single: config.ini; create | |
| 547 single: config.ini; update | |
| 548 | |
| 2910 | 549 You may generate a new default config file using the ``roundup-admin |
|
5231
8743b7226dc7
Fix issue with retreiving raw template files using the @@file mechanism.
John Rouillard <rouilj@ieee.org>
parents:
5227
diff
changeset
|
550 genconfig`` command. You can generate a new config file merging in |
|
8743b7226dc7
Fix issue with retreiving raw template files using the @@file mechanism.
John Rouillard <rouilj@ieee.org>
parents:
5227
diff
changeset
|
551 existing settings using the ``roundup-admin updateconfig`` command. |
| 2910 | 552 |
|
3276
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
553 Configuration variables may be referred to in lower or upper case. In code, |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
554 variables not in the "main" section are referred to using their section and |
|
6160
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
555 name, so "domain" in the section "mail" becomes MAIL_DOMAIN. |
|
3276
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
556 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
557 .. index:: pair: configuration; extensions |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
558 pair: configuration; detectors |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
559 |
|
3768
ef5da136cdc5
document extending config
Richard Jones <richard@users.sourceforge.net>
parents:
3754
diff
changeset
|
560 Extending the configuration file |
|
ef5da136cdc5
document extending config
Richard Jones <richard@users.sourceforge.net>
parents:
3754
diff
changeset
|
561 -------------------------------- |
|
ef5da136cdc5
document extending config
Richard Jones <richard@users.sourceforge.net>
parents:
3754
diff
changeset
|
562 |
|
ef5da136cdc5
document extending config
Richard Jones <richard@users.sourceforge.net>
parents:
3754
diff
changeset
|
563 You can't add new variables to the config.ini file in the tracker home but |
|
ef5da136cdc5
document extending config
Richard Jones <richard@users.sourceforge.net>
parents:
3754
diff
changeset
|
564 you can add two new config.ini files: |
|
ef5da136cdc5
document extending config
Richard Jones <richard@users.sourceforge.net>
parents:
3754
diff
changeset
|
565 |
|
ef5da136cdc5
document extending config
Richard Jones <richard@users.sourceforge.net>
parents:
3754
diff
changeset
|
566 - a config.ini in the ``extensions`` directory will be loaded and attached |
|
ef5da136cdc5
document extending config
Richard Jones <richard@users.sourceforge.net>
parents:
3754
diff
changeset
|
567 to the config variable as "ext". |
|
ef5da136cdc5
document extending config
Richard Jones <richard@users.sourceforge.net>
parents:
3754
diff
changeset
|
568 - a config.ini in the ``detectors`` directory will be loaded and attached |
|
ef5da136cdc5
document extending config
Richard Jones <richard@users.sourceforge.net>
parents:
3754
diff
changeset
|
569 to the config variable as "detectors". |
|
ef5da136cdc5
document extending config
Richard Jones <richard@users.sourceforge.net>
parents:
3754
diff
changeset
|
570 |
|
ef5da136cdc5
document extending config
Richard Jones <richard@users.sourceforge.net>
parents:
3754
diff
changeset
|
571 For example, the following in ``detectors/config.ini``:: |
|
ef5da136cdc5
document extending config
Richard Jones <richard@users.sourceforge.net>
parents:
3754
diff
changeset
|
572 |
|
ef5da136cdc5
document extending config
Richard Jones <richard@users.sourceforge.net>
parents:
3754
diff
changeset
|
573 [main] |
|
ef5da136cdc5
document extending config
Richard Jones <richard@users.sourceforge.net>
parents:
3754
diff
changeset
|
574 qa_recipients = email@example.com |
|
ef5da136cdc5
document extending config
Richard Jones <richard@users.sourceforge.net>
parents:
3754
diff
changeset
|
575 |
|
ef5da136cdc5
document extending config
Richard Jones <richard@users.sourceforge.net>
parents:
3754
diff
changeset
|
576 is accessible as:: |
|
ef5da136cdc5
document extending config
Richard Jones <richard@users.sourceforge.net>
parents:
3754
diff
changeset
|
577 |
|
ef5da136cdc5
document extending config
Richard Jones <richard@users.sourceforge.net>
parents:
3754
diff
changeset
|
578 db.config.detectors['QA_RECIPIENTS'] |
|
ef5da136cdc5
document extending config
Richard Jones <richard@users.sourceforge.net>
parents:
3754
diff
changeset
|
579 |
|
3772
13e8825da493
Documentation update for common lib directory
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3769
diff
changeset
|
580 Note that the name grouping applied to the main configuration file is |
|
3769
d41ee0fdae71
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
3768
diff
changeset
|
581 applied to the extension config files, so if you instead have:: |
|
d41ee0fdae71
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
3768
diff
changeset
|
582 |
|
d41ee0fdae71
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
3768
diff
changeset
|
583 [qa] |
|
d41ee0fdae71
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
3768
diff
changeset
|
584 recipients = email@example.com |
|
d41ee0fdae71
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
3768
diff
changeset
|
585 |
|
d41ee0fdae71
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
3768
diff
changeset
|
586 then the above ``db.config.detectors['QA_RECIPIENTS']`` will still work. |
|
d41ee0fdae71
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
3768
diff
changeset
|
587 |
|
6583
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
588 Unlike values in the tracker's main ``config.ini``, the values defined |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
589 in these config files are not validated. For example: a setting that |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
590 is supposed to be an integer value (e.g. 4) could be the word |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
591 "foo". If you are writing Python code that uses these settings, you |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
592 should expect to handle invalid values. |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
593 |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
594 Also, incorrect values aren't discovered until the config setting is |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
595 used. This can be long after the tracker is started and the error may |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
596 not be seen in the logs. |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
597 |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
598 It is possible to validate these settings. Validation involves calling |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
599 the ``update_options`` method on the configuration option. This can be |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
600 done from the ``init()`` function in the Python files implementing |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
601 extensions_ or detectors_. |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
602 |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
603 As an example, adding the following to an extension:: |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
604 |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
605 from roundup.configuration import SecretMandatoryOption |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
606 |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
607 def init(instance): |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
608 instance.config.ext.update_option('RECAPTCHA_SECRET', |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
609 SecretMandatoryOption,description="Secret securing reCaptcha.") |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
610 |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
611 similarly for a detector:: |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
612 |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
613 from roundup.configuration import MailAddressOption |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
614 |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
615 def init(db): |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
616 try: |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
617 db.config.detectors.update_option('QA_RECIPIENTS', |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
618 MailAddressOption, |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
619 description="Email used for QA comment followup.") |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
620 except KeyError: |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
621 # COMMENT_EMAIL setting is not found, but it's optional |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
622 # so continue |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
623 pass |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
624 |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
625 will allow reading the secret from a file or append the tracker domain |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
626 to an email address if it does not have a domain. |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
627 |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
628 Running ``roundup-admin -i tracker_home display user1`` will validate |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
629 the settings for both config.ini`s. Otherwise detector options are not |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
630 validated until the first request to the web interface (or email |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
631 gateway). |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
632 |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
633 There are 4 arguments for ``update_option``: |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
634 |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
635 1. config setting name - string (positional, mandatory) |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
636 2. option type - Option derived class from configuration.py |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
637 (positional, mandatory) |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
638 3. default value - string (optional, named default) |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
639 4. description - string (optional, named description) |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
640 |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
641 The first argument is the config setting name as described at the |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
642 beginning of this section. |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
643 |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
644 The second argument is a class in the roundup.configuration module. |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
645 There are a number of these classes: BooleanOption, |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
646 IntegerNumberOption, RegExpOption.... Please see the configuration |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
647 module for all Option validators and their descriptions. You can also |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
648 define your own custom validator in `interfaces.py`_. |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
649 |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
650 The third and fourth arguments are strings and are optional. They are |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
651 printed if there is an error and may help the user correct the problem. |
|
3759893f0686
Document validating exenstions/config.ini and detectors/config.ini
John Rouillard <rouilj@ieee.org>
parents:
6535
diff
changeset
|
652 |
| 6163 | 653 .. index:: ! schema |
|
1360
aa7e4e8b14be
allow additional control over the roundupdb email sending...
Richard Jones <richard@users.sourceforge.net>
parents:
1335
diff
changeset
|
654 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
655 Tracker Schema |
| 1098 | 656 ============== |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
657 |
| 3052 | 658 .. note:: |
| 659 if you modify the schema, you'll most likely need to edit the | |
| 660 `web interface`_ HTML template files and `detectors`_ to reflect | |
| 661 your changes. | |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
662 |
| 1091 | 663 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
|
664 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
|
665 tracker. |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
666 |
|
6160
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
667 The ``schema.py`` and ``initial_data.py`` modules |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
668 ------------------------------------------------- |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
669 |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
670 The schema.py module is used to define what your tracker looks like |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
671 on the inside, the schema of the tracker. It defines the Classes |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
672 and properties on each class. It also defines the security for |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
673 those Classes. The next few sections describe how schemas work |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
674 and what you can do with them. |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
675 |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
676 The initial_data.py module sets up the initial state of your |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
677 tracker. It’s called exactly once - by the ``roundup-admin initialise`` |
|
7292
b97d6a4fba85
Add link to database content section. was text only reference.
John Rouillard <rouilj@ieee.org>
parents:
7289
diff
changeset
|
678 command. See the start of the section on `database content`_ for more |
|
6160
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
679 info about how this works. |
|
2153
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
680 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
681 .. index:: schema; classic - description of |
|
2153
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
682 |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
683 The "classic" schema |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
684 -------------------- |
|
643f9c9d7517
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2149
diff
changeset
|
685 |
|
3476
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
686 The "classic" schema looks like this (see section `setkey(property)`_ |
|
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
687 below for the meaning of ``'setkey'`` -- you may also want to look into |
|
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
688 the sections `setlabelprop(property)`_ and `setorderprop(property)`_ for |
|
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
689 specifying (default) labelling and ordering of classes.):: |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
690 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
691 pri = Class(db, "priority", name=String(), order=String()) |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
692 pri.setkey("name") |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
693 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
694 stat = Class(db, "status", name=String(), order=String()) |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
695 stat.setkey("name") |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
696 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
697 keyword = Class(db, "keyword", name=String()) |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
698 keyword.setkey("name") |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
699 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
700 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
|
701 password=String(), address=String(), realname=String(), |
|
3754
9f4dd27ae843
documentation cleanup from Luke Ross (patch [SF#1594860])
Richard Jones <richard@users.sourceforge.net>
parents:
3747
diff
changeset
|
702 phone=String(), alternate_addresses=String(), |
|
9f4dd27ae843
documentation cleanup from Luke Ross (patch [SF#1594860])
Richard Jones <richard@users.sourceforge.net>
parents:
3747
diff
changeset
|
703 queries=Multilink('query'), roles=String(), timezone=String()) |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
704 user.setkey("username") |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
705 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
706 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
|
707 date=Date(), recipients=Multilink("user"), |
|
3754
9f4dd27ae843
documentation cleanup from Luke Ross (patch [SF#1594860])
Richard Jones <richard@users.sourceforge.net>
parents:
3747
diff
changeset
|
708 files=Multilink("file"), messageid=String(), inreplyto=String()) |
|
9f4dd27ae843
documentation cleanup from Luke Ross (patch [SF#1594860])
Richard Jones <richard@users.sourceforge.net>
parents:
3747
diff
changeset
|
709 |
|
9f4dd27ae843
documentation cleanup from Luke Ross (patch [SF#1594860])
Richard Jones <richard@users.sourceforge.net>
parents:
3747
diff
changeset
|
710 file = FileClass(db, "file", name=String()) |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
711 |
|
3904
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
712 issue = IssueClass(db, "issue", keyword=Multilink("keyword"), |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
713 status=Link("status"), assignedto=Link("user"), |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
714 priority=Link("priority")) |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
715 issue.setkey('title') |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
716 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
717 .. index:: schema; allowed changes |
| 1832 | 718 |
| 719 What you can't do to the schema | |
| 720 ------------------------------- | |
| 721 | |
| 722 You must never: | |
| 723 | |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
724 **Remove the user class** |
|
2739
deb298529c2b
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2726
diff
changeset
|
725 This class is the only *required* class in Roundup. |
|
deb298529c2b
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2726
diff
changeset
|
726 |
|
deb298529c2b
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2726
diff
changeset
|
727 **Remove the "username", "address", "password" or "realname" user properties** |
|
deb298529c2b
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2726
diff
changeset
|
728 Various parts of Roundup require these properties. Don't remove them. |
| 1832 | 729 |
| 730 **Change the type of a property** | |
| 731 Property types must *never* be changed - the database simply doesn't take | |
| 732 this kind of action into account. Note that you can't just remove a | |
| 733 property and re-add it as a new type either. If you wanted to make the | |
| 734 assignedto property a Multilink, you'd need to create a new property | |
| 735 assignedto_list and remove the old assignedto property. | |
| 736 | |
| 737 | |
| 738 What you can do to the schema | |
| 739 ----------------------------- | |
| 740 | |
| 741 Your schema may be changed at any time before or after the tracker has been | |
| 742 initialised (or used). You may: | |
| 743 | |
| 744 **Add new properties to classes, or add whole new classes** | |
|
6171
53a674b5910f
Fix spelling and make list into a list for readability.
John Rouillard <rouilj@ieee.org>
parents:
6168
diff
changeset
|
745 This is painless and easy to do - there are generally no repercussions |
| 1832 | 746 from adding new information to a tracker's schema. |
| 747 | |
| 748 **Remove properties** | |
| 749 Removing properties is a little more tricky - you need to make sure that | |
| 750 the property is no longer used in the `web interface`_ *or* by the | |
| 751 detectors_. | |
| 752 | |
| 753 | |
| 754 | |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
755 Classes and Properties - creating a new information store |
| 1098 | 756 --------------------------------------------------------- |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
757 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
758 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
|
759 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
760 priority |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
761 Defines the possible levels of urgency for issues. |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
762 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
763 status |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
764 Defines the possible states of processing the issue may be in. |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
765 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
766 keyword |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
767 Initially empty, will hold keywords useful for searching issues. |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
768 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
769 user |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
770 Initially holding the "admin" user, will eventually have an entry |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
771 for all users using Roundup. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
772 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
773 msg |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
774 Initially empty, will hold all e-mail messages sent to or |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
775 generated by Roundup. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
776 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
777 file |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
778 Initially empty, will hold all files attached to issues. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
779 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
780 issue |
| 1091 | 781 Initially empty, this is where the issue information is stored. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
782 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
783 We define the "priority" and "status" classes to allow two things: |
|
6171
53a674b5910f
Fix spelling and make list into a list for readability.
John Rouillard <rouilj@ieee.org>
parents:
6168
diff
changeset
|
784 |
|
53a674b5910f
Fix spelling and make list into a list for readability.
John Rouillard <rouilj@ieee.org>
parents:
6168
diff
changeset
|
785 1. reduction in the amount of information stored on the issue |
|
53a674b5910f
Fix spelling and make list into a list for readability.
John Rouillard <rouilj@ieee.org>
parents:
6168
diff
changeset
|
786 2. more powerful, accurate searching of issues by priority and status |
|
53a674b5910f
Fix spelling and make list into a list for readability.
John Rouillard <rouilj@ieee.org>
parents:
6168
diff
changeset
|
787 |
|
53a674b5910f
Fix spelling and make list into a list for readability.
John Rouillard <rouilj@ieee.org>
parents:
6168
diff
changeset
|
788 By only requiring a link on the issue (which is stored as a single |
|
53a674b5910f
Fix spelling and make list into a list for readability.
John Rouillard <rouilj@ieee.org>
parents:
6168
diff
changeset
|
789 number) we reduce the chance that someone mis-types a priority or |
|
53a674b5910f
Fix spelling and make list into a list for readability.
John Rouillard <rouilj@ieee.org>
parents:
6168
diff
changeset
|
790 status - or simply makes a new one up. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
791 |
|
7267
519fb6dca72b
doc: add recommendation for singular class names
John Rouillard <rouilj@ieee.org>
parents:
7094
diff
changeset
|
792 Class names are used to access items of that class in the `REST api`_ |
|
519fb6dca72b
doc: add recommendation for singular class names
John Rouillard <rouilj@ieee.org>
parents:
7094
diff
changeset
|
793 interface. The classic tracker was created before the REST interface |
|
519fb6dca72b
doc: add recommendation for singular class names
John Rouillard <rouilj@ieee.org>
parents:
7094
diff
changeset
|
794 was added. It uses the single form (i.e. issue and user not issues and |
|
519fb6dca72b
doc: add recommendation for singular class names
John Rouillard <rouilj@ieee.org>
parents:
7094
diff
changeset
|
795 users) for its classes. Most REST documentation suggests using plural |
|
519fb6dca72b
doc: add recommendation for singular class names
John Rouillard <rouilj@ieee.org>
parents:
7094
diff
changeset
|
796 forms. However, to make your API consistent, use singular forms for |
|
519fb6dca72b
doc: add recommendation for singular class names
John Rouillard <rouilj@ieee.org>
parents:
7094
diff
changeset
|
797 classes that you add. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
798 |
| 1091 | 799 Class and Items |
| 1098 | 800 ~~~~~~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
801 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
802 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
|
803 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
|
804 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
|
805 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
806 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
|
807 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
|
808 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
|
809 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
810 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
811 .. index:: schema; property types |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
812 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
813 Properties |
| 1098 | 814 ~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
815 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
816 A Class is comprised of one or more properties of the following types: |
| 1091 | 817 |
|
6160
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
818 String |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
819 properties are for storing arbitrary-length strings. |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
820 Password |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
821 properties are for storing encoded arbitrary-length strings. |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
822 The default encoding is defined on the ``roundup.password.Password`` |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
823 class. |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
824 Date |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
825 properties store date-and-time stamps. Their values are Timestamp |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
826 objects. |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
827 Interval |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
828 properties store time periods rather than absolute dates. For |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
829 example 2 hours. |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
830 Integer |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
831 properties store integer values. (Number can store real/float values.) |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
832 Number |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
833 properties store numeric values. There is an option to use |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
834 double-precision floating point numbers. |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
835 Boolean |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
836 properties store on/off, yes/no, true/false values. |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
837 Link |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
838 properties refers to a single other item selected from a |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
839 specified class. The class is part of the property; the value is an |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
840 integer, the id of the chosen item. |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
841 Multilink |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
842 properties refer to possibly many items in a specified |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
843 class. The value is a list of integers. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
844 |
|
5064
46da0db55545
Document some existing property attributes
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5047
diff
changeset
|
845 Properties can have additional attributes to change the default |
|
46da0db55545
Document some existing property attributes
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5047
diff
changeset
|
846 behaviour: |
|
46da0db55545
Document some existing property attributes
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5047
diff
changeset
|
847 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
848 .. index:: triple: schema; property attributes; required |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
849 triple: schema; property attributes; default_value |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
850 triple: schema; property attributes; quiet |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
851 |
|
5239
15440504fb04
Spelling fix in design.txt.
John Rouillard <rouilj@ieee.org>
parents:
5232
diff
changeset
|
852 * All properties support the following attributes: |
|
15440504fb04
Spelling fix in design.txt.
John Rouillard <rouilj@ieee.org>
parents:
5232
diff
changeset
|
853 |
|
7276
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
854 - ``required``: see `design documentation`_. Adds the property to |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
855 the list returned by calling get_required_props for the class. |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
856 - ``default_value``: see `design documentation`_ Sets the default |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
857 value if the property is not set. |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
858 - ``quiet``: see `design documentation`_. Suppresses user visible |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
859 to changes to this property. The property change is not reported: |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
860 |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
861 - in the change feedback/confirmation message in the web |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
862 interface |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
863 - the property change section of the nosy email |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
864 - the web history at the bottom of an item's page |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
865 |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
866 This can be used to store state of the user interface (e.g. the |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
867 names of elements that are collapsed or hidden from the |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
868 user). Making properties that are updated as an indirect result of |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
869 a user's change (e.g. updating a blockers property, counting |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
870 number of times an issue was reopened or reassigned etc.) should |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
871 not be displayed to the user as they can be confusing. |
|
5239
15440504fb04
Spelling fix in design.txt.
John Rouillard <rouilj@ieee.org>
parents:
5232
diff
changeset
|
872 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
873 .. index:: triple: schema; property attributes; indexme |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
874 |
|
5064
46da0db55545
Document some existing property attributes
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5047
diff
changeset
|
875 * String properties can have an ``indexme`` attribute that defines if the |
|
5114
f74300d1494e
issue2550854: including new field in All text* search.
John Rouillard <rouilj@ieee.org>
parents:
5067
diff
changeset
|
876 property should be part of the full text index. The default is 'no' but this |
|
f74300d1494e
issue2550854: including new field in All text* search.
John Rouillard <rouilj@ieee.org>
parents:
5067
diff
changeset
|
877 can be set to 'yes' to allow a property's contents to be in the full |
|
f74300d1494e
issue2550854: including new field in All text* search.
John Rouillard <rouilj@ieee.org>
parents:
5067
diff
changeset
|
878 text index. |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
879 |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
880 .. index:: triple: schema; property attributes; use_double |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
881 |
|
5175
e1e40674a0bc
Implement double-precision Number
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5161
diff
changeset
|
882 * Number properties can have a ``use_double`` attribute that, when set |
|
e1e40674a0bc
Implement double-precision Number
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5161
diff
changeset
|
883 to ``True``, will use double precision floating point in the database. |
|
5064
46da0db55545
Document some existing property attributes
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5047
diff
changeset
|
884 * Link and Multilink properties can have several attributes: |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
885 |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
886 .. index:: triple: schema; property attributes; do_journal |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
887 |
|
5064
46da0db55545
Document some existing property attributes
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5047
diff
changeset
|
888 - ``do_journal``: By default, every change of a link property is |
|
46da0db55545
Document some existing property attributes
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5047
diff
changeset
|
889 recorded in the item being linked to (or being unlinked). A typical |
|
46da0db55545
Document some existing property attributes
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5047
diff
changeset
|
890 use-case for setting ``do_journal='no'`` would be to turn off |
|
46da0db55545
Document some existing property attributes
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5047
diff
changeset
|
891 journalling of nosy list, message author and message recipient link |
|
46da0db55545
Document some existing property attributes
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5047
diff
changeset
|
892 and unlink events to prevent the journal from clogged with these |
|
46da0db55545
Document some existing property attributes
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5047
diff
changeset
|
893 events. |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
894 |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
895 .. index:: triple: schema; property attributes; try_id_parsing |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
896 |
|
5064
46da0db55545
Document some existing property attributes
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5047
diff
changeset
|
897 - ``try_id_parsing`` is turned on by default. If entering a number |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
898 into a Link or Multilink field, Roundup interprets this number as an |
|
5064
46da0db55545
Document some existing property attributes
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5047
diff
changeset
|
899 ID of the item to link to. Sometimes items can have numeric names |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
900 (like, e.g., product codes). For these Roundup needs to match the |
|
5064
46da0db55545
Document some existing property attributes
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5047
diff
changeset
|
901 numeric name and should never match an ID. In this case you can set |
|
46da0db55545
Document some existing property attributes
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5047
diff
changeset
|
902 ``try_id_parsing='no'``. |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
903 |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
904 .. index:: triple: schema; property attributes; rev_multilink |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
905 |
|
6148
8497bf3f23a1
Allow to define reverse Multilinks
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5983
diff
changeset
|
906 - The ``rev_multilink`` option takes a property name to be inserted |
|
8497bf3f23a1
Allow to define reverse Multilinks
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5983
diff
changeset
|
907 into the linked-to class. This property is a Multilink property that |
|
8497bf3f23a1
Allow to define reverse Multilinks
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5983
diff
changeset
|
908 links back to the current class. The new Multilink is read-only (it |
|
6158
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
909 is automatically modified if the Link or Multilink property defining |
|
6148
8497bf3f23a1
Allow to define reverse Multilinks
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5983
diff
changeset
|
910 it is modified). The new property can be used in normal searches |
|
8497bf3f23a1
Allow to define reverse Multilinks
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5983
diff
changeset
|
911 using the "filter" method of the Class. This means it can be used |
|
8497bf3f23a1
Allow to define reverse Multilinks
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5983
diff
changeset
|
912 like other Multilink properties when searching (in an index |
|
6160
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
913 template) or via the REST and XMLRPC APIs. |
|
6158
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
914 |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
915 As a example, suppose you want to group multiple issues into a |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
916 super issue. Each issue can be part of only one super issue. It is |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
917 inefficient to find all of the issues that are part of the |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
918 super issue by searching through all issues in the system looking |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
919 at the part_of link property. To make this more efficient, you |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
920 can declare an issue's part_of property as:: |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
921 |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
922 issue = IssueClass(db, "issue", |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
923 ... |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
924 part_of = Link("issue", rev_multilink="components"), |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
925 ... ) |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
926 |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
927 This automatically creates the ``components`` multilink on the issue |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
928 class. The ``components`` multilink is never explicitly declared in |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
929 the issue class, but it has the same effect as though you had |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
930 declared the class as:: |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
931 |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
932 issue = IssueClass(db, "issue", |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
933 ... |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
934 part_of = Link("issue"), |
|
6159
cff2022364fc
Fix missing comma in rev_multilink doc example.
John Rouillard <rouilj@ieee.org>
parents:
6158
diff
changeset
|
935 components = Multilink("issue"), |
|
6158
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
936 ... ) |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
937 |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
938 Then wrote a detector to update the components property on the |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
939 corresponding issue. Writing this detector can be tricky. There is |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
940 one other difference, you can not explicitly set/modify the |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
941 ``components`` multilink. |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
942 |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
943 The effect of setting ``part_of = 3456`` on issue1234 |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
944 automatically adds "1234" to the ``components`` property on |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
945 issue3456. You can search the ``components`` multilink just like a |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
946 regular multilink, but you can't explicitly assign to it. |
|
6179
a701c9c81597
Fix rev_multilink properties search/retrieval
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6174
diff
changeset
|
947 Another difference of reverse multilinks to normal multilinks |
|
a701c9c81597
Fix rev_multilink properties search/retrieval
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6174
diff
changeset
|
948 is that when a linked node is retired, the node vanishes from the |
|
a701c9c81597
Fix rev_multilink properties search/retrieval
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6174
diff
changeset
|
949 multilink, e.g. in the example above, if an issue with ``part_of`` |
|
a701c9c81597
Fix rev_multilink properties search/retrieval
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6174
diff
changeset
|
950 set to another issue is retired this issue vanishes from the |
|
a701c9c81597
Fix rev_multilink properties search/retrieval
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6174
diff
changeset
|
951 ``components`` multilink of the other issue. |
|
6158
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
952 |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
953 You can also link between different classes. So you can modify |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
954 the issue definition to include:: |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
955 |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
956 issue = IssueClass(db, "issue", |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
957 ... |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
958 assigned_to = Link("user", rev_multilink="responsibleFor"), |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
959 ... ) |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
960 |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
961 This makes it easy to list all issues that the user is responsible |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
962 for (aka assigned_to). |
|
7cecf56b5bd4
Expand documentation on rev_multilink
John Rouillard <rouilj@ieee.org>
parents:
6148
diff
changeset
|
963 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
964 .. index:: triple: schema; property attributes; msg_header_property |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
965 |
|
5131
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
966 - The ``msg_header_property`` is used by the mail gateway when sending |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
967 out messages. When a link or multilink property of an issue changes, |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
968 Roundup creates email headers of the form:: |
|
5064
46da0db55545
Document some existing property attributes
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5047
diff
changeset
|
969 |
|
46da0db55545
Document some existing property attributes
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5047
diff
changeset
|
970 X-Roundup-issue-prop: value |
|
46da0db55545
Document some existing property attributes
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5047
diff
changeset
|
971 |
|
5131
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
972 where ``value`` is the ``name`` property for the linked item(s). |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
973 For example, if you have a multilink for attached_files in your |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
974 issue, you will see a header:: |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
975 |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
976 X-Roundup-issue-attached_files: MySpecialFile.doc, HisResume.txt |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
977 |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
978 when the class for attached files is defined as:: |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
979 |
|
6389
7fb49f0c2dad
collapse code example to one line.
John Rouillard <rouilj@ieee.org>
parents:
6334
diff
changeset
|
980 file = FileClass(db, "file", name=String()) |
|
5131
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
981 |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
982 ``MySpecialFile.doc`` is the name for the file object. |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
983 |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
984 If you have an ``assigned_to`` property in your issue class that |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
985 links to the user class and you want to add a header:: |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
986 |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
987 X-Roundup-issue-assigned_to: ... |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
988 |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
989 so that the mail recipients can filter emails where |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
990 ``X-Roundup-issue-assigned_to: name`` that contains their |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
991 username. The user class is defined as:: |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
992 |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
993 user = Class(db, "user", |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
994 username=String(), |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
995 password=Password(), |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
996 address=String(), |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
997 realname=String(), |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
998 phone=String(), |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
999 organisation=String(), |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
1000 alternate_addresses=String(), |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
1001 queries=Multilink('query'), |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
1002 roles=String(), # comma-separated string of Role names |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
1003 timezone=String()) |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
1004 |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
1005 Because there is no ``name`` parameter for the user class, there |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
1006 will be no header. However setting:: |
|
5135
9e8d8cd49f40
removing unneeded whitespace
John Rouillard <rouilj@ieee.org>
parents:
5131
diff
changeset
|
1007 |
|
9e8d8cd49f40
removing unneeded whitespace
John Rouillard <rouilj@ieee.org>
parents:
5131
diff
changeset
|
1008 assigned_to=Link("user", msg_header_property="username") |
|
5131
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
1009 |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
1010 will make the mail gateway generate an ``X-Roundup-issue-assigned_to`` |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
1011 using the username property of the linked user. |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
1012 |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
1013 Assume assigned_to for an issue is linked to the user with |
|
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
1014 username=joe_user, setting:: |
|
5064
46da0db55545
Document some existing property attributes
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5047
diff
changeset
|
1015 |
|
46da0db55545
Document some existing property attributes
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5047
diff
changeset
|
1016 msg_header_property="username" |
|
46da0db55545
Document some existing property attributes
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5047
diff
changeset
|
1017 |
|
46da0db55545
Document some existing property attributes
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5047
diff
changeset
|
1018 for the assigned_to property will generated message headers of the |
|
46da0db55545
Document some existing property attributes
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5047
diff
changeset
|
1019 form:: |
|
5131
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
1020 |
|
5064
46da0db55545
Document some existing property attributes
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5047
diff
changeset
|
1021 X-Roundup-issue-assigned_to: joe_user |
|
46da0db55545
Document some existing property attributes
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5047
diff
changeset
|
1022 |
|
5131
513803cade0a
from mailing list spurce up the documentation om msg_header_property. We may rename it, but that'a an easy patch
John Rouillard <rouilj@ieee.org>
parents:
5124
diff
changeset
|
1023 for emails sent on issues where joe_user has been assigned to the issue. |
|
5124
a927f9549af0
Fix issue2550751: Email Header Issue.
John Rouillard <rouilj@ieee.org>
parents:
5114
diff
changeset
|
1024 |
|
a927f9549af0
Fix issue2550751: Email Header Issue.
John Rouillard <rouilj@ieee.org>
parents:
5114
diff
changeset
|
1025 If this property is set to the empty string "", it will prevent |
|
a927f9549af0
Fix issue2550751: Email Header Issue.
John Rouillard <rouilj@ieee.org>
parents:
5114
diff
changeset
|
1026 the header from being generated on outgoing mail. |
|
5064
46da0db55545
Document some existing property attributes
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5047
diff
changeset
|
1027 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1028 .. index:: triple: schema; class property; creator |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1029 triple: schema; class property; creation |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1030 triple: schema; class property; actor |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1031 triple: schema; class property; activity |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1032 |
| 3097 | 1033 All Classes automatically have a number of properties by default: |
| 1034 | |
| 1035 *creator* | |
| 1036 Link to the user that created the item. | |
| 1037 *creation* | |
| 1038 Date the item was created. | |
| 1039 *actor* | |
| 1040 Link to the user that last modified the item. | |
| 1041 *activity* | |
| 1042 Date the item was last modified. | |
| 1043 | |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1044 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1045 .. index:: triple: schema; class property; content |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1046 triple: schema; class property; type |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1047 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1048 FileClass |
| 1098 | 1049 ~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1050 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1051 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
|
1052 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
|
1053 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
|
1054 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
|
1055 stored in the files sub-directory of the ``'db'`` directory in your |
|
3754
9f4dd27ae843
documentation cleanup from Luke Ross (patch [SF#1594860])
Richard Jones <richard@users.sourceforge.net>
parents:
3747
diff
changeset
|
1056 tracker. FileClasses also have a "type" attribute to store the MIME |
|
9f4dd27ae843
documentation cleanup from Luke Ross (patch [SF#1594860])
Richard Jones <richard@users.sourceforge.net>
parents:
3747
diff
changeset
|
1057 type of the file. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1058 |
|
6291
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1059 Roundup by default considers the contents of the file immutable. This |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1060 is to assist in maintaining an accurate record of correspondence. The |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1061 distributed tracker templates do not enforce this. So if you have |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1062 access to the Roundup tracker directory, you can edit the files (make |
|
6291
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1063 sure to preserve mode, owner and group) to remove information (e.g. if |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1064 somebody includes a password or you need to redact proprietary |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1065 information). Obviously the journal for the message/file will not |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1066 report that the file has changed. |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1067 |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1068 Best practice is to remove offending material and leave a |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1069 placeholder. E.G. replace a password with the text:: |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1070 |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1071 [password has been deleted 2020-12-02 --myname] |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1072 |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1073 If you need to delete an entire file, replace the file contents with:: |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1074 |
| 7294 | 1075 [file contents deleted due to spam 2020-10-21 --myname] |
|
6291
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1076 |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1077 rather than deleting the file. If you actually delete the file Roundup |
|
6291
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1078 will report an error to the user and email the administrator. If you |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1079 empty the file, a user downloading the file using the direct URL |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1080 (e.g. ``tracker/msg22``) may be confused and think something is broken |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1081 when they receive an empty file. Retiring a file/msg does not prevent |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1082 access to the file using the direct URL. Retiring an item only removes |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1083 it when requesting a list of all items in the class. If you are |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1084 replacing the contents, you probably want to change the content type |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1085 of the file. E.G. from ``image/jpeg`` to ``text/plain``. You can do |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1086 this easily through the web interface, or using the ``roundup-admin`` |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1087 command line interface. |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1088 |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1089 You can also change the contents of a file or message using the REST |
|
6293
5d6b3122f74c
Remove redundant words in doc.
John Rouillard <rouilj@ieee.org>
parents:
6291
diff
changeset
|
1090 interface. Note that this will NOT result in an entry in the journal, |
|
5d6b3122f74c
Remove redundant words in doc.
John Rouillard <rouilj@ieee.org>
parents:
6291
diff
changeset
|
1091 so again it allows a silent change. To do this you need to make two |
|
5d6b3122f74c
Remove redundant words in doc.
John Rouillard <rouilj@ieee.org>
parents:
6291
diff
changeset
|
1092 rest requests. An example using curl is:: |
|
6291
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1093 |
|
7276
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
1094 $ curl -u demo:demo -s |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
1095 -H "X-requested-with: rest" \ |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
1096 -H "Referer: https://tracker.example.com/demo/" \ |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
1097 -X GET \ |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
1098 https://tracker.example.com/demo/rest/data/file/30/content |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
1099 { |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
1100 "data": { |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
1101 "id": "30", |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
1102 "type": "<class 'str'>", |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
1103 "link": "https://tracker.example.com/demo/rest/data/file/30/content", |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
1104 "data": "hello3", |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
1105 "@etag": "\"3f2f8063dbce5b6bd43567e6f4f3c671\"" |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
1106 } |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
1107 } |
|
6291
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1108 |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1109 using the etag, overwrite the content with:: |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1110 |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1111 $ curl -u demo:demo -s |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1112 -H "X-requested-with: rest" \ |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1113 -H "Referer: https://tracker.example.com/demo/" \ |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1114 -H 'If-Match: "3f2f8063dbce5b6bd43567e6f4f3c671"' \ |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1115 -X PUT \ |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1116 -F "data=@hello" \ |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1117 https://tracker.example.com/demo/rest/data/file/30/content |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1118 |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1119 where ``hello`` is a file on local disk. |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1120 |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1121 You can enforce immutability in your tracker by adding an auditor (see |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1122 detectors_) for the file/msg class that rejects changes to the content |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1123 property. The auditor could also add a journal entry so that a change |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1124 via the Roundup mechanism is reported. Using a mixin (see: |
|
6291
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1125 https://wiki.roundup-tracker.org/MixinClassFileClass) to augment the |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1126 file class allows for other possibilities including signing the file, or |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1127 recording a checksum in the database and validating the file contents |
|
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1128 at the time it gets read. This allows detection of changes done on the |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1129 filesystem outside of the Roundup mechanism. |
|
6291
a67e2b559e8d
Document changing FileClass content files.
John Rouillard <rouilj@ieee.org>
parents:
6289
diff
changeset
|
1130 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1131 .. index:: triple: schema; class property; messages |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1132 triple: schema; class property; files |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1133 triple: schema; class property; nosy |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1134 triple: schema; class property; superseder |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1135 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1136 IssueClass |
| 1098 | 1137 ~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1138 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1139 IssueClasses automatically include the "messages", "files", "nosy", and |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1140 "superseder" properties. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1141 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1142 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
|
1143 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
|
1144 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
|
1145 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
|
1146 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
|
1147 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
|
1148 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1149 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
|
1150 "creator" properties. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1151 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1152 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
|
1153 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
|
1154 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
|
1155 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
|
1156 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
|
1157 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1158 .. index: triple: schema; class method; setkey |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1159 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1160 setkey(property) |
| 1098 | 1161 ~~~~~~~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1162 |
|
6174
5522c950a2e4
Add indexing for roundup-admin references.
John Rouillard <rouilj@ieee.org>
parents:
6171
diff
changeset
|
1163 .. index:: roundup-admin; setting assignedto on an issue |
|
5522c950a2e4
Add indexing for roundup-admin references.
John Rouillard <rouilj@ieee.org>
parents:
6171
diff
changeset
|
1164 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1165 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
|
1166 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
|
1167 by the content of the key property. That is, we can refer to users by |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1168 their username: for example, let's say that there's an issue in Roundup, |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1169 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
|
1170 assign an issue to him, we could do either of:: |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1171 |
|
1570
93e0a565cee5
fix the "set" command usage statement
Richard Jones <richard@users.sourceforge.net>
parents:
1568
diff
changeset
|
1172 roundup-admin set issue23 assignedto=2 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1173 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1174 or:: |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1175 |
|
1570
93e0a565cee5
fix the "set" command usage statement
Richard Jones <richard@users.sourceforge.net>
parents:
1568
diff
changeset
|
1176 roundup-admin set issue23 assignedto=richard |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1177 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1178 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
|
1179 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1180 .. index: triple: schema; class method; setlabelprop |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1181 |
|
3476
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
1182 setlabelprop(property) |
|
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
1183 ~~~~~~~~~~~~~~~~~~~~~~ |
|
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
1184 |
|
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
1185 Select a property of the class to be the label property. The label |
|
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
1186 property is used whereever an item should be uniquely identified, e.g., |
|
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
1187 when displaying a link to an item. If setlabelprop is not specified for |
|
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
1188 a class, the following values are tried for the label: |
|
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
1189 |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1190 * the key of the class (see the `setkey(property)`_ section above) |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1191 * the "name" property |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1192 * the "title" property |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1193 * the first property from the sorted property name list |
|
3476
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
1194 |
|
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
1195 So in most cases you can get away without specifying setlabelprop |
|
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
1196 explicitly. |
|
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
1197 |
|
5268
cc79c0f1651d
Adding a little more doc describing that view access to the labelprop
John Rouillard <rouilj@ieee.org>
parents:
5248
diff
changeset
|
1198 You should make sure that users have View access to this property or |
|
cc79c0f1651d
Adding a little more doc describing that view access to the labelprop
John Rouillard <rouilj@ieee.org>
parents:
5248
diff
changeset
|
1199 the id property for a class. If the property can not be viewed by a |
|
cc79c0f1651d
Adding a little more doc describing that view access to the labelprop
John Rouillard <rouilj@ieee.org>
parents:
5248
diff
changeset
|
1200 user, looping over items in the class (e.g. messages attached to an |
|
cc79c0f1651d
Adding a little more doc describing that view access to the labelprop
John Rouillard <rouilj@ieee.org>
parents:
5248
diff
changeset
|
1201 issue) will not work. |
|
cc79c0f1651d
Adding a little more doc describing that view access to the labelprop
John Rouillard <rouilj@ieee.org>
parents:
5248
diff
changeset
|
1202 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1203 .. index: triple: schema; class method; setorderprop |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1204 |
|
3476
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
1205 setorderprop(property) |
|
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
1206 ~~~~~~~~~~~~~~~~~~~~~~ |
|
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
1207 |
|
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
1208 Select a property of the class to be the order property. The order |
|
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
1209 property is used whenever using a default sort order for the class, |
|
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
1210 e.g., when grouping or sorting class A by a link to class B in the user |
|
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
1211 interface, the order property of class B is used for sorting. If |
|
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
1212 setorderprop is not specified for a class, the following values are tried |
|
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
1213 for the order property: |
|
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
1214 |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1215 * the property named "order" |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1216 * the label property (see `setlabelprop(property)`_ above) |
|
3476
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
1217 |
|
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
1218 So in most cases you can get away without specifying setorderprop |
|
1142dafe0d7f
added setorderprop() and setlabelprop() to Class (lots of patches)
Richard Jones <richard@users.sourceforge.net>
parents:
3470
diff
changeset
|
1219 explicitly. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1220 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1221 .. index: triple: schema; class method; create |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1222 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1223 create(information) |
| 1098 | 1224 ~~~~~~~~~~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1225 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1226 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
|
1227 in the "definitional" classes like "priority" and "status". |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1228 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1229 .. index: schema; item ordering |
|
684
5b23ff865f3a
added a "detectors" directory...
Richard Jones <richard@users.sourceforge.net>
parents:
673
diff
changeset
|
1230 |
|
2897
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
1231 A note about ordering |
|
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
1232 ~~~~~~~~~~~~~~~~~~~~~ |
|
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
1233 |
|
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
1234 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
|
1235 depending on the properties being sorted on: |
|
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
1236 |
|
5067
e424987d294a
Add support for an integer type to join the existing number type.
John Rouillard <rouilj@ieee.org>
parents:
5064
diff
changeset
|
1237 1. If it's a String, Integer, Number, Date or Interval property, we |
|
e424987d294a
Add support for an integer type to join the existing number type.
John Rouillard <rouilj@ieee.org>
parents:
5064
diff
changeset
|
1238 just sort the scalar value of the property. Strings are sorted |
|
e424987d294a
Add support for an integer type to join the existing number type.
John Rouillard <rouilj@ieee.org>
parents:
5064
diff
changeset
|
1239 case-sensitively. |
|
2897
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
1240 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
|
1241 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
|
1242 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
|
1243 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
|
1244 so on. |
|
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
1245 |
|
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
1246 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
|
1247 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
|
1248 property, or sorting will result in random ordering. |
|
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
1249 |
|
21a0b049fed8
notes about sorting
Richard Jones <richard@users.sourceforge.net>
parents:
2886
diff
changeset
|
1250 |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1251 Examples of adding to your schema |
| 1098 | 1252 --------------------------------- |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1253 |
| 6163 | 1254 Some examples are in the :ref:`CustomExamples` section below. |
| 1255 | |
|
7276
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
1256 Also you can start with `Roundup wiki CategorySchema`_ to see a list |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
1257 of additional examples of how schemas can be customised to add new |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
1258 functionality. |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
1259 |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
1260 .. _Roundup wiki CategorySchema: |
|
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
1261 https://wiki.roundup-tracker.org/CategorySchema |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1262 |
| 6163 | 1263 .. index:: !detectors |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1264 .. _detectors: |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1265 .. _Auditors and reactors: |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
1266 |
|
684
5b23ff865f3a
added a "detectors" directory...
Richard Jones <richard@users.sourceforge.net>
parents:
673
diff
changeset
|
1267 Detectors - adding behaviour to your tracker |
| 1098 | 1268 ============================================ |
|
684
5b23ff865f3a
added a "detectors" directory...
Richard Jones <richard@users.sourceforge.net>
parents:
673
diff
changeset
|
1269 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1270 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
|
1271 you're free to add and remove them any time, even after the database is |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
1272 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
|
1273 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1274 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
|
1275 (**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
|
1276 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
|
1277 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
|
1278 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
|
1279 for you are: |
|
907
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
1280 |
| 6163 | 1281 .. index:: detectors; installed |
| 1282 | |
|
907
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
1283 **nosyreaction.py** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1284 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
|
1285 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
|
1286 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
|
1287 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
|
1288 (such as adding new authors, etc.) |
|
907
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
1289 **statusauditor.py** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1290 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
|
1291 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
|
1292 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
|
1293 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
|
1294 defined. |
|
1777
fbe08359511a
customisation doc update
Richard Jones <richard@users.sourceforge.net>
parents:
1773
diff
changeset
|
1295 **messagesummary.py** |
|
fbe08359511a
customisation doc update
Richard Jones <richard@users.sourceforge.net>
parents:
1773
diff
changeset
|
1296 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
|
1297 content. |
|
fbe08359511a
customisation doc update
Richard Jones <richard@users.sourceforge.net>
parents:
1773
diff
changeset
|
1298 **userauditor.py** |
|
fbe08359511a
customisation doc update
Richard Jones <richard@users.sourceforge.net>
parents:
1773
diff
changeset
|
1299 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
|
1300 roles lists). |
|
fbe08359511a
customisation doc update
Richard Jones <richard@users.sourceforge.net>
parents:
1773
diff
changeset
|
1301 |
|
fbe08359511a
customisation doc update
Richard Jones <richard@users.sourceforge.net>
parents:
1773
diff
changeset
|
1302 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
|
1303 or remove these detectors. |
|
907
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
1304 |
|
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
1305 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
|
1306 interface for detectors. |
|
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
1307 |
|
909
ef9c759c243e
Fix to hasPermission, thanks Stefan Seefeld.
Richard Jones <richard@users.sourceforge.net>
parents:
907
diff
changeset
|
1308 __ design.html |
|
907
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
1309 |
| 2209 | 1310 |
| 6163 | 1311 .. index:: detectors; writing api |
| 1312 | |
| 2209 | 1313 Detector API |
| 1314 ------------ | |
| 1315 | |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1316 .. index:: pair: detectors; auditors |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1317 single: auditors; function signature |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1318 single: auditors; defining |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1319 single: auditors; arguments |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1320 |
| 2209 | 1321 Auditors are called with the arguments:: |
| 1322 | |
| 1323 audit(db, cl, itemid, newdata) | |
| 1324 | |
| 1325 where ``db`` is the database, ``cl`` is an instance of Class or | |
| 1326 IssueClass within the database, and ``newdata`` is a dictionary mapping | |
| 1327 property names to values. | |
| 1328 | |
| 1329 For a ``create()`` operation, the ``itemid`` argument is None and | |
| 1330 newdata contains all of the initial property values with which the item | |
| 1331 is about to be created. | |
| 1332 | |
| 1333 For a ``set()`` operation, newdata contains only the names and values of | |
| 1334 properties that are about to be changed. | |
| 1335 | |
| 1336 For a ``retire()`` or ``restore()`` operation, newdata is None. | |
| 1337 | |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1338 .. index:: pair: detectors; reactor |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1339 single: reactors; function signature |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1340 single: reactors; defining |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1341 single: reactors; arguments |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1342 |
| 2209 | 1343 Reactors are called with the arguments:: |
| 1344 | |
| 1345 react(db, cl, itemid, olddata) | |
| 1346 | |
| 1347 where ``db`` is the database, ``cl`` is an instance of Class or | |
| 1348 IssueClass within the database, and ``olddata`` is a dictionary mapping | |
| 1349 property names to values. | |
| 1350 | |
| 1351 For a ``create()`` operation, the ``itemid`` argument is the id of the | |
| 1352 newly-created item and ``olddata`` is None. | |
| 1353 | |
| 1354 For a ``set()`` operation, ``olddata`` contains the names and previous | |
| 1355 values of properties that were changed. | |
| 1356 | |
| 1357 For a ``retire()`` or ``restore()`` operation, ``itemid`` is the id of | |
| 1358 the retired or restored item and ``olddata`` is None. | |
| 1359 | |
| 6163 | 1360 .. index:: detectors; additional |
| 2209 | 1361 |
|
2193
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
1362 Additional Detectors Ready For Use |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
1363 ---------------------------------- |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
1364 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1365 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
|
1366 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
|
1367 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
|
1368 |
|
4695
132650f4700a
#2550782: Added a new irker detector to send notifications on IRC when an issue is created or messages are added.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
4656
diff
changeset
|
1369 **irker.py** |
|
132650f4700a
#2550782: Added a new irker detector to send notifications on IRC when an issue is created or messages are added.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
4656
diff
changeset
|
1370 This detector sends notification on IRC through an irker daemon |
|
132650f4700a
#2550782: Added a new irker detector to send notifications on IRC when an issue is created or messages are added.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
4656
diff
changeset
|
1371 (http://www.catb.org/esr/irker/) when issues are created or messages |
|
132650f4700a
#2550782: Added a new irker detector to send notifications on IRC when an issue is created or messages are added.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
4656
diff
changeset
|
1372 are added. In order to use it you need to install irker, start the |
|
132650f4700a
#2550782: Added a new irker detector to send notifications on IRC when an issue is created or messages are added.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
4656
diff
changeset
|
1373 irkerd daemon, and add an ``[irker]`` section in ``detectors/config.ini`` |
|
132650f4700a
#2550782: Added a new irker detector to send notifications on IRC when an issue is created or messages are added.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
4656
diff
changeset
|
1374 that contains a comma-separated list of channels where the messages should |
|
132650f4700a
#2550782: Added a new irker detector to send notifications on IRC when an issue is created or messages are added.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
4656
diff
changeset
|
1375 be sent, e.g. ``channels = irc://chat.freenode.net/channelname``. |
|
907
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
899
diff
changeset
|
1376 **newissuecopy.py** |
|
684
5b23ff865f3a
added a "detectors" directory...
Richard Jones <richard@users.sourceforge.net>
parents:
673
diff
changeset
|
1377 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
|
1378 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
|
1379 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
|
1380 email errors! |
|
2193
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
1381 **creator_resolution.py** |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
1382 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
|
1383 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
|
1384 "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
|
1385 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
|
1386 **email_auditor.py** |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
1387 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
|
1388 extension .eml. |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
2180
diff
changeset
|
1389 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
|
1390 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
|
1391 they'll just give you an incomprehensible error message. For more |
|
7276
90c70726e882
Fix: nested lists, wide example, wiki schema examples
John Rouillard <rouilj@ieee.org>
parents:
7268
diff
changeset
|
1392 information, see the detector code - it has a lengthy explanation. |
| 1091 | 1393 |
|
684
5b23ff865f3a
added a "detectors" directory...
Richard Jones <richard@users.sourceforge.net>
parents:
673
diff
changeset
|
1394 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1395 .. index:: auditors; rules for use |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1396 single: reactors; rules for use |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1397 |
|
2129
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
1398 Auditor or Reactor? |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
1399 ------------------- |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
1400 |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
1401 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
|
1402 |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
1403 **Auditors** |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
1404 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
|
1405 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
|
1406 **Reactors** |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
1407 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
|
1408 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
|
1409 detector loops. |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
1410 |
|
2138
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
1411 |
|
2129
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
1412 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
|
1413 --------------------------------------- |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
1414 |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
1415 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
|
1416 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
|
1417 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
|
1418 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
|
1419 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
|
1420 |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
1421 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
|
1422 |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
1423 from roundup.exceptions import Reject |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
1424 |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
1425 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
|
1426 |
|
5004
494d255043c9
Display errors containing HTML with RejectRaw (issue2550847)
John Kristensen <john@jerrykan.com>
parents:
4975
diff
changeset
|
1427 raise Reject('Description of error') |
|
494d255043c9
Display errors containing HTML with RejectRaw (issue2550847)
John Kristensen <john@jerrykan.com>
parents:
4975
diff
changeset
|
1428 |
|
494d255043c9
Display errors containing HTML with RejectRaw (issue2550847)
John Kristensen <john@jerrykan.com>
parents:
4975
diff
changeset
|
1429 Error messages raised with ``Reject`` automatically have any HTML content |
|
494d255043c9
Display errors containing HTML with RejectRaw (issue2550847)
John Kristensen <john@jerrykan.com>
parents:
4975
diff
changeset
|
1430 escaped before being displayed to the user. To display an error message to the |
|
494d255043c9
Display errors containing HTML with RejectRaw (issue2550847)
John Kristensen <john@jerrykan.com>
parents:
4975
diff
changeset
|
1431 user without performing any HTML escaping the ``RejectRaw`` should be used. All |
|
494d255043c9
Display errors containing HTML with RejectRaw (issue2550847)
John Kristensen <john@jerrykan.com>
parents:
4975
diff
changeset
|
1432 security implications should be carefully considering before using |
|
494d255043c9
Display errors containing HTML with RejectRaw (issue2550847)
John Kristensen <john@jerrykan.com>
parents:
4975
diff
changeset
|
1433 ``RejectRaw``. |
|
2129
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
1434 |
|
3fd672293712
add and use Reject exception [SF#700265]
Richard Jones <richard@users.sourceforge.net>
parents:
2122
diff
changeset
|
1435 |
|
2138
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
1436 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
|
1437 ----------------------------- |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
1438 |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
1439 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
|
1440 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
|
1441 |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
1442 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
|
1443 ``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
|
1444 messages which only consist of a change note (ie. the message id parameter |
|
3463
da8fe3566f67
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
3429
diff
changeset
|
1445 is not required - this is referred to as a "System Message" because it |
|
da8fe3566f67
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
3429
diff
changeset
|
1446 comes from "the system" and not a user). |
|
2138
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
1447 |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
1448 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1449 .. index:: extensions |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1450 .. index:: extensions; add python functions to tracker |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1451 .. _extensions: |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1452 .. _actions: |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1453 |
|
4921
8430576a5625
doc: Reverse engineer extension handling and add separate chapter
anatoly techtonik <techtonik@gmail.com>
parents:
4891
diff
changeset
|
1454 Extensions - adding capabilities to your tracker |
|
8430576a5625
doc: Reverse engineer extension handling and add separate chapter
anatoly techtonik <techtonik@gmail.com>
parents:
4891
diff
changeset
|
1455 ================================================ |
|
8430576a5625
doc: Reverse engineer extension handling and add separate chapter
anatoly techtonik <techtonik@gmail.com>
parents:
4891
diff
changeset
|
1456 |
|
8430576a5625
doc: Reverse engineer extension handling and add separate chapter
anatoly techtonik <techtonik@gmail.com>
parents:
4891
diff
changeset
|
1457 While detectors_ add new behavior by reacting to changes in tracked |
|
8430576a5625
doc: Reverse engineer extension handling and add separate chapter
anatoly techtonik <techtonik@gmail.com>
parents:
4891
diff
changeset
|
1458 objects, `extensions` add new actions and utilities to Roundup, which |
|
8430576a5625
doc: Reverse engineer extension handling and add separate chapter
anatoly techtonik <techtonik@gmail.com>
parents:
4891
diff
changeset
|
1459 are mostly used to enhance web interface. |
|
8430576a5625
doc: Reverse engineer extension handling and add separate chapter
anatoly techtonik <techtonik@gmail.com>
parents:
4891
diff
changeset
|
1460 |
|
8430576a5625
doc: Reverse engineer extension handling and add separate chapter
anatoly techtonik <techtonik@gmail.com>
parents:
4891
diff
changeset
|
1461 You can create an extension by creating Python file in your tracker |
|
8430576a5625
doc: Reverse engineer extension handling and add separate chapter
anatoly techtonik <techtonik@gmail.com>
parents:
4891
diff
changeset
|
1462 ``extensions`` directory. All files from this dir are loaded when |
|
8430576a5625
doc: Reverse engineer extension handling and add separate chapter
anatoly techtonik <techtonik@gmail.com>
parents:
4891
diff
changeset
|
1463 tracker instance is created, at which point it calls ``init(instance)`` |
|
8430576a5625
doc: Reverse engineer extension handling and add separate chapter
anatoly techtonik <techtonik@gmail.com>
parents:
4891
diff
changeset
|
1464 from each file supplying itself as a first argument. |
|
8430576a5625
doc: Reverse engineer extension handling and add separate chapter
anatoly techtonik <techtonik@gmail.com>
parents:
4891
diff
changeset
|
1465 |
|
8430576a5625
doc: Reverse engineer extension handling and add separate chapter
anatoly techtonik <techtonik@gmail.com>
parents:
4891
diff
changeset
|
1466 Note that at this point web interface is not loaded, but extensions still |
|
8430576a5625
doc: Reverse engineer extension handling and add separate chapter
anatoly techtonik <techtonik@gmail.com>
parents:
4891
diff
changeset
|
1467 can register actions for in tracker instance. This may be fixed in |
|
8430576a5625
doc: Reverse engineer extension handling and add separate chapter
anatoly techtonik <techtonik@gmail.com>
parents:
4891
diff
changeset
|
1468 Roundup 1.6 by introducing ``init_web(client)`` callback or a more |
|
8430576a5625
doc: Reverse engineer extension handling and add separate chapter
anatoly techtonik <techtonik@gmail.com>
parents:
4891
diff
changeset
|
1469 flexible extension point mechanism. |
|
8430576a5625
doc: Reverse engineer extension handling and add separate chapter
anatoly techtonik <techtonik@gmail.com>
parents:
4891
diff
changeset
|
1470 |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1471 * ``instance.registerUtil`` is used for adding `templating utilities`_ |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1472 (see `adding a time log to your issues`_ for an example) |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1473 |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1474 * ``instance.registerAction`` is used to add more actions to instance |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1475 and to web interface. See `Defining new web actions`_ for details. |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1476 Generic action can be added by inheriting from ``action.Action`` |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1477 instead of ``cgi.action.Action``. |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1478 |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1479 .. _interfaces.py: |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1480 .. _modifying the core of Roundup: |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1481 |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1482 interfaces.py - hooking into the core of Roundup |
|
5980
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1483 ================================================ |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1484 |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1485 There is a magic trick for hooking into the core of Roundup. Using |
|
5980
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1486 this you can: |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1487 |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1488 * modify class data structures |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1489 * monkey patch core code to add new functionality |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1490 * modify the email gateway |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1491 * add new rest endpoints |
|
5980
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1492 |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1493 but with great power comes great responsibility. |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1494 |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1495 Interfaces.py has been around since the earliest releases of Roundup |
|
5980
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1496 and used to be the main way to get a lot of customization done. In |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1497 modern Roundup, the extensions_ mechanism is used, but there are |
|
6470
60532cafc62a
sys.path when interfaces.py is invoked
John Rouillard <rouilj@ieee.org>
parents:
6466
diff
changeset
|
1498 places where interfaces.py is still useful. Note that the tracker |
|
60532cafc62a
sys.path when interfaces.py is invoked
John Rouillard <rouilj@ieee.org>
parents:
6466
diff
changeset
|
1499 directories are not on the Python system path when interfaces.py is |
| 6687 | 1500 evaluated. You need to add library directories explictly by |
|
6470
60532cafc62a
sys.path when interfaces.py is invoked
John Rouillard <rouilj@ieee.org>
parents:
6466
diff
changeset
|
1501 modifying sys.path. |
|
5980
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1502 |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1503 Example: Changing Cache-Control headers |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1504 --------------------------------------- |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1505 |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1506 The Client class in cgi/client.py has a lookup table that is used to |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1507 set the Cache-Control headers for static files. The entries in this |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1508 table are set from interfaces.py using:: |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1509 |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1510 from roundup.cgi.client import Client |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1511 |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1512 Client.Cache_Control['text/css'] = "public, max-age=3600" |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1513 Client.Cache_Control['application/javascript'] = "public, max-age=30" |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1514 Client.Cache_Control['rss.xml'] = "public, max-age=900" |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1515 Client.Cache_Control['local.js'] = "public, max-age=7200" |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1516 |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1517 In this case static files delivered using @@file will have cache |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1518 headers set. These files are searched for along the `static_files` |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1519 path in the tracker's `config.ini`. In the example above: |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1520 |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1521 * a css file (e.g. @@file/style.css) will be cached for an hour |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1522 * javascript files (e.g. @@file/libraries/jquery.js) will be cached |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1523 for 30 seconds |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1524 * a file named rss.xml will be cached for 15 minutes |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1525 * a file named local.js will be cached for 2 hours |
|
5980
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1526 |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1527 Note that a file name match overrides the mime type settings. |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1528 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1529 |
|
5980
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1530 Example: Implement password complexity checking |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1531 ----------------------------------------------- |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1532 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1533 .. index:: tracker; lib directory (example) |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
1534 |
|
5980
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1535 This example uses the zxcvbn_ module that you can place in the zxcvbn |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1536 subdirectory of your tracker's lib directory. |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1537 |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1538 If you add this to the interfaces.py file in the root directory of |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1539 your tracker (same place as schema.py):: |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1540 |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1541 import roundup.password as password |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1542 from roundup.exceptions import Reject |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1543 from zxcvbn import zxcvbn |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1544 |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1545 # monkey patch the setPassword method with this method |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1546 # that checks password strength. |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1547 origPasswordFunc = password.Password.setPassword |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1548 def mpPasswordFunc(self, plaintext, scheme, config=None): |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1549 """ Replace the password set function with one that |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1550 verifies that the password is complex enough. It |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1551 has to be done at this point and not in an auditor |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1552 as the auditor only sees the encrypted password. |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1553 """ |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1554 results = zxcvbn(plaintext) |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1555 if results['score'] < 3: |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1556 l = [] |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1557 map(l.extend, [[results['feedback']['warning']], results['feedback']['suggestions']]) |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1558 errormsg = " ".join(l) |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1559 raise Reject ("Password is too easy to guess. " + errormsg) |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1560 return origPasswordFunc(self, plaintext, scheme, config=config) |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1561 |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1562 password.Password.setPassword = mpPasswordFunc |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1563 |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1564 it replaces the setPassword method in the Password class. The new |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1565 version validates that the password is sufficiently complex. Then it |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1566 passes off the setting of password to the original method. |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1567 |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1568 Example: Enhance time intervals |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1569 ------------------------------- |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1570 |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1571 To make the user interface easier to use, you may want to support |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1572 other forms for intervals. For example you can support an interval |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1573 like 1.5 by interpreting it the same as 1:30 (1 hour 30 minutes). |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1574 Also you can allow a bare integer (e.g. 45) as a number of minutes. |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1575 |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1576 To do this we intercept the from_raw method of the Interval class in |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1577 hyperdb.py with:: |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1578 |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1579 import roundup.hyperdb as hyperdb |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1580 origFrom_Raw = hyperdb.Interval.from_raw |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1581 |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1582 def normalizeperiod(self, value, **kw): |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1583 ''' Convert alternate time forms into standard interval format |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1584 |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1585 [+-] [#y] [#m] [#w] [#d] [[[H]H:MM]:SS] |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1586 |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1587 if value is float, it's hour and fractional hours |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1588 if value is integer, it's number of minutes |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1589 ''' |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1590 if ":" not in value: |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1591 # Not a specified interval |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1592 # if int consider number of minutes |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1593 try: |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1594 isMinutes = int(value) |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1595 minutes = isMinutes%60 |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1596 hours = (isMinutes - minutes) / 60 |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1597 value = "%d:%d"%(hours,minutes) |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1598 except ValueError: |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1599 pass |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1600 # if float, consider it number of hours and fractional hours. |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1601 import math |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1602 try: |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1603 afterdecimal, beforedecimal = math.modf(float(value)) |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1604 value = "%d:%d"%(beforedecimal,60*afterdecimal) |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1605 except ValueError: |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1606 pass |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1607 |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1608 return origFrom_Raw(self, value, **kw) |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1609 |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1610 hyperdb.Interval.from_raw = normalizeperiod |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1611 |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1612 any call to convert an interval from raw form now has two simpler |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1613 (and more friendly) ways to specify common time intervals. |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1614 |
|
5983
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1615 Example: Modifying the mail gateway |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1616 ----------------------------------- |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1617 |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1618 One site receives email on a main gateway. The virtual alias delivery |
|
6160
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
1619 table on the postfix server is configured with:: |
|
5983
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1620 |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1621 test-issues@example.com roundup-test@roundup-vm.example.com |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1622 test-support@example.com roundup-test+support-a@roundup-vm.example.com |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1623 test@support.example.com roundup-test+support-b@roundup-vm.example.com |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1624 |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1625 These modifications to the mail gateway for Roundup allows anonymous |
|
5983
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1626 submissions. It hides all of the requesters under the "support" |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1627 user. It also makes some other modifications to the mail parser |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1628 allowing keywords to be set and prefixes to be defined based on the |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1629 delivery alias. |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1630 |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1631 This is the entry in interfaces.py:: |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1632 |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1633 import roundup.mailgw |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1634 import email.utils |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1635 |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1636 class SupportTracker(object): |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1637 def __init__(self, prefix=None, keyword=None): |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1638 self.prefix = prefix |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1639 self.keyword = keyword |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1640 |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1641 # Define new prefixes and keywords based on local address. |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1642 support_trackers = { |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1643 ### production instances ### |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1644 |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1645 ### test instances ### |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1646 'roundup-test+support-a': |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1647 SupportTracker(prefix='Support 1', keyword='support1'), |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1648 'roundup-test+support-b': |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1649 SupportTracker(prefix='Support 2', keyword='support2'), |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1650 'roundup-test2+support-a': |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1651 SupportTracker(prefix='Support 1', keyword='support1'), |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1652 'roundup-test2+support-b': |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1653 SupportTracker(prefix='Support 2', keyword='support2'), |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1654 } |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1655 |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1656 class parsedMessage(roundup.mailgw.parsedMessage): |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1657 def __init__(self, mailgw, message, support_tracker): |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1658 roundup.mailgw.parsedMessage.__init__(self, mailgw, message) |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1659 if support_tracker.prefix: |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1660 self.prefix = '%s: ' % support_tracker.prefix |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1661 else: |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1662 self.prefix = '' |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1663 self.keywords = [] |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1664 if support_tracker.keyword: |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1665 try: |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1666 self.keywords = [ |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1667 self.db.keyword.lookup(support_tracker.keyword)] |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1668 except KeyError: |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1669 pass |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1670 self.config.ADD_AUTHOR_TO_NOSY = 'no' |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1671 self.config.ADD_RECIPIENTS_TO_NOSY = 'no' |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1672 self.config.MAILGW_KEEP_QUOTED_TEXT = 'yes' |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1673 self.config.MAILGW_LEAVE_BODY_UNCHANGED = 'yes' |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1674 self.classname = 'issue' |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1675 self.pfxmode = 'loose' |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1676 self.sfxmode = 'none' |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1677 # set the support user id |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1678 self.fixed_author = self.db.user.lookup('support') |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1679 self.fixed_props = { |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1680 'nosy': [self.fixed_author], |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1681 'keyword': self.keywords, |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1682 } |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1683 |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1684 def handle_help(self): |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1685 pass |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1686 |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1687 def check_subject(self): |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1688 if not self.subject: |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1689 self.subject = 'no subject' |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1690 |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1691 def rego_confirm(self): |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1692 pass |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1693 |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1694 def get_author_id(self): |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1695 # force the support user to be the author |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1696 self.author = self.fixed_author |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1697 |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1698 def get_props(self): |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1699 self.props = {} |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1700 if not self.nodeid: |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1701 self.props.update(self.fixed_props) |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1702 self.props['title'] = ("%s%s" % ( |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1703 self.prefix, self.subject.replace('[', '(').replace(']', ')'))) |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1704 |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1705 def get_content_and_attachments(self): |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1706 roundup.mailgw.parsedMessage.get_content_and_attachments(self) |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1707 if not self.content: |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1708 self.content = 'no text' |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1709 intro = [] |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1710 for header in ['From', 'To', 'Cc']: |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1711 for addr in self.message.getaddrlist(header): |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1712 intro.append('%s: %s' % (header, email.utils.formataddr(addr))) |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1713 intro.append('Subject: %s' % self.subject) |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1714 intro.append('\n') |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1715 self.content = '\n'.join(intro) + self.content |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1716 |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1717 class MailGW(roundup.mailgw.MailGW): |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1718 def parsed_message_class(self, mailgw, message): |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1719 support_tracker = None |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1720 # The delivered-to header is unique to postfix |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1721 # it is the target address: |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1722 # roundup-test+support-a@roundup-vm.example.com |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1723 # rather than |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1724 # test-support@example.com |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1725 recipients = message.getaddrlist('delivered-to') |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1726 if recipients: |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1727 localpart = recipients[0][1].rpartition('@')[0] |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1728 support_tracker = support_trackers.get(localpart) |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1729 if support_tracker: |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1730 # parse the mesage using the parsedMessage class |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1731 # defined above. |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1732 return parsedMessage(mailgw, message, support_tracker) |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1733 else: |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1734 # parse the message normally |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1735 return roundup.mailgw.parsedMessage(mailgw, message) |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1736 |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1737 This is the most complex example section. The mail gateway is also one |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
1738 of the more complex subsystems in Roundup, and modifying it is not |
|
5983
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1739 trivial. |
|
d877a2ac5ae4
Added mailgw interfaces.py example from Thomas Arendsen Hein
John Rouillard <rouilj@ieee.org>
parents:
5980
diff
changeset
|
1740 |
|
5980
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1741 Other Examples |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1742 -------------- |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1743 |
|
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1744 See the `rest interface documentation`_ for instructions on how to add |
|
7289
74778ed75aad
Add changing rest rate limiting to interface.py section.
John Rouillard <rouilj@ieee.org>
parents:
7276
diff
changeset
|
1745 new rest endpoints or `change the rate limiting method`_ using interfaces.py. |
|
5980
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
1746 |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
1747 Database Content |
| 1098 | 1748 ================ |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
1749 |
| 3052 | 1750 .. note:: |
|
3754
9f4dd27ae843
documentation cleanup from Luke Ross (patch [SF#1594860])
Richard Jones <richard@users.sourceforge.net>
parents:
3747
diff
changeset
|
1751 If you modify the content of definitional classes, you'll most |
| 3052 | 1752 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
|
1753 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1754 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
|
1755 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
|
1756 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
|
1757 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
|
1758 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
1759 **Changing content before tracker initialisation** |
|
3241
78d2f3ce85f6
filename change
Richard Jones <richard@users.sourceforge.net>
parents:
3228
diff
changeset
|
1760 Edit the initial_data.py module in your tracker to alter the items |
|
78d2f3ce85f6
filename change
Richard Jones <richard@users.sourceforge.net>
parents:
3228
diff
changeset
|
1761 created using the ``create( ... )`` methods. |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
1762 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
1763 **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
|
1764 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
|
1765 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
|
1766 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
|
1767 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1768 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
|
1769 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
|
1770 question. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1771 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1772 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
|
1773 requires database content changes. |
|
898
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
1774 |
|
5ffac75a7f2e
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
798
diff
changeset
|
1775 |
|
2003
a291bf753037
maintenance -> admin guide
Richard Jones <richard@users.sourceforge.net>
parents:
1998
diff
changeset
|
1776 Security / Access Controls |
|
a291bf753037
maintenance -> admin guide
Richard Jones <richard@users.sourceforge.net>
parents:
1998
diff
changeset
|
1777 ========================== |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1778 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1779 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
|
1780 |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1781 - Create (everything) |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1782 - Edit (everything) |
|
6466
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1783 - Search (everything) (used if View does not permit access) |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1784 - View (everything) |
|
4296
72463e22640d
fix some more documentation for the Register permission
Richard Jones <richard@users.sourceforge.net>
parents:
4088
diff
changeset
|
1785 - Register (User class only) |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1786 |
|
3276
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1787 These are assigned to the "Admin" Role by default, and allow a user to do |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1788 anything. Every Class you define in your `tracker schema`_ also gets an |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1789 Create, Edit and View Permission of its own. The web and email interfaces |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1790 also define: |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1791 |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1792 *Email Access* |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1793 If defined, the user may use the email interface. Used by default to deny |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1794 Anonymous users access to the email interface. When granted to the |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1795 Anonymous user, they will be automatically registered by the email |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1796 interface (see also the ``new_email_user_roles`` configuration option). |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1797 *Web Access* |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1798 If defined, the user may use the web interface. All users are able to see |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1799 the login form, regardless of this setting (thus enabling logging in). |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1800 *Web Roles* |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1801 Controls user access to editing the "roles" property of the "user" class. |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1802 TODO: deprecate in favour of a property-based control. |
|
6160
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
1803 *Rest Access* and *Xmlrpc Access* |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
1804 These control access to the Rest and Xmlrpc endpoints. The Admin and User |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
1805 roles have these by default in the classic tracker. See the |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
1806 `directions in the rest interface documentation`_ and the |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
1807 `xmlrpc interface documentation`_. |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1808 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1809 These are hooked into the default Roles: |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1810 |
|
6466
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1811 - Admin (Create, Edit, Search, View and everything; Web Roles) |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1812 - User (Web Access; Email Access) |
|
3276
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1813 - Anonymous (Web Access) |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1814 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1815 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
|
1816 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
|
1817 |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1818 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
|
1819 |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1820 - 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
|
1821 - View priority, status |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1822 - View user |
|
3276
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1823 - Edit their own user record |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1824 |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1825 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
|
1826 |
|
3276
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1827 - Web interface access |
|
4296
72463e22640d
fix some more documentation for the Register permission
Richard Jones <richard@users.sourceforge.net>
parents:
4088
diff
changeset
|
1828 - Register user (for registration) |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1829 - 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
|
1830 |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1831 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
|
1832 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1833 # |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1834 # TRACKER SECURITY SETTINGS |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1835 # |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1836 # 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
|
1837 # about security setup. |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1838 |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1839 # |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1840 # REGULAR USERS |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1841 # |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1842 # Give the regular users access to the web and email interface |
|
3276
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1843 db.security.addPermissionToRole('User', 'Web Access') |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1844 db.security.addPermissionToRole('User', 'Email Access') |
|
6160
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
1845 db.security.addPermissionToRole('User', 'Rest Access') |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
1846 db.security.addPermissionToRole('User', 'Xmlrpc Access') |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1847 |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1848 # 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
|
1849 # to regular users now |
|
6466
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1850 for cl in 'issue', 'file', 'msg', 'keyword': |
|
3276
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1851 db.security.addPermissionToRole('User', 'View', cl) |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1852 db.security.addPermissionToRole('User', 'Edit', cl) |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1853 db.security.addPermissionToRole('User', 'Create', cl) |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1854 for cl in 'priority', 'status': |
|
3276
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1855 db.security.addPermissionToRole('User', 'View', cl) |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1856 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1857 # 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
|
1858 # if you don't want them to |
|
6466
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1859 p = db.security.addPermission(name='View', klass='user', |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1860 properties=('id', 'organisation', 'phone', 'realname', 'timezone', |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1861 'username')) |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1862 db.security.addPermissionToRole('User', p) |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1863 |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1864 # Users should be able to edit their own details -- this permission is |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1865 # limited to only the situation where the Viewed or Edited item is their own. |
|
5186
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
1866 def own_record(db, userid, itemid, **ctx): |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1867 '''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
|
1868 return userid == itemid |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1869 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
|
1870 description="User is allowed to view their own user details") |
|
3276
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1871 db.security.addPermissionToRole('User', p) |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1872 p = db.security.addPermission(name='Edit', klass='user', check=own_record, |
|
6466
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1873 properties=('username', 'password', 'address', 'realname', 'phone', |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1874 'organisation', 'alternate_addresses', 'queries', 'timezone'), |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1875 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
|
1876 db.security.addPermissionToRole('User', p) |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1877 |
|
6466
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1878 # Users should be able to edit and view their own queries. They should also |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1879 # be able to view any marked as not private. They should not be able to |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1880 # edit others' queries, even if they're not private |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1881 def view_query(db, userid, itemid): |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1882 private_for = db.query.get(itemid, 'private_for') |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1883 if not private_for: return True |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1884 return userid == private_for |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1885 def edit_query(db, userid, itemid): |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1886 return userid == db.query.get(itemid, 'creator') |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1887 p = db.security.addPermission(name='View', klass='query', check=view_query, |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1888 description="User is allowed to view their own and public queries") |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1889 db.security.addPermissionToRole('User', p) |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1890 p = db.security.addPermission(name='Search', klass='query') |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1891 db.security.addPermissionToRole('User', p) |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1892 p = db.security.addPermission(name='Edit', klass='query', check=edit_query, |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1893 description="User is allowed to edit their queries") |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1894 db.security.addPermissionToRole('User', p) |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1895 p = db.security.addPermission(name='Retire', klass='query', check=edit_query, |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1896 description="User is allowed to retire their queries") |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1897 db.security.addPermissionToRole('User', p) |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1898 p = db.security.addPermission(name='Restore', klass='query', check=edit_query, |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1899 description="User is allowed to restore their queries") |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1900 db.security.addPermissionToRole('User', p) |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1901 p = db.security.addPermission(name='Create', klass='query', |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1902 description="User is allowed to create queries") |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1903 db.security.addPermissionToRole('User', p) |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1904 |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1905 # |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1906 # ANONYMOUS USER PERMISSIONS |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1907 # |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1908 # 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
|
1909 # 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
|
1910 # required is in a tracker that uses an HTTP Basic Authenticated front-end. |
|
3276
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1911 db.security.addPermissionToRole('Anonymous', 'Web Access') |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1912 |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1913 # 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
|
1914 # 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
|
1915 # "Create" user Permission below) |
|
3276
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1916 # This is disabled by default to stop spam from auto-registering users on |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1917 # public trackers. |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1918 #db.security.addPermissionToRole('Anonymous', 'Email Access') |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1919 |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1920 # 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
|
1921 # Role. Choices here are: |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1922 # - Allow anonymous users to register |
|
6466
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1923 db.security.addPermissionToRole('Anonymous', 'Register', 'user') |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1924 |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1925 # 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
|
1926 # information) |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1927 for cl in 'issue', 'file', 'msg', 'keyword', 'priority', 'status': |
|
3276
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1928 db.security.addPermissionToRole('Anonymous', 'View', cl) |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1929 |
|
6466
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1930 # Allow the anonymous user to use the "Show Unassigned" search. |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1931 # It acts like "Show Open" if this permission is not available. |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1932 # If you are running a tracker that does not allow read access for |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1933 # anonymous, you should remove this entry as it can be used to perform |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1934 # a username guessing attack against a roundup install. |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1935 p = db.security.addPermission(name='Search', klass='user') |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1936 db.security.addPermissionToRole ('Anonymous', p) |
|
258385cad27e
Add search perm and update default perms
John Rouillard <rouilj@ieee.org>
parents:
6448
diff
changeset
|
1937 |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1938 # [OPTIONAL] |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1939 # 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
|
1940 # related file and message items) |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1941 #for cl in 'issue', 'file', 'msg': |
|
3276
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1942 # db.security.addPermissionToRole('Anonymous', 'Create', cl) |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1943 # db.security.addPermissionToRole('Anonymous', 'Edit', cl) |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
1944 |
| 6163 | 1945 .. index:: |
|
6174
5522c950a2e4
Add indexing for roundup-admin references.
John Rouillard <rouilj@ieee.org>
parents:
6171
diff
changeset
|
1946 single: roundup-admin; view class permissions |
| 6163 | 1947 |
|
5897
d0aebd4aec72
Provide a method for identifying invalid properties in permissions
John Rouillard <rouilj@ieee.org>
parents:
5891
diff
changeset
|
1948 You can use ``roundup-admin security`` to verify the permissions |
|
d0aebd4aec72
Provide a method for identifying invalid properties in permissions
John Rouillard <rouilj@ieee.org>
parents:
5891
diff
changeset
|
1949 defined in the schema. It also verifies that properties specified in |
|
d0aebd4aec72
Provide a method for identifying invalid properties in permissions
John Rouillard <rouilj@ieee.org>
parents:
5891
diff
changeset
|
1950 permissions are valid for the class. This helps detect typos that can |
|
d0aebd4aec72
Provide a method for identifying invalid properties in permissions
John Rouillard <rouilj@ieee.org>
parents:
5891
diff
changeset
|
1951 cause baffling permission issues. |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1952 |
|
3117
460eb0209a9e
Permissions improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
3097
diff
changeset
|
1953 Automatic Permission Checks |
|
460eb0209a9e
Permissions improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
3097
diff
changeset
|
1954 --------------------------- |
|
460eb0209a9e
Permissions improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
3097
diff
changeset
|
1955 |
|
460eb0209a9e
Permissions improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
3097
diff
changeset
|
1956 Permissions are automatically checked when information is rendered |
|
460eb0209a9e
Permissions improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
3097
diff
changeset
|
1957 through the web. This includes: |
|
460eb0209a9e
Permissions improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
3097
diff
changeset
|
1958 |
|
460eb0209a9e
Permissions improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
3097
diff
changeset
|
1959 1. View checks for properties when being rendered via the ``plain()`` or |
|
460eb0209a9e
Permissions improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
3097
diff
changeset
|
1960 similar methods. If the check fails, the text "[hidden]" will be |
|
460eb0209a9e
Permissions improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
3097
diff
changeset
|
1961 displayed. |
|
460eb0209a9e
Permissions improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
3097
diff
changeset
|
1962 2. Edit checks for properties when the edit field is being rendered via |
|
460eb0209a9e
Permissions improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
3097
diff
changeset
|
1963 the ``field()`` or similar methods. If the check fails, the property |
|
460eb0209a9e
Permissions improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
3097
diff
changeset
|
1964 will be rendered via the ``plain()`` method (see point 1. for subsequent |
|
460eb0209a9e
Permissions improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
3097
diff
changeset
|
1965 checking performed) |
|
460eb0209a9e
Permissions improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
3097
diff
changeset
|
1966 3. View checks are performed in index pages for each item being displayed |
|
460eb0209a9e
Permissions improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
3097
diff
changeset
|
1967 such that if the user does not have permission, the row is not rendered. |
|
460eb0209a9e
Permissions improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
3097
diff
changeset
|
1968 4. View checks are performed at the top of item pages for the Item being |
|
460eb0209a9e
Permissions improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
3097
diff
changeset
|
1969 displayed. If the user does not have permission, the text "You are not |
|
460eb0209a9e
Permissions improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
3097
diff
changeset
|
1970 allowed to view this page." will be displayed. |
|
460eb0209a9e
Permissions improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
3097
diff
changeset
|
1971 5. View checks are performed at the top of index pages for the Class being |
|
460eb0209a9e
Permissions improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
3097
diff
changeset
|
1972 displayed. If the user does not have permission, the text "You are not |
|
460eb0209a9e
Permissions improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
3097
diff
changeset
|
1973 allowed to view this page." will be displayed. |
|
460eb0209a9e
Permissions improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
3097
diff
changeset
|
1974 |
|
460eb0209a9e
Permissions improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
3097
diff
changeset
|
1975 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1976 New User Roles |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1977 -------------- |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1978 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1979 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
|
1980 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1981 - NEW_WEB_USER_ROLES |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1982 - NEW_EMAIL_USER_ROLES |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1983 |
|
3276
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1984 The `users may only edit their issues`_ example shows customisation of |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1985 these parameters. |
|
3124e578db02
Email fixes:
Richard Jones <richard@users.sourceforge.net>
parents:
3260
diff
changeset
|
1986 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1987 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1988 Changing Access Controls |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1989 ------------------------ |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1990 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1991 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
|
1992 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
|
1993 interface if they register through email. |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1994 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1995 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
|
1996 current Role and Permission configuration in your tracker. |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1997 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
1998 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
1999 Adding a new Permission |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2000 ~~~~~~~~~~~~~~~~~~~~~~~ |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2001 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2002 When adding a new Permission, you will need to: |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2003 |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
2004 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
|
2005 ``security.addPermission``, for example:: |
|
2a4309450202
security fixes and doc updates
Richard Jones <richard@users.sourceforge.net>
parents:
2069
diff
changeset
|
2006 |
|
5196
e0732fd6a6c7
Implement props_only feature for permissions.
rouilj@uland
parents:
5186
diff
changeset
|
2007 db.security.addPermission(name="View", klass='frozzle', |
|
2076
2a4309450202
security fixes and doc updates
Richard Jones <richard@users.sourceforge.net>
parents:
2069
diff
changeset
|
2008 description="User is allowed to access frozzles") |
|
2a4309450202
security fixes and doc updates
Richard Jones <richard@users.sourceforge.net>
parents:
2069
diff
changeset
|
2009 |
|
2a4309450202
security fixes and doc updates
Richard Jones <richard@users.sourceforge.net>
parents:
2069
diff
changeset
|
2010 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
|
2011 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
|
2012 "``roundup-admin security``") |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2013 3. add it to the relevant HTML interface templates |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2014 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
|
2015 interfaces module |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2016 |
|
5196
e0732fd6a6c7
Implement props_only feature for permissions.
rouilj@uland
parents:
5186
diff
changeset
|
2017 The ``addPermission`` method takes a few optional parameters: |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
2018 |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
2019 **properties** |
|
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
2020 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
|
2021 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
|
2022 'email') ...``) |
|
5196
e0732fd6a6c7
Implement props_only feature for permissions.
rouilj@uland
parents:
5186
diff
changeset
|
2023 **props_only** |
|
e0732fd6a6c7
Implement props_only feature for permissions.
rouilj@uland
parents:
5186
diff
changeset
|
2024 A boolean value (set to false by default) that is a new feature |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
2025 in Roundup 1.6. |
| 5206 | 2026 A permission defined using: |
| 2027 | |
|
5196
e0732fd6a6c7
Implement props_only feature for permissions.
rouilj@uland
parents:
5186
diff
changeset
|
2028 ``properties=('list', 'of', 'property', 'names')`` |
| 5206 | 2029 |
|
5196
e0732fd6a6c7
Implement props_only feature for permissions.
rouilj@uland
parents:
5186
diff
changeset
|
2030 is used to determine access for things other than just those |
|
e0732fd6a6c7
Implement props_only feature for permissions.
rouilj@uland
parents:
5186
diff
changeset
|
2031 properties. For example a check for View permission on the issue |
|
e0732fd6a6c7
Implement props_only feature for permissions.
rouilj@uland
parents:
5186
diff
changeset
|
2032 class or an issue item can use any View permission for the issue |
|
e0732fd6a6c7
Implement props_only feature for permissions.
rouilj@uland
parents:
5186
diff
changeset
|
2033 class even if that permission has a property list. This can be |
|
e0732fd6a6c7
Implement props_only feature for permissions.
rouilj@uland
parents:
5186
diff
changeset
|
2034 confusing and surprising as you would think that a permission |
|
e0732fd6a6c7
Implement props_only feature for permissions.
rouilj@uland
parents:
5186
diff
changeset
|
2035 including properties would be used only for determining the |
|
e0732fd6a6c7
Implement props_only feature for permissions.
rouilj@uland
parents:
5186
diff
changeset
|
2036 access permission for those properties. |
|
e0732fd6a6c7
Implement props_only feature for permissions.
rouilj@uland
parents:
5186
diff
changeset
|
2037 |
|
5897
d0aebd4aec72
Provide a method for identifying invalid properties in permissions
John Rouillard <rouilj@ieee.org>
parents:
5891
diff
changeset
|
2038 ``roundup-admin security`` will report invalid properties for the |
|
d0aebd4aec72
Provide a method for identifying invalid properties in permissions
John Rouillard <rouilj@ieee.org>
parents:
5891
diff
changeset
|
2039 class. For example a permission with an invalid summary property is |
|
d0aebd4aec72
Provide a method for identifying invalid properties in permissions
John Rouillard <rouilj@ieee.org>
parents:
5891
diff
changeset
|
2040 presented as:: |
|
d0aebd4aec72
Provide a method for identifying invalid properties in permissions
John Rouillard <rouilj@ieee.org>
parents:
5891
diff
changeset
|
2041 |
|
d0aebd4aec72
Provide a method for identifying invalid properties in permissions
John Rouillard <rouilj@ieee.org>
parents:
5891
diff
changeset
|
2042 Allowed to see content of object regardless of spam status |
|
d0aebd4aec72
Provide a method for identifying invalid properties in permissions
John Rouillard <rouilj@ieee.org>
parents:
5891
diff
changeset
|
2043 (View for "file": ('content', 'summary') only) |
|
d0aebd4aec72
Provide a method for identifying invalid properties in permissions
John Rouillard <rouilj@ieee.org>
parents:
5891
diff
changeset
|
2044 |
|
d0aebd4aec72
Provide a method for identifying invalid properties in permissions
John Rouillard <rouilj@ieee.org>
parents:
5891
diff
changeset
|
2045 **Invalid properties for file: ['summary'] |
|
d0aebd4aec72
Provide a method for identifying invalid properties in permissions
John Rouillard <rouilj@ieee.org>
parents:
5891
diff
changeset
|
2046 |
|
5196
e0732fd6a6c7
Implement props_only feature for permissions.
rouilj@uland
parents:
5186
diff
changeset
|
2047 Setting ``props_only=True`` will make the permission valid only for |
|
e0732fd6a6c7
Implement props_only feature for permissions.
rouilj@uland
parents:
5186
diff
changeset
|
2048 those properties. |
|
e0732fd6a6c7
Implement props_only feature for permissions.
rouilj@uland
parents:
5186
diff
changeset
|
2049 |
|
e0732fd6a6c7
Implement props_only feature for permissions.
rouilj@uland
parents:
5186
diff
changeset
|
2050 If you use a lot of permissions with property checks, it can be |
|
e0732fd6a6c7
Implement props_only feature for permissions.
rouilj@uland
parents:
5186
diff
changeset
|
2051 difficult to change all of them. Calling the function: |
|
e0732fd6a6c7
Implement props_only feature for permissions.
rouilj@uland
parents:
5186
diff
changeset
|
2052 |
|
e0732fd6a6c7
Implement props_only feature for permissions.
rouilj@uland
parents:
5186
diff
changeset
|
2053 db.security.set_props_only_default(True) |
|
e0732fd6a6c7
Implement props_only feature for permissions.
rouilj@uland
parents:
5186
diff
changeset
|
2054 |
|
e0732fd6a6c7
Implement props_only feature for permissions.
rouilj@uland
parents:
5186
diff
changeset
|
2055 at the top of ``schema.py`` will make every permission creation |
|
e0732fd6a6c7
Implement props_only feature for permissions.
rouilj@uland
parents:
5186
diff
changeset
|
2056 behave as though props_only was set to True. It is expected that the |
|
e0732fd6a6c7
Implement props_only feature for permissions.
rouilj@uland
parents:
5186
diff
changeset
|
2057 default of True will become the default in a future Roundup release. |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
2058 **check** |
|
5186
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2059 A function to be executed which returns boolean determining whether |
|
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2060 the Permission is allowed. If it returns True, the permission is |
|
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2061 allowed, if it returns False the permission is denied. The function |
|
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2062 can have one of two signatures:: |
|
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2063 |
|
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2064 check(db, userid, itemid) |
|
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2065 |
|
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2066 or:: |
|
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2067 |
|
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2068 check(db, userid, itemid, **ctx) |
|
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2069 |
|
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2070 where ``db`` is a handle on the open database, ``userid`` is |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
2071 the user attempting access and ``itemid`` is the specific item being |
|
5186
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2072 accessed. If the second form is used the ``ctx`` dictionary is |
|
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2073 defined with the following values:: |
|
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2074 |
|
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2075 ctx['property'] the name of the property being checked or None if |
|
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2076 it's a class check. |
|
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2077 |
|
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2078 ctx['classname'] the name of the class that is being checked |
|
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2079 (issue, query ....). |
|
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2080 |
|
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2081 ctx['permission'] the name of the permission (e.g. View, Edit...). |
|
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2082 |
|
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2083 The second form is preferred as it makes it easier to implement more |
|
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2084 complex permission schemes. An example of the use of ``ctx`` can be |
|
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2085 found in the ``upgrading.txt`` or `upgrading.html`_ document. |
|
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2086 |
|
36630a062fb5
Check in enhanced form for check command used by addPermission.
John Rouillard <rouilj@ieee.org>
parents:
5185
diff
changeset
|
2087 .. _`upgrading.html`: upgrading.html |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2088 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2089 Example Scenarios |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2090 ~~~~~~~~~~~~~~~~~ |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2091 |
|
3126
a2889d22db4a
the cgi templating code now checks item-level
Richard Jones <richard@users.sourceforge.net>
parents:
3123
diff
changeset
|
2092 See the `examples`_ section for longer examples of customisation. |
|
a2889d22db4a
the cgi templating code now checks item-level
Richard Jones <richard@users.sourceforge.net>
parents:
3123
diff
changeset
|
2093 |
|
3404
7d48c5b1e8f2
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3363
diff
changeset
|
2094 **anonymous access through the e-mail gateway** |
|
7d48c5b1e8f2
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3363
diff
changeset
|
2095 Give the "anonymous" user the "Email Access", ("Edit", "issue") and |
|
7d48c5b1e8f2
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3363
diff
changeset
|
2096 ("Create", "msg") Permissions but do not not give them the ("Create", |
|
7d48c5b1e8f2
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3363
diff
changeset
|
2097 "user") Permission. This means that when an unknown user sends email |
|
7d48c5b1e8f2
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3363
diff
changeset
|
2098 into the tracker, they're automatically logged in as "anonymous". |
|
7d48c5b1e8f2
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3363
diff
changeset
|
2099 Since they don't have the ("Create", "user") Permission, they won't |
|
7d48c5b1e8f2
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3363
diff
changeset
|
2100 be automatically registered, but since "anonymous" has permission to |
|
7d48c5b1e8f2
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3363
diff
changeset
|
2101 use the gateway, they'll still be able to submit issues. Note that |
|
7d48c5b1e8f2
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3363
diff
changeset
|
2102 the Sender information - their email address - will not be available |
|
7d48c5b1e8f2
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3363
diff
changeset
|
2103 - they're *anonymous*. |
|
7d48c5b1e8f2
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3363
diff
changeset
|
2104 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2105 **automatic registration of users in the e-mail gateway** |
|
4296
72463e22640d
fix some more documentation for the Register permission
Richard Jones <richard@users.sourceforge.net>
parents:
4088
diff
changeset
|
2106 By giving the "anonymous" user the ("Register", "user") Permission, any |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2107 unidentified user will automatically be registered with the tracker |
|
3404
7d48c5b1e8f2
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3363
diff
changeset
|
2108 (with no password, so they won't be able to log in through |
| 3744 | 2109 the web until an admin sets their password). By default new Roundup |
| 2110 trackers don't allow this as it opens them up to spam. It may be enabled | |
| 2111 by uncommenting the appropriate addPermissionToRole in your tracker's | |
| 2112 ``schema.py`` file. The new user is given the Roles list defined in the | |
|
3747
c3bba2c81a6f
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
3744
diff
changeset
|
2113 "new_email_user_roles" config variable. |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2114 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2115 **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
|
2116 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
|
2117 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
|
2118 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
|
2119 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
|
2120 auditor. See the example |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2121 `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
|
2122 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2123 **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
|
2124 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
|
2125 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
|
2126 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
|
2127 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
|
2128 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
|
2129 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
|
2130 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2131 <option tal:condition="python:request.user.hasPermission('Closer')" |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2132 value="resolved">Resolved</option> |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2133 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2134 **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
|
2135 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
|
2136 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
|
2137 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
|
2138 interface. |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2139 |
|
1317
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
2140 **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
|
2141 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
|
2142 editing users:: |
|
1317
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
2143 |
|
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
2144 db.security.addRole(name='User Admin', description='Managing users') |
|
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
2145 p = db.security.getPermission('Edit', 'user') |
|
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
2146 db.security.addPermissionToRole('User Admin', p) |
|
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
2147 |
|
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
2148 and assign the Role to the users who need the permission. |
|
28ae91aae74f
clarifications
Richard Jones <richard@users.sourceforge.net>
parents:
1304
diff
changeset
|
2149 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2150 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2151 Web Interface |
| 1098 | 2152 ============= |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2153 |
| 1125 | 2154 .. contents:: |
| 2155 :local: | |
| 2156 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2157 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
|
2158 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
|
2159 (``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
|
2160 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
|
2161 path inside the scope of the CGI handler) and pass control on to the |
| 2915 | 2162 ``roundup.cgi.client.Client`` class - which handles the rest of the |
| 2163 access through its ``main()`` method. This means that you can do pretty | |
| 2164 much anything you want as a web interface to your tracker. | |
| 2165 | |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
2166 |
| 2910 | 2167 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2168 Repercussions of changing the tracker schema |
| 1098 | 2169 --------------------------------------------- |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
2170 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2171 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
|
2172 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
|
2173 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2174 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
|
2175 have properties added or removed, |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2176 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
|
2177 "home" page's content arguments. |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
2178 |
| 2910 | 2179 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
2180 How requests are processed |
| 1098 | 2181 -------------------------- |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
2182 |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
2183 The basic processing of a web request proceeds as follows: |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
2184 |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
2185 1. figure out who we are, defaulting to the "anonymous" user |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
2186 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
|
2187 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
|
2188 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
|
2189 output |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
2190 |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
2191 In some situations, exceptions occur: |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2192 |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
2193 - 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
|
2194 - 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
|
2195 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
|
2196 - 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
|
2197 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
|
2198 - 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
|
2199 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
|
2200 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
|
2201 the action to take place |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
2202 - 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
|
2203 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
|
2204 client |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
2205 |
| 2910 | 2206 |
|
4725
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2207 Roundup URL design |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2208 ------------------ |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2209 |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2210 Each tracker has several hardcoded URLs. These three are equivalent and |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2211 lead to the main tracker page: |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2212 |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2213 1. ``/`` |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2214 2. ``/index`` |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2215 3. ``/home`` |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2216 |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2217 The following prefix is used to access static resources: |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2218 |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2219 4. ``/@@file/`` |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2220 |
|
6631
9455538c4a1f
Add /rest/ and /xmlrpc/ to section Roundup URL design
John Rouillard <rouilj@ieee.org>
parents:
6586
diff
changeset
|
2221 Two additional url's are used for the API's. |
|
9455538c4a1f
Add /rest/ and /xmlrpc/ to section Roundup URL design
John Rouillard <rouilj@ieee.org>
parents:
6586
diff
changeset
|
2222 The `REST api`_ is accessed via: |
|
9455538c4a1f
Add /rest/ and /xmlrpc/ to section Roundup URL design
John Rouillard <rouilj@ieee.org>
parents:
6586
diff
changeset
|
2223 |
|
9455538c4a1f
Add /rest/ and /xmlrpc/ to section Roundup URL design
John Rouillard <rouilj@ieee.org>
parents:
6586
diff
changeset
|
2224 5. ``/rest/`` |
|
9455538c4a1f
Add /rest/ and /xmlrpc/ to section Roundup URL design
John Rouillard <rouilj@ieee.org>
parents:
6586
diff
changeset
|
2225 |
|
9455538c4a1f
Add /rest/ and /xmlrpc/ to section Roundup URL design
John Rouillard <rouilj@ieee.org>
parents:
6586
diff
changeset
|
2226 .. _`REST api`: rest.html |
|
9455538c4a1f
Add /rest/ and /xmlrpc/ to section Roundup URL design
John Rouillard <rouilj@ieee.org>
parents:
6586
diff
changeset
|
2227 |
|
9455538c4a1f
Add /rest/ and /xmlrpc/ to section Roundup URL design
John Rouillard <rouilj@ieee.org>
parents:
6586
diff
changeset
|
2228 and the `XMLRPC api`_ is available at: |
|
9455538c4a1f
Add /rest/ and /xmlrpc/ to section Roundup URL design
John Rouillard <rouilj@ieee.org>
parents:
6586
diff
changeset
|
2229 |
|
9455538c4a1f
Add /rest/ and /xmlrpc/ to section Roundup URL design
John Rouillard <rouilj@ieee.org>
parents:
6586
diff
changeset
|
2230 6. ``/rest/`` |
|
9455538c4a1f
Add /rest/ and /xmlrpc/ to section Roundup URL design
John Rouillard <rouilj@ieee.org>
parents:
6586
diff
changeset
|
2231 |
|
9455538c4a1f
Add /rest/ and /xmlrpc/ to section Roundup URL design
John Rouillard <rouilj@ieee.org>
parents:
6586
diff
changeset
|
2232 .. _`XMLRPC api`: xmlrpc.html |
|
9455538c4a1f
Add /rest/ and /xmlrpc/ to section Roundup URL design
John Rouillard <rouilj@ieee.org>
parents:
6586
diff
changeset
|
2233 |
|
4725
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2234 All other URLs depend on the classes configured in Roundup database. |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2235 Each class receives two URLs - one for the class itself and another |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2236 for specific items of that class. Example for class URL: |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2237 |
|
6631
9455538c4a1f
Add /rest/ and /xmlrpc/ to section Roundup URL design
John Rouillard <rouilj@ieee.org>
parents:
6586
diff
changeset
|
2238 7. ``/issue`` |
|
4725
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2239 |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2240 This is usually used to show listings of class items. The URL for |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2241 for specific object of issue class with id 1 will look like: |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2242 |
|
6631
9455538c4a1f
Add /rest/ and /xmlrpc/ to section Roundup URL design
John Rouillard <rouilj@ieee.org>
parents:
6586
diff
changeset
|
2243 8. ``/issue1`` |
|
4725
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2244 |
|
6977
ff2c8b430738
flake8 - remove re.compile from method arg + test + doc
John Rouillard <rouilj@ieee.org>
parents:
6832
diff
changeset
|
2245 .. _strip_zeros: |
|
ff2c8b430738
flake8 - remove re.compile from method arg + test + doc
John Rouillard <rouilj@ieee.org>
parents:
6832
diff
changeset
|
2246 |
|
ff2c8b430738
flake8 - remove re.compile from method arg + test + doc
John Rouillard <rouilj@ieee.org>
parents:
6832
diff
changeset
|
2247 Note that a leading string of 0's will be stripped from the id part of |
|
ff2c8b430738
flake8 - remove re.compile from method arg + test + doc
John Rouillard <rouilj@ieee.org>
parents:
6832
diff
changeset
|
2248 the object designator in the URL. E.G. ``/issue001`` is the same as |
|
ff2c8b430738
flake8 - remove re.compile from method arg + test + doc
John Rouillard <rouilj@ieee.org>
parents:
6832
diff
changeset
|
2249 ``/issue1``. Similarly for ``/file01`` etc. However you should |
|
ff2c8b430738
flake8 - remove re.compile from method arg + test + doc
John Rouillard <rouilj@ieee.org>
parents:
6832
diff
changeset
|
2250 generate URL's without the extra zeros. |
|
4725
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2251 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
2252 Determining web context |
| 1098 | 2253 ----------------------- |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
2254 |
|
4725
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2255 To determine the "context" of a request (what request is for), we look at |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2256 the URL path after the tracker root and at ``@template`` request |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2257 parameter. Typical URL paths look like: |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
2258 |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
2259 1. ``/tracker/issue`` |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
2260 2. ``/tracker/issue1`` |
|
2589
809758599cdc
oops, double-@
Richard Jones <richard@users.sourceforge.net>
parents:
2588
diff
changeset
|
2261 3. ``/tracker/@@file/style.css`` |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
2262 4. ``/cgi-bin/roundup.cgi/tracker/file1`` |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
2263 5. ``/cgi-bin/roundup.cgi/tracker/file1/kitten.png`` |
|
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
2264 |
|
4725
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2265 where tracker root is ``/tracker/`` or ``/cgi-bin/roundup.cgi/tracker/`` |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2266 We're looking at "issue", "issue1", "@@file/style.css", "file1" and |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2267 "file1/kitten.png" in the cases above. |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2268 |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2269 a. with is no path we are in the "home" context. See `the "home" |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2270 context`_ below for details. "index" or "home" paths may also be used |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2271 to switch into "home" context. |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2272 b. for paths starting with "@@file" the additional path entry ("style.css" |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2273 in the example above) specifies the static file to be served |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2274 from the tracker TEMPLATES directory (or STATIC_FILES, if configured). |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2275 This is usually the tracker's "html" directory. Internally this works |
|
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2276 by raising SendStaticFile exception. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2277 c. if there is something in the path (as in example 1, "issue"), it |
|
4725
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2278 identifies the tracker class to display. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2279 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
|
2280 and "file1"), then we're to display a specific item. |
|
6977
ff2c8b430738
flake8 - remove re.compile from method arg + test + doc
John Rouillard <rouilj@ieee.org>
parents:
6832
diff
changeset
|
2281 :ref:`Note. <strip_zeros>` |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2282 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
|
2283 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
|
2284 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
|
2285 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
|
2286 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
|
2287 This raises a ``SendFile`` exception. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2288 |
|
5154
f608eeecf638
issue2550891: Allow subdir in template value. Anthony (antmail)
John Rouillard <rouilj@ieee.org>
parents:
5135
diff
changeset
|
2289 Neither b. or e. use templates and stop before the template is |
|
f608eeecf638
issue2550891: Allow subdir in template value. Anthony (antmail)
John Rouillard <rouilj@ieee.org>
parents:
5135
diff
changeset
|
2290 determined. For other contexts the template used is specified by the |
|
4725
9b9d9cb9734a
Document Roundup URL design
anatoly techtonik <techtonik@gmail.com>
parents:
4723
diff
changeset
|
2291 ``@template`` variable, which defaults to: |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2292 |
|
5154
f608eeecf638
issue2550891: Allow subdir in template value. Anthony (antmail)
John Rouillard <rouilj@ieee.org>
parents:
5135
diff
changeset
|
2293 - only classname supplied: "index" |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2294 - full item designator supplied: "item" |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
2295 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
2296 |
|
2227
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
2297 The "home" Context |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
2298 ------------------ |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
2299 |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
2300 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
|
2301 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
|
2302 list or specific issue). |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
2303 |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
2304 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
|
2305 interface. You'd probably have: |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
2306 |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
2307 - 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
|
2308 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
|
2309 - 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
|
2310 "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
|
2311 page up, you use the URL: |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
2312 |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
2313 <tracker url>/home?@template=navigation |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
2314 |
|
15c20983fd13
more info about the "home" context
Richard Jones <richard@users.sourceforge.net>
parents:
2209
diff
changeset
|
2315 |
|
2134
00dfd8b50773
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2129
diff
changeset
|
2316 Serving static content |
|
00dfd8b50773
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2129
diff
changeset
|
2317 ---------------------- |
|
00dfd8b50773
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2129
diff
changeset
|
2318 |
|
00dfd8b50773
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2129
diff
changeset
|
2319 See the previous section `determining web context`_ where it describes |
|
2589
809758599cdc
oops, double-@
Richard Jones <richard@users.sourceforge.net>
parents:
2588
diff
changeset
|
2320 ``@@file`` paths. |
|
2134
00dfd8b50773
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2129
diff
changeset
|
2321 |
|
7094
570abc4c6548
Improve documention on access to templates and static_files.
John Rouillard <rouilj@ieee.org>
parents:
6977
diff
changeset
|
2322 These files are served without any permission checks. Any user on the |
|
570abc4c6548
Improve documention on access to templates and static_files.
John Rouillard <rouilj@ieee.org>
parents:
6977
diff
changeset
|
2323 internet with the url can download the file. |
|
570abc4c6548
Improve documention on access to templates and static_files.
John Rouillard <rouilj@ieee.org>
parents:
6977
diff
changeset
|
2324 |
|
570abc4c6548
Improve documention on access to templates and static_files.
John Rouillard <rouilj@ieee.org>
parents:
6977
diff
changeset
|
2325 This is rarely an issue since the html templates are just source code |
|
570abc4c6548
Improve documention on access to templates and static_files.
John Rouillard <rouilj@ieee.org>
parents:
6977
diff
changeset
|
2326 and much of it can be found in the Roundup repository. Other |
|
570abc4c6548
Improve documention on access to templates and static_files.
John Rouillard <rouilj@ieee.org>
parents:
6977
diff
changeset
|
2327 decoration (logos, stylesheets) are similarly not security sensitive. |
|
570abc4c6548
Improve documention on access to templates and static_files.
John Rouillard <rouilj@ieee.org>
parents:
6977
diff
changeset
|
2328 You can use the static_files setting in config.ini to eliminate |
|
570abc4c6548
Improve documention on access to templates and static_files.
John Rouillard <rouilj@ieee.org>
parents:
6977
diff
changeset
|
2329 access to the templates directory if desired. |
|
570abc4c6548
Improve documention on access to templates and static_files.
John Rouillard <rouilj@ieee.org>
parents:
6977
diff
changeset
|
2330 |
|
570abc4c6548
Improve documention on access to templates and static_files.
John Rouillard <rouilj@ieee.org>
parents:
6977
diff
changeset
|
2331 If a file resolves to a symbolic link, it is not served. |
|
2134
00dfd8b50773
doc clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2129
diff
changeset
|
2332 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
2333 Performing actions in web requests |
| 1098 | 2334 ---------------------------------- |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
2335 |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
2336 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
|
2337 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
|
2338 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
|
2339 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
|
2340 of: |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
2341 |
| 1125 | 2342 **login** |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
2343 Attempt to log a user in. |
|
1278
0c0494deb09f
doc for the retire action
Richard Jones <richard@users.sourceforge.net>
parents:
1270
diff
changeset
|
2344 |
| 1125 | 2345 **logout** |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
2346 Log the user out - make them "anonymous". |
|
1278
0c0494deb09f
doc for the retire action
Richard Jones <richard@users.sourceforge.net>
parents:
1270
diff
changeset
|
2347 |
| 1125 | 2348 **register** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2349 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
|
2350 log them in. |
|
1278
0c0494deb09f
doc for the retire action
Richard Jones <richard@users.sourceforge.net>
parents:
1270
diff
changeset
|
2351 |
| 1125 | 2352 **edit** |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2353 Perform an edit of an item in the database. There are some `special form |
|
6334
eeddc4e03742
Documented possible use of __redirect_to for edit function.
John Rouillard <rouilj@ieee.org>
parents:
6329
diff
changeset
|
2354 variables`_ you may use. Also you can set the ``__redirect_to`` form |
|
eeddc4e03742
Documented possible use of __redirect_to for edit function.
John Rouillard <rouilj@ieee.org>
parents:
6329
diff
changeset
|
2355 variable to the URL that should be displayed after the edit is succesfully |
|
eeddc4e03742
Documented possible use of __redirect_to for edit function.
John Rouillard <rouilj@ieee.org>
parents:
6329
diff
changeset
|
2356 completed. If you wanted to edit a sequence of issues, users etc. this |
|
eeddc4e03742
Documented possible use of __redirect_to for edit function.
John Rouillard <rouilj@ieee.org>
parents:
6329
diff
changeset
|
2357 could be used to display the next item in the sequence to the user. |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
2358 |
| 1125 | 2359 **new** |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2360 Add a new item to the database. You may use the same `special form |
|
5158
63294ed25e84
issue1842687: Keywords: After creating, stay in "Create New" mode.
John Rouillard <rouilj@ieee.org>
parents:
5156
diff
changeset
|
2361 variables`_ as in the "edit" action. Also you can set the |
|
63294ed25e84
issue1842687: Keywords: After creating, stay in "Create New" mode.
John Rouillard <rouilj@ieee.org>
parents:
5156
diff
changeset
|
2362 ``__redirect_to`` form variable to the URL that should be displayed after |
|
63294ed25e84
issue1842687: Keywords: After creating, stay in "Create New" mode.
John Rouillard <rouilj@ieee.org>
parents:
5156
diff
changeset
|
2363 the new item is created. This is useful if you want to create another |
|
63294ed25e84
issue1842687: Keywords: After creating, stay in "Create New" mode.
John Rouillard <rouilj@ieee.org>
parents:
5156
diff
changeset
|
2364 item rather than edit the newly created item. |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
2365 |
|
1278
0c0494deb09f
doc for the retire action
Richard Jones <richard@users.sourceforge.net>
parents:
1270
diff
changeset
|
2366 **retire** |
|
0c0494deb09f
doc for the retire action
Richard Jones <richard@users.sourceforge.net>
parents:
1270
diff
changeset
|
2367 Retire the item in the database. |
|
0c0494deb09f
doc for the retire action
Richard Jones <richard@users.sourceforge.net>
parents:
1270
diff
changeset
|
2368 |
| 1125 | 2369 **editCSV** |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
2370 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
|
2371 *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
|
2372 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
|
2373 features. |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
2374 |
| 1125 | 2375 **search** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2376 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
|
2377 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2378 - 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
|
2379 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
|
2380 them to :filter. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2381 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2382 - 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
|
2383 user's query list. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2384 |
|
2017
31d920b31642
Update customization examples too, expand upgrade notice a bit.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2016
diff
changeset
|
2385 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
|
2386 "Xxx" is the name of the action) class in the ``roundup.cgi.actions`` module. |
| 2915 | 2387 These classes are registered with ``roundup.cgi.client.Client``. If you need |
| 2388 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
|
2389 web actions`_). |
|
31d920b31642
Update customization examples too, expand upgrade notice a bit.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2016
diff
changeset
|
2390 |
|
31d920b31642
Update customization examples too, expand upgrade notice a bit.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2016
diff
changeset
|
2391 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
|
2392 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
|
2393 for each action are: |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
2394 |
| 1125 | 2395 **login** |
|
2991
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
2396 Determine whether the user has the "Web Access" Permission. |
| 1125 | 2397 **logout** |
|
1058
a55ef5a98fd3
more docco... and we need to check for web access Permission!
Richard Jones <richard@users.sourceforge.net>
parents:
1057
diff
changeset
|
2398 No permission checks are made. |
| 1125 | 2399 **register** |
|
3404
7d48c5b1e8f2
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3363
diff
changeset
|
2400 Determine whether the user has the ("Create", "user") Permission. |
| 1125 | 2401 **edit** |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
2402 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
|
2403 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
|
2404 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
|
2405 special Permission "Web Roles". |
| 1125 | 2406 **new** |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
2407 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
|
2408 additional property checks are made. Additionally, new user items may |
|
3404
7d48c5b1e8f2
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3363
diff
changeset
|
2409 be created if the user has the ("Create", "user") Permission. |
| 1125 | 2410 **editCSV** |
|
2991
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
2411 Determine whether the user has permission to edit this class. |
| 1125 | 2412 **search** |
|
2991
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
2413 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
|
2414 |
|
5201
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2415 Protecting users from web application attacks |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2416 --------------------------------------------- |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2417 |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2418 There is a class of attacks known as Cross Site Request Forgeries |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2419 (CSRF). Malicious code running in the browser can making a |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
2420 request to Roundup while you are logged into Roundup. The |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
2421 malicious code piggy backs on your existing Roundup session to |
|
5201
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2422 make changes without your knowledge. Roundup 1.6 has support for |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2423 defending against this by analyzing the |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2424 |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2425 * Referer, |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2426 * Origin, and |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2427 * Host or |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2428 * X-Forwarded-Host |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2429 |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2430 HTTP headers. It compares the headers to the value of the web setting |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2431 in the [tracker] section of the tracker's ``config.ini``. |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2432 |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2433 Also a per form token (also called a nonce) can be enabled for |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2434 the tracker using the ``csrf_enforce_token`` option in |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
2435 config.ini. When enabled, Roundup will validate a hidden form |
|
5201
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2436 field called ``@csrf``. If the validation fails (or the token |
| 5361 | 2437 is used more than once) the request is rejected. The ``@csrf`` |
|
5201
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2438 input field is added automatically by calling the ``submit`` |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2439 function/path. It can also be added manually by calling |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
2440 anti_csrf_nonce() directly. For example:: |
|
5201
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2441 |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2442 <input name="@csrf" type="hidden" |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2443 tal:attributes="value python:utils.anti_csrf_nonce(lifetime=10)"> |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2444 |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2445 By default a nonce lifetime is 2 weeks. However the lifetime (in |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2446 minutes) can be set by passing a lifetime argument as shown |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2447 above. The example above makes the nonce lifetime 10 minutes. |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2448 |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2449 Search for @csrf in this document for more examples. There are |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2450 more examples and information in ``upgrading.txt``. |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2451 |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2452 The token protects you because malicious code supplied by another |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2453 site is unable to obtain the token. Thus many attempts they make |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2454 to submit a request are rejected. |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2455 |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2456 The protection on the xmlrpc interface is untested, but is based |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
2457 on a valid header check against the Roundup url and the presence |
|
5201
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2458 of the ``X-REQUESTED-WITH`` header. Work to improve this is a |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2459 future project after the 1.6 release. |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2460 |
| 5361 | 2461 The enforcement levels can be modified in ``config.ini``. Refer to |
|
5201
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
2462 that file for details. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2463 |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2464 Special form variables |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2465 ---------------------- |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2466 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2467 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
|
2468 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
|
2469 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2470 - 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
|
2471 - 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
|
2472 properties, |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2473 - 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
|
2474 current item. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2475 - 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
|
2476 - 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
|
2477 operation to be successful. |
|
5158
63294ed25e84
issue1842687: Keywords: After creating, stay in "Create New" mode.
John Rouillard <rouilj@ieee.org>
parents:
5156
diff
changeset
|
2478 - Redirect to a different page after creating a new item (new action |
|
63294ed25e84
issue1842687: Keywords: After creating, stay in "Create New" mode.
John Rouillard <rouilj@ieee.org>
parents:
5156
diff
changeset
|
2479 only, not edit action). Usually you end up on the page for the |
|
63294ed25e84
issue1842687: Keywords: After creating, stay in "Create New" mode.
John Rouillard <rouilj@ieee.org>
parents:
5156
diff
changeset
|
2480 created item. |
|
3429
963003d2ffdd
add @language and @charset to "Special form variables" section
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3417
diff
changeset
|
2481 - Set up user interface locale. |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2482 |
| 3293 | 2483 These operations will only take place if the form action (the |
| 2484 ``@action`` variable) is "edit" or "new". | |
| 2485 | |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2486 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
|
2487 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
|
2488 |
|
3429
963003d2ffdd
add @language and @charset to "Special form variables" section
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3417
diff
changeset
|
2489 Two special form variables are used to specify user language preferences: |
|
963003d2ffdd
add @language and @charset to "Special form variables" section
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3417
diff
changeset
|
2490 |
|
963003d2ffdd
add @language and @charset to "Special form variables" section
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3417
diff
changeset
|
2491 ``@language`` |
|
963003d2ffdd
add @language and @charset to "Special form variables" section
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3417
diff
changeset
|
2492 value may be locale name or ``none``. If this variable is set to |
|
963003d2ffdd
add @language and @charset to "Special form variables" section
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3417
diff
changeset
|
2493 locale name, web interface language is changed to given value |
|
963003d2ffdd
add @language and @charset to "Special form variables" section
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3417
diff
changeset
|
2494 (provided that appropriate translation is available), the value |
|
963003d2ffdd
add @language and @charset to "Special form variables" section
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3417
diff
changeset
|
2495 is stored in the browser cookie and will be used for all following |
|
963003d2ffdd
add @language and @charset to "Special form variables" section
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3417
diff
changeset
|
2496 requests. If value is ``none`` the cookie is removed and the |
|
963003d2ffdd
add @language and @charset to "Special form variables" section
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3417
diff
changeset
|
2497 language is changed to the tracker default, set up in the tracker |
|
963003d2ffdd
add @language and @charset to "Special form variables" section
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3417
diff
changeset
|
2498 configuration or OS environment. |
|
963003d2ffdd
add @language and @charset to "Special form variables" section
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3417
diff
changeset
|
2499 |
|
963003d2ffdd
add @language and @charset to "Special form variables" section
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3417
diff
changeset
|
2500 ``@charset`` |
|
963003d2ffdd
add @language and @charset to "Special form variables" section
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3417
diff
changeset
|
2501 value may be character set name or ``none``. Character set name |
|
963003d2ffdd
add @language and @charset to "Special form variables" section
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3417
diff
changeset
|
2502 is stored in the browser cookie and sets output encoding for all |
|
963003d2ffdd
add @language and @charset to "Special form variables" section
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3417
diff
changeset
|
2503 HTML pages generated by Roundup. If value is ``none`` the cookie |
|
963003d2ffdd
add @language and @charset to "Special form variables" section
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3417
diff
changeset
|
2504 is removed and HTML output is reset to Roundup internal encoding |
|
963003d2ffdd
add @language and @charset to "Special form variables" section
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3417
diff
changeset
|
2505 (UTF-8). |
|
963003d2ffdd
add @language and @charset to "Special form variables" section
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3417
diff
changeset
|
2506 |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2507 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
|
2508 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2509 ``<propname>`` |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2510 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
|
2511 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2512 ``<designator>"@"<propname>`` |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2513 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
|
2514 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2515 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
|
2516 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2517 ``<classname><N>`` |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2518 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
|
2519 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2520 ``<classname>"-"<N>`` |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2521 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
|
2522 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
|
2523 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
|
2524 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
|
2525 item. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2526 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2527 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
|
2528 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
|
2529 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2530 ``@required`` |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2531 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
|
2532 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
|
2533 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
|
2534 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2535 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
|
2536 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
|
2537 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
|
2538 <designator>. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2539 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2540 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
|
2541 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
|
2542 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2543 ``@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
|
2544 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
|
2545 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
|
2546 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
|
2547 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
|
2548 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
|
2549 property. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2550 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2551 ``@link@<propname>=<designator>`` |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2552 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
|
2553 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
|
2554 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
|
2555 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
|
2556 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
|
2557 form variable. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2558 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2559 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
|
2560 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
|
2561 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
|
2562 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2563 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
|
2564 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
|
2565 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
|
2566 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2567 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
|
2568 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
|
2569 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
|
2570 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2571 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
|
2572 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
|
2573 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
|
2574 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2575 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
|
2576 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
|
2577 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
|
2578 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
|
2579 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
|
2580 |
|
5067
e424987d294a
Add support for an integer type to join the existing number type.
John Rouillard <rouilj@ieee.org>
parents:
5064
diff
changeset
|
2581 For Date(), Interval(), Boolean(), Integer() and Number() |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2582 properties, the form value is converted to the |
|
6289
6672d92b2ce1
Add missing word to phrase.
John Rouillard <rouilj@ieee.org>
parents:
6219
diff
changeset
|
2583 appropriate value. |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2584 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2585 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
|
2586 designator. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2587 |
|
5161
12190efa30d4
I realized that the __came_from and __redirect_to url parameters I
John Rouillard <rouilj@ieee.org>
parents:
5158
diff
changeset
|
2588 Setting the form variable: ``__redirect_to=`` to a url when |
|
12190efa30d4
I realized that the __came_from and __redirect_to url parameters I
John Rouillard <rouilj@ieee.org>
parents:
5158
diff
changeset
|
2589 @action=new redirects the user to the specified url after successfully |
|
12190efa30d4
I realized that the __came_from and __redirect_to url parameters I
John Rouillard <rouilj@ieee.org>
parents:
5158
diff
changeset
|
2590 creating the new item. This is useful if you want the user to create |
|
12190efa30d4
I realized that the __came_from and __redirect_to url parameters I
John Rouillard <rouilj@ieee.org>
parents:
5158
diff
changeset
|
2591 another item rather than edit the newly created item. Note that the |
|
12190efa30d4
I realized that the __came_from and __redirect_to url parameters I
John Rouillard <rouilj@ieee.org>
parents:
5158
diff
changeset
|
2592 url assigned to ``__redirect_to`` must be url encoded/quoted and be |
|
12190efa30d4
I realized that the __came_from and __redirect_to url parameters I
John Rouillard <rouilj@ieee.org>
parents:
5158
diff
changeset
|
2593 under the tracker's base url. If the base_url uses http, you can set |
|
12190efa30d4
I realized that the __came_from and __redirect_to url parameters I
John Rouillard <rouilj@ieee.org>
parents:
5158
diff
changeset
|
2594 the url to https. |
|
5158
63294ed25e84
issue1842687: Keywords: After creating, stay in "Create New" mode.
John Rouillard <rouilj@ieee.org>
parents:
5156
diff
changeset
|
2595 |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2596 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
|
2597 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2598 @note |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2599 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
|
2600 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2601 @link@messages=msg-1 |
| 1918 | 2602 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
|
2603 |
|
6448
2bd60def4fed
Improve doc on special action vars in cusotmizing.txt.
John Rouillard <rouilj@ieee.org>
parents:
6423
diff
changeset
|
2604 which is equivalent to the html:: |
|
2bd60def4fed
Improve doc on special action vars in cusotmizing.txt.
John Rouillard <rouilj@ieee.org>
parents:
6423
diff
changeset
|
2605 |
|
2bd60def4fed
Improve doc on special action vars in cusotmizing.txt.
John Rouillard <rouilj@ieee.org>
parents:
6423
diff
changeset
|
2606 <textarea name="msg-1@content"></textarea> |
|
2bd60def4fed
Improve doc on special action vars in cusotmizing.txt.
John Rouillard <rouilj@ieee.org>
parents:
6423
diff
changeset
|
2607 <input type="hidden" name="@link@messages" value="msg-1"> |
|
2bd60def4fed
Improve doc on special action vars in cusotmizing.txt.
John Rouillard <rouilj@ieee.org>
parents:
6423
diff
changeset
|
2608 |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2609 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
|
2610 "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
|
2611 time, respectively. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2612 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2613 @file |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2614 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
|
2615 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2616 @link@files=file-1 |
| 1918 | 2617 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
|
2618 |
|
6448
2bd60def4fed
Improve doc on special action vars in cusotmizing.txt.
John Rouillard <rouilj@ieee.org>
parents:
6423
diff
changeset
|
2619 by adding the HTML:: |
|
2bd60def4fed
Improve doc on special action vars in cusotmizing.txt.
John Rouillard <rouilj@ieee.org>
parents:
6423
diff
changeset
|
2620 |
|
2bd60def4fed
Improve doc on special action vars in cusotmizing.txt.
John Rouillard <rouilj@ieee.org>
parents:
6423
diff
changeset
|
2621 <input type="file" name="file-1@content"> |
|
2bd60def4fed
Improve doc on special action vars in cusotmizing.txt.
John Rouillard <rouilj@ieee.org>
parents:
6423
diff
changeset
|
2622 <input type="hidden" name="@link@files" value="file-1"> |
|
2bd60def4fed
Improve doc on special action vars in cusotmizing.txt.
John Rouillard <rouilj@ieee.org>
parents:
6423
diff
changeset
|
2623 |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2624 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
|
2625 uploads. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2626 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2627 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
|
2628 specified, the action:: |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2629 |
|
6448
2bd60def4fed
Improve doc on special action vars in cusotmizing.txt.
John Rouillard <rouilj@ieee.org>
parents:
6423
diff
changeset
|
2630 msg-1@link@files=file-1 |
|
2bd60def4fed
Improve doc on special action vars in cusotmizing.txt.
John Rouillard <rouilj@ieee.org>
parents:
6423
diff
changeset
|
2631 |
|
2bd60def4fed
Improve doc on special action vars in cusotmizing.txt.
John Rouillard <rouilj@ieee.org>
parents:
6423
diff
changeset
|
2632 is also performed. This would be expressed in HTML with:: |
|
2bd60def4fed
Improve doc on special action vars in cusotmizing.txt.
John Rouillard <rouilj@ieee.org>
parents:
6423
diff
changeset
|
2633 |
|
2bd60def4fed
Improve doc on special action vars in cusotmizing.txt.
John Rouillard <rouilj@ieee.org>
parents:
6423
diff
changeset
|
2634 <input type="hidden" name="msg-1@link@files" value="file-1"> |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2635 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2636 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
|
2637 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
|
2638 returning. |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2639 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2640 |
| 1091 | 2641 Default templates |
| 1098 | 2642 ----------------- |
| 1091 | 2643 |
|
1952
c40ed9113285
Applied Stefan Seefeld's html4/xhtml patch with some changes.
Richard Jones <richard@users.sourceforge.net>
parents:
1918
diff
changeset
|
2644 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
|
2645 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
|
2646 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
|
2647 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2648 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
|
2649 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
|
2650 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
|
2651 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2652 **page.html** |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2653 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
|
2654 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
|
2655 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
|
2656 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
|
2657 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
|
2658 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
|
2659 title. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2660 **home.html** |
| 1091 | 2661 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
|
2662 **home.classlist.html** |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2663 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
|
2664 tracker |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2665 **classname.item.html** |
| 1091 | 2666 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
|
2667 **classname.index.html** |
| 1091 | 2668 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
|
2669 **classname.search.html** |
| 1091 | 2670 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
|
2671 **_generic.index.html** |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2672 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
|
2673 ``*classname*.index`` available |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2674 **_generic.help.html** |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2675 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
|
2676 ``*classname*.help`` |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2677 **user.register.html** |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2678 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
|
2679 page |
|
4435
386200d0c929
Some minor typos fixed in doc/customizing.txt (Thanks Ralf Hemmecke).
Bernhard Reiter <Bernhard.Reiter@intevation.de>
parents:
4406
diff
changeset
|
2680 **style.css** |
| 1091 | 2681 a static file that is served up as-is |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2682 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2683 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
|
2684 |
| 3052 | 2685 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
|
2686 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
|
2687 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
|
2688 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
|
2689 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
2690 http://your.tracker.example/tracker/issue?@template=test |
|
1147
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
2691 |
|
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
2692 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
|
2693 |
|
5154
f608eeecf638
issue2550891: Allow subdir in template value. Anthony (antmail)
John Rouillard <rouilj@ieee.org>
parents:
5135
diff
changeset
|
2694 You can also put templates into a subdirectory of the template |
|
f608eeecf638
issue2550891: Allow subdir in template value. Anthony (antmail)
John Rouillard <rouilj@ieee.org>
parents:
5135
diff
changeset
|
2695 directory. So if you specify:: |
|
f608eeecf638
issue2550891: Allow subdir in template value. Anthony (antmail)
John Rouillard <rouilj@ieee.org>
parents:
5135
diff
changeset
|
2696 |
|
f608eeecf638
issue2550891: Allow subdir in template value. Anthony (antmail)
John Rouillard <rouilj@ieee.org>
parents:
5135
diff
changeset
|
2697 http://your.tracker.example/tracker/issue?@template=test/item |
|
f608eeecf638
issue2550891: Allow subdir in template value. Anthony (antmail)
John Rouillard <rouilj@ieee.org>
parents:
5135
diff
changeset
|
2698 |
|
f608eeecf638
issue2550891: Allow subdir in template value. Anthony (antmail)
John Rouillard <rouilj@ieee.org>
parents:
5135
diff
changeset
|
2699 you will use the template at: ``test/issue.item.html``. If that |
|
f608eeecf638
issue2550891: Allow subdir in template value. Anthony (antmail)
John Rouillard <rouilj@ieee.org>
parents:
5135
diff
changeset
|
2700 template doesn't exit it will try to use |
|
f608eeecf638
issue2550891: Allow subdir in template value. Anthony (antmail)
John Rouillard <rouilj@ieee.org>
parents:
5135
diff
changeset
|
2701 ``test/_generic.item.html``. If that template doesn't exist |
|
f608eeecf638
issue2550891: Allow subdir in template value. Anthony (antmail)
John Rouillard <rouilj@ieee.org>
parents:
5135
diff
changeset
|
2702 it will return an error. |
|
1147
89b1a8a468e7
more doc, "fixer" example
Richard Jones <richard@users.sourceforge.net>
parents:
1144
diff
changeset
|
2703 |
|
5185
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2704 Implementing Modal Editing Using @template |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2705 ------------------------------------------ |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2706 |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2707 Many item templates allow you to edit the item. They contain |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2708 code that renders edit boxes if the user has edit permissions. |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2709 Otherwise the template will just display the item information. |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2710 |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2711 In some cases you want to do a modal edit. The user has to take some |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2712 action (click a button or follow a link) to shift from display mode to |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2713 edit mode. When the changes are submitted, ending the edit mode, |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2714 the user is returned to display mode. |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2715 |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2716 Modal workflows usually slow things down and are not implemented by |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2717 default templates. However for some workflows a modal edit is useful. |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2718 For example a batch edit mode that allows the user to edit a number of |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2719 issues all from one form could be implemented as a modal workflow of: |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2720 |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2721 * search for issues to modify |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2722 * switch to edit mode and change values |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2723 * exit back to the results of the search |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2724 |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2725 To implement the modal edit, assume you have an issue.edit.html |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2726 template that implements an edit form. On the display page (a version |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2727 of issue.item.html modified to only display information) add a link |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2728 that calls the display url, but adds ``@template=edit`` to the link. |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2729 |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2730 This will now display the edit page. On the edit page you want to add |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2731 a hidden text field to your form named ``@template`` with the value: |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2732 ``item|edit``. When the form is submitted it is validated. If the |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2733 form is correct the user will see the item rendered using the item |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2734 template. If there is an error (validation failed) the item will be |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2735 rendered using the edit template. The edit template that is rendered |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2736 will display all the changes that the user made to the form before it |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2737 was submitted. The user can correct the error and resubmit the changes |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2738 until the form validates. |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2739 |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2740 If the form failed to validate but the ``@template`` field had the |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2741 value ``item`` the user would still see the error, but all of the data |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2742 the user entered would be discarded. The user would have to redo all |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2743 the edits again. |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2744 |
|
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
2745 |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2746 How the templates work |
| 1098 | 2747 ---------------------- |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
2748 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2749 |
|
4619
d9254d300d6e
Add some notes about Chameleon in the documentation
Cheer Xiao <xiaqqaix@gmail.com>
parents:
4464
diff
changeset
|
2750 Templating engines |
|
d9254d300d6e
Add some notes about Chameleon in the documentation
Cheer Xiao <xiaqqaix@gmail.com>
parents:
4464
diff
changeset
|
2751 ~~~~~~~~~~~~~~~~~~ |
|
d9254d300d6e
Add some notes about Chameleon in the documentation
Cheer Xiao <xiaqqaix@gmail.com>
parents:
4464
diff
changeset
|
2752 |
|
6752
d640e9a5d6d7
Reformat templating section. Document jinja2.
John Rouillard <rouilj@ieee.org>
parents:
6687
diff
changeset
|
2753 Since version 1.4.20 Roundup supports two templating engines: |
|
d640e9a5d6d7
Reformat templating section. Document jinja2.
John Rouillard <rouilj@ieee.org>
parents:
6687
diff
changeset
|
2754 |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
2755 * the original `Template Attribute Language`_ (TAL) engine from Zope |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
2756 * the standalone Chameleon templating engine. Chameleon is intended |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
2757 as a replacement for the original TAL engine, and supports the |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
2758 same syntax, but they are not 100% compatible. The major (and most |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
2759 likely the only) incompatibility is the default expression type being |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
2760 ``python:`` instead of ``path:``. See also "Incompatibilities and |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
2761 differences" section of `Chameleon documentation`__. |
|
6752
d640e9a5d6d7
Reformat templating section. Document jinja2.
John Rouillard <rouilj@ieee.org>
parents:
6687
diff
changeset
|
2762 |
|
d640e9a5d6d7
Reformat templating section. Document jinja2.
John Rouillard <rouilj@ieee.org>
parents:
6687
diff
changeset
|
2763 Version 1.5.0 added experimental support for the `jinja2`_ templating |
|
d640e9a5d6d7
Reformat templating section. Document jinja2.
John Rouillard <rouilj@ieee.org>
parents:
6687
diff
changeset
|
2764 language. You must install the `jinja2`_ module in order to use it. The |
|
d640e9a5d6d7
Reformat templating section. Document jinja2.
John Rouillard <rouilj@ieee.org>
parents:
6687
diff
changeset
|
2765 ``jinja2`` template supplied with Roundup has the templates rewritten |
|
d640e9a5d6d7
Reformat templating section. Document jinja2.
John Rouillard <rouilj@ieee.org>
parents:
6687
diff
changeset
|
2766 to use ``jinja2`` rather than TAL. A number of trackers are running |
|
d640e9a5d6d7
Reformat templating section. Document jinja2.
John Rouillard <rouilj@ieee.org>
parents:
6687
diff
changeset
|
2767 using ``jinja2`` templating so it is considered less experimental than |
|
d640e9a5d6d7
Reformat templating section. Document jinja2.
John Rouillard <rouilj@ieee.org>
parents:
6687
diff
changeset
|
2768 Chameleon templating. |
|
d640e9a5d6d7
Reformat templating section. Document jinja2.
John Rouillard <rouilj@ieee.org>
parents:
6687
diff
changeset
|
2769 |
|
d640e9a5d6d7
Reformat templating section. Document jinja2.
John Rouillard <rouilj@ieee.org>
parents:
6687
diff
changeset
|
2770 .. _jinja2: https://palletsprojects.com/p/jinja/ |
|
d640e9a5d6d7
Reformat templating section. Document jinja2.
John Rouillard <rouilj@ieee.org>
parents:
6687
diff
changeset
|
2771 |
|
4619
d9254d300d6e
Add some notes about Chameleon in the documentation
Cheer Xiao <xiaqqaix@gmail.com>
parents:
4464
diff
changeset
|
2772 |
|
d9254d300d6e
Add some notes about Chameleon in the documentation
Cheer Xiao <xiaqqaix@gmail.com>
parents:
4464
diff
changeset
|
2773 **NOTE1**: For historical reasons, examples given below assumes path |
|
d9254d300d6e
Add some notes about Chameleon in the documentation
Cheer Xiao <xiaqqaix@gmail.com>
parents:
4464
diff
changeset
|
2774 expression as default expression type. With Chameleon you have to manually |
|
d9254d300d6e
Add some notes about Chameleon in the documentation
Cheer Xiao <xiaqqaix@gmail.com>
parents:
4464
diff
changeset
|
2775 resolve the path expressions. A Chameleon-based, z3c.pt, that is fully |
|
d9254d300d6e
Add some notes about Chameleon in the documentation
Cheer Xiao <xiaqqaix@gmail.com>
parents:
4464
diff
changeset
|
2776 compatible with the old TAL implementation, is planned to be included in a |
|
d9254d300d6e
Add some notes about Chameleon in the documentation
Cheer Xiao <xiaqqaix@gmail.com>
parents:
4464
diff
changeset
|
2777 future release. |
|
d9254d300d6e
Add some notes about Chameleon in the documentation
Cheer Xiao <xiaqqaix@gmail.com>
parents:
4464
diff
changeset
|
2778 |
|
d9254d300d6e
Add some notes about Chameleon in the documentation
Cheer Xiao <xiaqqaix@gmail.com>
parents:
4464
diff
changeset
|
2779 **NOTE2**: As of 1.4.20 Chameleon support is highly experimental and **not** |
|
d9254d300d6e
Add some notes about Chameleon in the documentation
Cheer Xiao <xiaqqaix@gmail.com>
parents:
4464
diff
changeset
|
2780 recommended for production use. |
|
d9254d300d6e
Add some notes about Chameleon in the documentation
Cheer Xiao <xiaqqaix@gmail.com>
parents:
4464
diff
changeset
|
2781 |
|
d9254d300d6e
Add some notes about Chameleon in the documentation
Cheer Xiao <xiaqqaix@gmail.com>
parents:
4464
diff
changeset
|
2782 .. _Chameleon: |
|
5364
dffa7d0df99c
Fixing links to chameleon documentation.
John Rouillard <rouilj@ieee.org>
parents:
5361
diff
changeset
|
2783 https://pypi.org/project/Chameleon/ |
|
4619
d9254d300d6e
Add some notes about Chameleon in the documentation
Cheer Xiao <xiaqqaix@gmail.com>
parents:
4464
diff
changeset
|
2784 .. _z3c.pt: |
|
5337
01dabc0483b0
more changes to prep for 1.6 release.
John Rouillard <rouilj@ieee.org>
parents:
5332
diff
changeset
|
2785 https://pypi.org/project/z3c.pt/ |
|
5364
dffa7d0df99c
Fixing links to chameleon documentation.
John Rouillard <rouilj@ieee.org>
parents:
5361
diff
changeset
|
2786 __ https://chameleon.readthedocs.io/en/latest/reference.html?highlight=differences#incompatibilities-and-differences |
|
4619
d9254d300d6e
Add some notes about Chameleon in the documentation
Cheer Xiao <xiaqqaix@gmail.com>
parents:
4464
diff
changeset
|
2787 .. _TAL: |
|
d9254d300d6e
Add some notes about Chameleon in the documentation
Cheer Xiao <xiaqqaix@gmail.com>
parents:
4464
diff
changeset
|
2788 .. _Template Attribute Language: |
|
5365
979390afb001
Fix some dev.zope.org links for tales and metal.
John Rouillard <rouilj@ieee.org>
parents:
5364
diff
changeset
|
2789 https://pagetemplates.readthedocs.io/en/latest/history/TALSpecification14.html |
|
4619
d9254d300d6e
Add some notes about Chameleon in the documentation
Cheer Xiao <xiaqqaix@gmail.com>
parents:
4464
diff
changeset
|
2790 |
|
d9254d300d6e
Add some notes about Chameleon in the documentation
Cheer Xiao <xiaqqaix@gmail.com>
parents:
4464
diff
changeset
|
2791 |
| 1214 | 2792 Basic Templating Actions |
| 2793 ~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 2794 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2795 Roundup's templates consist of special attributes on the HTML tags. |
|
4619
d9254d300d6e
Add some notes about Chameleon in the documentation
Cheer Xiao <xiaqqaix@gmail.com>
parents:
4464
diff
changeset
|
2796 These attributes form the **Template Attribute Language**, or TAL. |
|
2296
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
2797 The basic TAL commands are: |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2798 |
| 1125 | 2799 **tal:define="variable expression; variable expression; ..."** |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2800 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
|
2801 example:: |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2802 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2803 <html tal:define="title request/description"> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2804 <head><title tal:content="title"></title></head> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2805 </html> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2806 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2807 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
|
2808 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
|
2809 <html> tag may then use the "title" variable. |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2810 |
| 1125 | 2811 **tal:condition="expression"** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2812 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
|
2813 example:: |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2814 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2815 <p tal:condition="python:request.user.hasPermission('View', 'issue')"> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2816 Display some issue information. |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2817 </p> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2818 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2819 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
|
2820 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
|
2821 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
|
2822 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
|
2823 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
|
2824 spaces!). |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2825 |
| 1125 | 2826 **tal:repeat="variable expression"** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2827 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
|
2828 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
|
2829 special "repeat" variable for each element. For example:: |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2830 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2831 <tr tal:repeat="u user/list"> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2832 <td tal:content="u/id"></td> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2833 <td tal:content="u/username"></td> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2834 <td tal:content="u/realname"></td> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2835 </tr> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2836 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2837 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
|
2838 "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
|
2839 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
|
2840 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
|
2841 below on `the repeat variable`_. |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
2842 |
| 1125 | 2843 **tal:replace="expression"** |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2844 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
|
2845 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2846 <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
|
2847 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2848 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
|
2849 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
|
2850 resultant output would be "Bruce". |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2851 |
| 1125 | 2852 **tal:content="expression"** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2853 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
|
2854 For example:: |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2855 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2856 <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
|
2857 </span> |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2858 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2859 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
|
2860 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
|
2861 resultant output would be "<span>Bruce</span>". |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2862 |
| 1125 | 2863 **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
|
2864 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
|
2865 example:: |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2866 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2867 <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
|
2868 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2869 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
|
2870 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
|
2871 be something like "user123". |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2872 |
| 1125 | 2873 **tal:omit-tag="expression"** |
|
1070
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2874 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
|
2875 example:: |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2876 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2877 <span tal:omit-tag="python:1">Hello, world!</span> |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2878 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2879 would result in output of:: |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2880 |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2881 Hello, world! |
|
af0abadfda3a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
1058
diff
changeset
|
2882 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2883 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
|
2884 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
|
2885 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2886 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
|
2887 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
|
2888 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
|
2889 making arbitrary blocks of HTML conditional or repeatable (very handy |
|
6329
207b0fc82fc1
Fix incorrect template (Nagy Gabor); spelling fix
John Rouillard <rouilj@ieee.org>
parents:
6293
diff
changeset
|
2890 for repeating multiple table rows, which would otherwise require an |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2891 illegal tag placement to effect the repeat). |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
2892 |
| 2910 | 2893 |
| 1214 | 2894 Templating Expressions |
| 2895 ~~~~~~~~~~~~~~~~~~~~~~ | |
| 2896 | |
|
2296
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
2897 Templating Expressions are covered by `Template Attribute Language |
|
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
2898 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
|
2899 attribute values may be one of the following forms: |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
2900 |
| 1125 | 2901 **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
|
2902 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
|
2903 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
|
2904 ``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
|
2905 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
|
2906 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
|
2907 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
|
2908 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
|
2909 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
|
2910 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
|
2911 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
|
2912 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2913 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
|
2914 "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
|
2915 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
|
2916 case of ``tal:attributes``). |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2917 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2918 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
|
2919 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
|
2920 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
|
2921 the case of ``tal:replace``). |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2922 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
2923 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
|
2924 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
|
2925 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
|
2926 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
|
2927 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2928 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
|
2929 ``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
|
2930 expressions. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2931 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2932 **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
|
2933 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
|
2934 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
|
2935 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
|
2936 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2937 **Python Expressions** - eg. ``python: 1+1`` |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
2938 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
|
2939 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
|
2940 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
|
2941 ``checklist`` is a method. |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
2942 |
|
1448
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
2943 Modifiers: |
|
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
2944 |
|
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
2945 **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
|
2946 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
|
2947 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
|
2948 ``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
|
2949 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
|
2950 to the web browser for rendering. |
|
1448
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
2951 |
|
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
2952 **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
|
2953 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
|
2954 expression. |
|
1448
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
2955 |
|
2296
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
2956 .. _TALES: |
|
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
2957 .. _Template Attribute Language Expression Syntax: |
|
5365
979390afb001
Fix some dev.zope.org links for tales and metal.
John Rouillard <rouilj@ieee.org>
parents:
5364
diff
changeset
|
2958 https://pagetemplates.readthedocs.io/en/latest/history/TALESSpecification13.html |
|
1448
bbb1e5f8fc93
added info about structure/not:/path()
Richard Jones <richard@users.sourceforge.net>
parents:
1436
diff
changeset
|
2959 |
| 2910 | 2960 |
| 1214 | 2961 Template Macros |
| 2962 ~~~~~~~~~~~~~~~ | |
| 2963 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2964 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
|
2965 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
|
2966 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
|
2967 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2968 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
|
2969 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
|
2970 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
|
2971 Attribute Language`_, or METAL. The macro commands are: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2972 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2973 **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
|
2974 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
|
2975 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
|
2976 example:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2977 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2978 <html metal:define-macro="page"> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2979 ... |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2980 </html> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2981 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2982 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
|
2983 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
|
2984 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
|
2985 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
|
2986 ``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
|
2987 "page" template. |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2988 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2989 **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
|
2990 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
|
2991 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
|
2992 For example:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2993 |
| 1214 | 2994 <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
|
2995 ... |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2996 </tal:block> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
2997 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
2998 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
|
2999 "page" template. |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3000 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3001 **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
|
3002 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
|
3003 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
|
3004 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
|
3005 so:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3006 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3007 <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
|
3008 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3009 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
|
3010 like this:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3011 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3012 <title metal:fill-slot="head_title">My Title</title> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3013 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3014 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
|
3015 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
|
3016 |
|
2296
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
3017 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
|
3018 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
|
3019 *fill-slots* tags may have all manner of TAL inside them). |
| 1214 | 3020 |
|
2296
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
3021 .. _METAL: |
|
5092d44194dd
added links to TAL specifications
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2227
diff
changeset
|
3022 .. _Macro Expansion Template Attribute Language: |
|
5365
979390afb001
Fix some dev.zope.org links for tales and metal.
John Rouillard <rouilj@ieee.org>
parents:
5364
diff
changeset
|
3023 https://pagetemplates.readthedocs.io/en/latest/history/TALESSpecification13.html |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3024 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
3025 Information available to templates |
| 1098 | 3026 ---------------------------------- |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
3027 |
| 3052 | 3028 This is implemented by ``roundup.cgi.templating.RoundupPageTemplate`` |
| 1125 | 3029 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
3030 The following variables are available to templates. |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
3031 |
| 1125 | 3032 **context** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3033 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
|
3034 or a `hyperdb item wrapper`_ |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
3035 |
| 1125 | 3036 **request** |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
3037 Includes information about the current request, including: |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
3038 |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
3039 - the current index information (``filterspec``, ``filter`` |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
3040 args, ``properties``, etc) parsed out of the form. |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
3041 - methods for easy filterspec link generation |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
3042 - "form" |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
3043 The current CGI form information as a mapping of form argument name |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
3044 to value (specifically a cgi.FieldStorage) |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
3045 - "env" the CGI environment variables |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
3046 - "base" the base URL for this instance |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
3047 - "user" a HTMLItem instance for the current user |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
3048 - "language" as determined by the browser or config |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
3049 - "classname" the current classname (possibly None) |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
3050 - "template" the current template (suffix, also possibly None) |
|
1254
77920c42aeb9
Expose the tracker config as a variable for templating
Richard Jones <richard@users.sourceforge.net>
parents:
1252
diff
changeset
|
3051 **config** |
|
2921
ad4fb8a14a97
more doc updates, not so many TODOs any more
Richard Jones <richard@users.sourceforge.net>
parents:
2915
diff
changeset
|
3052 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
|
3053 file (eg. TRACKER_NAME, etc.) |
| 1125 | 3054 **db** |
|
1254
77920c42aeb9
Expose the tracker config as a variable for templating
Richard Jones <richard@users.sourceforge.net>
parents:
1252
diff
changeset
|
3055 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
|
3056 **templates** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3057 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
|
3058 *use-macro* commands. |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3059 **utils** |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3060 This variable makes available some utility functions like batching. |
| 1125 | 3061 **nothing** |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3062 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
|
3063 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
|
3064 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
|
3065 ``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
|
3066 example:: |
| 1100 | 3067 |
| 3068 <span tal:attributes="class nothing">Hello, World!</span> | |
| 3069 | |
| 3070 would result in:: | |
| 3071 | |
| 3072 <span>Hello, World!</span> | |
| 3073 | |
| 1125 | 3074 **default** |
| 1100 | 3075 Also a special variable - if an expression evaluates to this, then the |
| 3076 existing HTML in the template will not be replaced or removed, it will | |
| 3077 remain. So:: | |
| 3078 | |
| 3079 <span tal:replace="default">Hello, World!</span> | |
| 3080 | |
| 3081 would result in:: | |
| 3082 | |
| 3083 <span>Hello, World!</span> | |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
3084 |
|
2526
dfe0bde4ff7f
"Information available to templates": 'true' and 'false' constants
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2511
diff
changeset
|
3085 **true**, **false** |
|
dfe0bde4ff7f
"Information available to templates": 'true' and 'false' constants
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2511
diff
changeset
|
3086 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
|
3087 instead of ``python:1`` and ``python:0``. |
|
2540
bad572863a85
"Information available to templates": i18n
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2526
diff
changeset
|
3088 **i18n** |
|
bad572863a85
"Information available to templates": i18n
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2526
diff
changeset
|
3089 Internationalization service, providing two string translation methods: |
|
bad572863a85
"Information available to templates": i18n
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2526
diff
changeset
|
3090 |
|
bad572863a85
"Information available to templates": i18n
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2526
diff
changeset
|
3091 **gettext** (*message*) |
|
bad572863a85
"Information available to templates": i18n
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2526
diff
changeset
|
3092 Return the localized translation of message |
|
bad572863a85
"Information available to templates": i18n
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2526
diff
changeset
|
3093 **ngettext** (*singular*, *plural*, *number*) |
|
bad572863a85
"Information available to templates": i18n
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2526
diff
changeset
|
3094 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
|
3095 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
|
3096 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
|
3097 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
|
3098 return plural otherwise. |
|
bad572863a85
"Information available to templates": i18n
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2526
diff
changeset
|
3099 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
3100 The context variable |
| 1098 | 3101 ~~~~~~~~~~~~~~~~~~~~ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
3102 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3103 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
|
3104 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
|
3105 |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
3106 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
|
3107 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
|
3108 `hyperdb class wrapper`_. |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3109 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
|
3110 `hyperdb item wrapper`_. |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
3111 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3112 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
|
3113 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
|
3114 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3115 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
|
3116 appear if the property is displayed through ``context/property`` or |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
3117 ``context/property/field``. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3118 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
|
3119 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
|
3120 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
|
3121 "context/id". |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
3122 |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3123 Hyperdb class wrapper |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3124 ::::::::::::::::::::: |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3125 |
| 3052 | 3126 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
|
3127 class. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3128 |
|
4435
386200d0c929
Some minor typos fixed in doc/customizing.txt (Thanks Ralf Hemmecke).
Bernhard Reiter <Bernhard.Reiter@intevation.de>
parents:
4406
diff
changeset
|
3129 This wrapper object provides access to a hyperdb class. It is used |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3130 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
|
3131 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
|
3132 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
|
3133 mind. |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3134 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3135 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
|
3136 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
|
3137 from the CGI form. |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3138 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3139 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
|
3140 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3141 =========== ============================================================= |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3142 Method Description |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3143 =========== ============================================================= |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3144 properties return a `hyperdb property wrapper`_ for all of this class's |
|
5222
9bf221cebef3
Make properties method return only properties the user can search.
John Rouillard <rouilj@ieee.org>
parents:
5206
diff
changeset
|
3145 properties that are searchable by the user. You can use |
|
9bf221cebef3
Make properties method return only properties the user can search.
John Rouillard <rouilj@ieee.org>
parents:
5206
diff
changeset
|
3146 the argument cansearch=False to get all properties. |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3147 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
|
3148 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
|
3149 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
|
3150 filter lists of items from this class, filtered and sorted. Two |
|
5185
349bef975367
Make @template support two alternate templates for error and ok cases.
John Rouillard <rouilj@ieee.org>
parents:
5175
diff
changeset
|
3151 options are available for sorting: |
|
2858
0357a9c93933
fix filter() doc
Richard Jones <richard@users.sourceforge.net>
parents:
2855
diff
changeset
|
3152 |
|
0357a9c93933
fix filter() doc
Richard Jones <richard@users.sourceforge.net>
parents:
2855
diff
changeset
|
3153 1. by the current *request* filterspec/filter/sort/group args |
|
0357a9c93933
fix filter() doc
Richard Jones <richard@users.sourceforge.net>
parents:
2855
diff
changeset
|
3154 2. by the "filterspec", "sort" and "group" keyword args. |
|
0357a9c93933
fix filter() doc
Richard Jones <richard@users.sourceforge.net>
parents:
2855
diff
changeset
|
3155 "filterspec" is ``{propname: value(s)}``. "sort" and |
|
3696
790363e96852
Sorting/grouping by multiple properties.
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3688
diff
changeset
|
3156 "group" are an optionally empty list ``[(dir, prop)]`` |
|
790363e96852
Sorting/grouping by multiple properties.
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3688
diff
changeset
|
3157 where dir is '+', '-' or None |
|
2858
0357a9c93933
fix filter() doc
Richard Jones <richard@users.sourceforge.net>
parents:
2855
diff
changeset
|
3158 and prop is a prop name or None. |
|
0357a9c93933
fix filter() doc
Richard Jones <richard@users.sourceforge.net>
parents:
2855
diff
changeset
|
3159 |
|
3718
0d561b24ceff
support sqlite3
Richard Jones <richard@users.sourceforge.net>
parents:
3717
diff
changeset
|
3160 The propname in filterspec and prop in a sort/group spec |
|
0d561b24ceff
support sqlite3
Richard Jones <richard@users.sourceforge.net>
parents:
3717
diff
changeset
|
3161 may be transitive, i.e., it may contain properties of |
|
0d561b24ceff
support sqlite3
Richard Jones <richard@users.sourceforge.net>
parents:
3717
diff
changeset
|
3162 the form link.link.link.name. |
|
0d561b24ceff
support sqlite3
Richard Jones <richard@users.sourceforge.net>
parents:
3717
diff
changeset
|
3163 |
|
0d561b24ceff
support sqlite3
Richard Jones <richard@users.sourceforge.net>
parents:
3717
diff
changeset
|
3164 eg. All issues with a priority of "1" with messages added in |
|
0d561b24ceff
support sqlite3
Richard Jones <richard@users.sourceforge.net>
parents:
3717
diff
changeset
|
3165 the last week, sorted by activity date: |
|
0d561b24ceff
support sqlite3
Richard Jones <richard@users.sourceforge.net>
parents:
3717
diff
changeset
|
3166 ``issue.filter(filterspec={"priority": "1", |
|
0d561b24ceff
support sqlite3
Richard Jones <richard@users.sourceforge.net>
parents:
3717
diff
changeset
|
3167 'messages.creation' : '.-1w;'}, sort=[('activity', '+')])`` |
|
2858
0357a9c93933
fix filter() doc
Richard Jones <richard@users.sourceforge.net>
parents:
2855
diff
changeset
|
3168 |
|
6409
ce99e0d39262
Add documentation for multilink expression syntax
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6389
diff
changeset
|
3169 Note that when searching for Link and Multilink values, the |
|
ce99e0d39262
Add documentation for multilink expression syntax
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6389
diff
changeset
|
3170 special value '-1' searches for empty Link or Multilink |
|
ce99e0d39262
Add documentation for multilink expression syntax
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6389
diff
changeset
|
3171 values. For both, Links and Multilinks, multiple values |
|
ce99e0d39262
Add documentation for multilink expression syntax
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6389
diff
changeset
|
3172 given in a filter call are combined with 'OR' by default. |
|
ce99e0d39262
Add documentation for multilink expression syntax
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6389
diff
changeset
|
3173 For Multilinks a postfix expression syntax using negative ID |
|
ce99e0d39262
Add documentation for multilink expression syntax
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6389
diff
changeset
|
3174 numbers (as strings) as operators is supported. Each |
|
ce99e0d39262
Add documentation for multilink expression syntax
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6389
diff
changeset
|
3175 non-negative number (or '-1') is pushed on an operand stack. |
|
ce99e0d39262
Add documentation for multilink expression syntax
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6389
diff
changeset
|
3176 A negative number pops the required number of arguments from |
|
ce99e0d39262
Add documentation for multilink expression syntax
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6389
diff
changeset
|
3177 the stack, applies the operator, and pushes the result. The |
|
ce99e0d39262
Add documentation for multilink expression syntax
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6389
diff
changeset
|
3178 following operators are supported: |
|
6417
586865e08f42
Fix formatting of lists in doc for postfix expressions
John Rouillard <rouilj@ieee.org>
parents:
6414
diff
changeset
|
3179 |
|
6409
ce99e0d39262
Add documentation for multilink expression syntax
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6389
diff
changeset
|
3180 - '-2' stands for 'NOT' and takes one argument |
|
ce99e0d39262
Add documentation for multilink expression syntax
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6389
diff
changeset
|
3181 - '-3' stands for 'AND' and takes two arguments |
|
ce99e0d39262
Add documentation for multilink expression syntax
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6389
diff
changeset
|
3182 - '-4' stands for 'OR' and takes two arguments |
|
6417
586865e08f42
Fix formatting of lists in doc for postfix expressions
John Rouillard <rouilj@ieee.org>
parents:
6414
diff
changeset
|
3183 |
|
6409
ce99e0d39262
Add documentation for multilink expression syntax
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6389
diff
changeset
|
3184 Note that this special handling of ID arguments is applied only |
|
ce99e0d39262
Add documentation for multilink expression syntax
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6389
diff
changeset
|
3185 when a negative number smaller than -1 is encountered as an ID |
|
ce99e0d39262
Add documentation for multilink expression syntax
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6389
diff
changeset
|
3186 in the filter call. Otherwise the implicit OR default |
|
ce99e0d39262
Add documentation for multilink expression syntax
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6389
diff
changeset
|
3187 applies. |
|
ce99e0d39262
Add documentation for multilink expression syntax
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6389
diff
changeset
|
3188 Examples of using Multilink expressions would be |
|
6417
586865e08f42
Fix formatting of lists in doc for postfix expressions
John Rouillard <rouilj@ieee.org>
parents:
6414
diff
changeset
|
3189 |
|
6409
ce99e0d39262
Add documentation for multilink expression syntax
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6389
diff
changeset
|
3190 - '1', '2', '-4', '3', '4', '-4', '-3' |
|
ce99e0d39262
Add documentation for multilink expression syntax
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6389
diff
changeset
|
3191 would search for IDs (1 or 2) and (3 or 4) |
|
ce99e0d39262
Add documentation for multilink expression syntax
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6389
diff
changeset
|
3192 - '-1' '-2' would search for all non-empty Multilinks |
|
ce99e0d39262
Add documentation for multilink expression syntax
Ralf Schlatterbeck <rsc@runtux.com>
parents:
6389
diff
changeset
|
3193 |
|
3688
722ab52d47fc
added filter_sql to SQL backends which takes an arbitrary SQL statement...
Richard Jones <richard@users.sourceforge.net>
parents:
3660
diff
changeset
|
3194 filter_sql **Only in SQL backends** |
|
722ab52d47fc
added filter_sql to SQL backends which takes an arbitrary SQL statement...
Richard Jones <richard@users.sourceforge.net>
parents:
3660
diff
changeset
|
3195 |
|
722ab52d47fc
added filter_sql to SQL backends which takes an arbitrary SQL statement...
Richard Jones <richard@users.sourceforge.net>
parents:
3660
diff
changeset
|
3196 Lists the items that match the SQL provided. The SQL is a |
|
722ab52d47fc
added filter_sql to SQL backends which takes an arbitrary SQL statement...
Richard Jones <richard@users.sourceforge.net>
parents:
3660
diff
changeset
|
3197 complete "select" statement. |
|
722ab52d47fc
added filter_sql to SQL backends which takes an arbitrary SQL statement...
Richard Jones <richard@users.sourceforge.net>
parents:
3660
diff
changeset
|
3198 |
|
722ab52d47fc
added filter_sql to SQL backends which takes an arbitrary SQL statement...
Richard Jones <richard@users.sourceforge.net>
parents:
3660
diff
changeset
|
3199 The SQL select must include the item id as the first column. |
|
722ab52d47fc
added filter_sql to SQL backends which takes an arbitrary SQL statement...
Richard Jones <richard@users.sourceforge.net>
parents:
3660
diff
changeset
|
3200 |
|
722ab52d47fc
added filter_sql to SQL backends which takes an arbitrary SQL statement...
Richard Jones <richard@users.sourceforge.net>
parents:
3660
diff
changeset
|
3201 This function **does not** filter out retired items, add |
|
722ab52d47fc
added filter_sql to SQL backends which takes an arbitrary SQL statement...
Richard Jones <richard@users.sourceforge.net>
parents:
3660
diff
changeset
|
3202 on a where clause "__retired__ <> 1" if you don't want |
|
722ab52d47fc
added filter_sql to SQL backends which takes an arbitrary SQL statement...
Richard Jones <richard@users.sourceforge.net>
parents:
3660
diff
changeset
|
3203 retired nodes. |
|
722ab52d47fc
added filter_sql to SQL backends which takes an arbitrary SQL statement...
Richard Jones <richard@users.sourceforge.net>
parents:
3660
diff
changeset
|
3204 |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3205 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
|
3206 "help" template. |
|
3363
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3207 |
|
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3208 This generates a link to a popup window which displays the |
|
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3209 properties indicated by "properties" of the class named by |
|
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3210 "classname". The "properties" should be a comma-separated list |
|
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3211 (eg. 'id,name,description'). Properties defaults to all the |
|
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3212 properties of a class (excluding id, creator, created and |
|
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3213 activity). |
|
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3214 |
|
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3215 You may optionally override the "label" displayed, the "width", |
|
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3216 the "height", the number of items per page ("pagesize") and |
|
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3217 the field on which the list is sorted ("sort"). |
|
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3218 |
|
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3219 With the "filter" arg it is possible to specify a filter for |
|
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3220 which items are supposed to be displayed. It has to be of |
|
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3221 the format "<field>=<values>;<field>=<values>;...". |
|
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3222 |
|
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3223 The popup window will be resizable and scrollable. |
|
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3224 |
|
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3225 If the "property" arg is given, it's passed through to the |
|
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3226 javascript help_window function. This allows updating of a |
|
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3227 property in the calling HTML page. |
|
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3228 |
|
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3229 If the "form" arg is given, it's passed through to the |
|
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3230 javascript help_window function - it's the name of the form |
|
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3231 the "property" belongs to. |
|
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3232 |
|
5201
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
3233 submit generate a submit button (and action and @csrf hidden elements) |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3234 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
|
3235 history returns 'New node - no history' :) |
|
1136
7e193bbda38e
added generic item editing
Richard Jones <richard@users.sourceforge.net>
parents:
1133
diff
changeset
|
3236 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
|
3237 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
|
3238 =========== ============================================================= |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3239 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3240 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
|
3241 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
|
3242 expression. For example:: |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3243 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3244 python:context['list'] |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3245 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3246 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
|
3247 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3248 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3249 Hyperdb item wrapper |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3250 :::::::::::::::::::: |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3251 |
| 3052 | 3252 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
|
3253 class. |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3254 |
|
4435
386200d0c929
Some minor typos fixed in doc/customizing.txt (Thanks Ralf Hemmecke).
Bernhard Reiter <Bernhard.Reiter@intevation.de>
parents:
4406
diff
changeset
|
3255 This wrapper object provides access to a hyperdb item. |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3256 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3257 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
|
3258 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
|
3259 from the CGI form. |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3260 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3261 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
|
3262 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3263 =============== ======================================================== |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3264 Method Description |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3265 =============== ======================================================== |
|
5201
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
3266 submit generate a submit button (and action and @csrf hidden elements) |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3267 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
|
3268 implemented**) |
|
5227
690ec4f438df
Added missing documentation of the showall parameter to the history
John Rouillard <rouilj@ieee.org>
parents:
5222
diff
changeset
|
3269 history render the journal of the current item as |
|
690ec4f438df
Added missing documentation of the showall parameter to the history
John Rouillard <rouilj@ieee.org>
parents:
5222
diff
changeset
|
3270 HTML. By default properties marked as "quiet" (see |
|
690ec4f438df
Added missing documentation of the showall parameter to the history
John Rouillard <rouilj@ieee.org>
parents:
5222
diff
changeset
|
3271 `design documentation`_) are not shown unless the |
|
690ec4f438df
Added missing documentation of the showall parameter to the history
John Rouillard <rouilj@ieee.org>
parents:
5222
diff
changeset
|
3272 function is called with the showall=True parameter. |
|
5232
462b0f76fce8
issue2550864 - Potential information leakage via journal/history
John Rouillard <rouilj@ieee.org>
parents:
5231
diff
changeset
|
3273 Properties that are not Viewable to the user are not |
|
462b0f76fce8
issue2550864 - Potential information leakage via journal/history
John Rouillard <rouilj@ieee.org>
parents:
5231
diff
changeset
|
3274 shown. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3275 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
|
3276 for the query |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3277 hasPermission specific to the "user" class - determine whether the |
|
2991
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
3278 user has a Permission. The signature is:: |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
3279 |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
3280 hasPermission(self, permission, [classname=], |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
3281 [property=], [itemid=]) |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
3282 |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
3283 where the classname defaults to the current context. |
|
3535
75dc225613cc
fix security check for hasPermission(Permission, None)
Richard Jones <richard@users.sourceforge.net>
parents:
3510
diff
changeset
|
3284 hasRole specific to the "user" class - determine whether the |
|
75dc225613cc
fix security check for hasPermission(Permission, None)
Richard Jones <richard@users.sourceforge.net>
parents:
3510
diff
changeset
|
3285 user has a Role. The signature is:: |
|
75dc225613cc
fix security check for hasPermission(Permission, None)
Richard Jones <richard@users.sourceforge.net>
parents:
3510
diff
changeset
|
3286 |
|
75dc225613cc
fix security check for hasPermission(Permission, None)
Richard Jones <richard@users.sourceforge.net>
parents:
3510
diff
changeset
|
3287 hasRole(self, rolename) |
|
75dc225613cc
fix security check for hasPermission(Permission, None)
Richard Jones <richard@users.sourceforge.net>
parents:
3510
diff
changeset
|
3288 |
|
1136
7e193bbda38e
added generic item editing
Richard Jones <richard@users.sourceforge.net>
parents:
1133
diff
changeset
|
3289 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
|
3290 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
|
3291 is_retired is the item retired? |
|
3510
ef80a6c02e09
describe copy_url method of hyperdb item wrapper
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3476
diff
changeset
|
3292 download_url generate a url-quoted link for download of FileClass |
|
2180
58b6d1747973
Web interface tweaks.
Richard Jones <richard@users.sourceforge.net>
parents:
2159
diff
changeset
|
3293 item contents (ie. file<id>/<name>) |
|
3510
ef80a6c02e09
describe copy_url method of hyperdb item wrapper
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3476
diff
changeset
|
3294 copy_url generate a url-quoted link for creating a copy |
|
ef80a6c02e09
describe copy_url method of hyperdb item wrapper
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3476
diff
changeset
|
3295 of this item. By default, the copy will acquire |
|
ef80a6c02e09
describe copy_url method of hyperdb item wrapper
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3476
diff
changeset
|
3296 all properties of the current item except for |
|
ef80a6c02e09
describe copy_url method of hyperdb item wrapper
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3476
diff
changeset
|
3297 ``messages`` and ``files``. This can be overridden |
|
ef80a6c02e09
describe copy_url method of hyperdb item wrapper
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3476
diff
changeset
|
3298 by passing ``exclude`` argument which contains a list |
|
ef80a6c02e09
describe copy_url method of hyperdb item wrapper
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3476
diff
changeset
|
3299 (or any iterable) of property names that shall not be |
|
ef80a6c02e09
describe copy_url method of hyperdb item wrapper
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3476
diff
changeset
|
3300 copied. Database-driven properties like ``id`` or |
|
ef80a6c02e09
describe copy_url method of hyperdb item wrapper
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3476
diff
changeset
|
3301 ``activity`` cannot be copied. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3302 =============== ======================================================== |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3303 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3304 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
|
3305 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
|
3306 expression. For example:: |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3307 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3308 python:context['journal'] |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3309 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3310 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
|
3311 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3312 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3313 Hyperdb property wrapper |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3314 :::::::::::::::::::::::: |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3315 |
| 3052 | 3316 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
|
3317 ``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
|
3318 ``HTMLNumberProperty``, and so on). |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3319 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3320 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
|
3321 value may be either: |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3322 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3323 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
|
3324 the hyperdb |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3325 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
|
3326 the CGI form |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3327 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3328 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3329 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
|
3330 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3331 =============== ======================================================== |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3332 Attribute Description |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3333 =============== ======================================================== |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3334 _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
|
3335 _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
|
3336 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
|
3337 =============== ======================================================== |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3338 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3339 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
|
3340 |
|
1773
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3341 =========== ================================================================ |
|
1780
d2801a2b0a77
Initial implementation (half-baked) at new Tracker instance.
Richard Jones <richard@users.sourceforge.net>
parents:
1777
diff
changeset
|
3342 Method Description |
|
1773
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3343 =========== ================================================================ |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3344 plain render a "plain" representation of the property. This method |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3345 may take two arguments: |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3346 |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3347 escape |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3348 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
|
3349 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
|
3350 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
|
3351 option is used in the template. The following ``tal:content`` |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3352 expressions are all equivalent:: |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3353 |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3354 "structure python:msg.content.plain(escape=1)" |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3355 "python:msg.content.plain()" |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3356 "msg/content/plain" |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3357 "msg/content" |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3358 |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3359 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
|
3360 complex expression. |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3361 |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3362 hyperlink |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3363 If true, turn URLs, email addresses and hyperdb item |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3364 designators in the text into hyperlinks (default: no). Note |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3365 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
|
3366 want to use this ``tal:content`` expression:: |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3367 |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3368 "structure python:msg.content.plain(hyperlink=1)" |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3369 |
|
2958
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
3370 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
|
3371 transformation done in the plain() method. |
|
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
3372 |
|
1773
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3373 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
|
3374 |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3375 "structure msg/content/hyperlinked" |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3376 |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3377 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
|
3378 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
|
3379 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
|
3380 arguments: |
|
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
3381 |
|
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
3382 size |
|
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
3383 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
|
3384 |
|
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
3385 format (Date properties only) |
|
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
3386 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
|
3387 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
|
3388 below. |
|
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
3389 |
|
3649
12633662ff63
include the popcal in Date field editing and search fields by default
Richard Jones <richard@users.sourceforge.net>
parents:
3648
diff
changeset
|
3390 popcal (Date properties only) |
|
12633662ff63
include the popcal in Date field editing and search fields by default
Richard Jones <richard@users.sourceforge.net>
parents:
3648
diff
changeset
|
3391 Include the Javascript-based popup calendar for date |
|
12633662ff63
include the popcal in Date field editing and search fields by default
Richard Jones <richard@users.sourceforge.net>
parents:
3648
diff
changeset
|
3392 selection. Defaults to on. |
|
12633662ff63
include the popcal in Date field editing and search fields by default
Richard Jones <richard@users.sourceforge.net>
parents:
3648
diff
changeset
|
3393 |
|
1773
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3394 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
|
3395 as StructuredText (requires the StructureText module to be |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3396 installed separately) |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3397 multiline only on String properties - render a multiline form edit |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3398 field for the property |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3399 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
|
3400 as an obscured email address |
|
5156
882fa4d9bead
issue2550795: @dispname query args in page.html search links
John Rouillard <rouilj@ieee.org>
parents:
5154
diff
changeset
|
3401 url_quote only on String properties. It quotes any characters in the |
|
882fa4d9bead
issue2550795: @dispname query args in page.html search links
John Rouillard <rouilj@ieee.org>
parents:
5154
diff
changeset
|
3402 string so it is safe to use in a url. E.G. a space is |
|
882fa4d9bead
issue2550795: @dispname query args in page.html search links
John Rouillard <rouilj@ieee.org>
parents:
5154
diff
changeset
|
3403 replaced with %20. |
|
1773
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3404 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
|
3405 for the property, used for confirmation that the user typed |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3406 the password correctly. Generates a field with name |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3407 "name:confirm". |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3408 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
|
3409 property |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3410 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
|
3411 and now |
|
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3412 local only on Date properties - return this date as a new property |
| 2007 | 3413 with some timezone offset, for example:: |
| 3414 | |
| 3415 python:context.creation.local(10) | |
| 3416 | |
| 3417 will render the date with a +10 hour offset. | |
| 2088 | 3418 pretty Date properties - render the date as "dd Mon YYYY" (eg. "19 |
| 3419 Mar 2004"). Takes an optional format argument, for example:: | |
| 3420 | |
| 3421 python:context.activity.pretty('%Y-%m-%d') | |
| 3422 | |
| 3423 Will format as "2004-03-19" instead. | |
| 3424 | |
| 3425 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
|
3426 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
|
3427 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
|
3428 Reference: time module`__) |
|
6832
234fefd7568a
issue2550559 - Pretty printing / formatting for Number types.
John Rouillard <rouilj@ieee.org>
parents:
6774
diff
changeset
|
3429 |
|
234fefd7568a
issue2550559 - Pretty printing / formatting for Number types.
John Rouillard <rouilj@ieee.org>
parents:
6774
diff
changeset
|
3430 Number properties - takes a printf style format argument |
|
234fefd7568a
issue2550559 - Pretty printing / formatting for Number types.
John Rouillard <rouilj@ieee.org>
parents:
6774
diff
changeset
|
3431 (default: '%0.3f') and formats the number accordingly. |
|
234fefd7568a
issue2550559 - Pretty printing / formatting for Number types.
John Rouillard <rouilj@ieee.org>
parents:
6774
diff
changeset
|
3432 If the value can't be converted, '' is returned if the |
|
234fefd7568a
issue2550559 - Pretty printing / formatting for Number types.
John Rouillard <rouilj@ieee.org>
parents:
6774
diff
changeset
|
3433 value is ``None`` otherwise it is converted to a string. |
|
3292
8c7b522dc934
added date selection popup windows (thanks Marcus Priesch)
Richard Jones <richard@users.sourceforge.net>
parents:
3291
diff
changeset
|
3434 popcal Generate a link to a popup calendar which may be used to |
|
8c7b522dc934
added date selection popup windows (thanks Marcus Priesch)
Richard Jones <richard@users.sourceforge.net>
parents:
3291
diff
changeset
|
3435 edit the date field, for example:: |
|
8c7b522dc934
added date selection popup windows (thanks Marcus Priesch)
Richard Jones <richard@users.sourceforge.net>
parents:
3291
diff
changeset
|
3436 |
| 3597 | 3437 <span tal:replace="structure context/due/popcal" /> |
|
3292
8c7b522dc934
added date selection popup windows (thanks Marcus Priesch)
Richard Jones <richard@users.sourceforge.net>
parents:
3291
diff
changeset
|
3438 |
| 3647 | 3439 you still need to include the ``field`` for the property, so |
| 3648 | 3440 typically you'd have:: |
| 3647 | 3441 |
| 3442 <span tal:replace="structure context/due/field" /> | |
| 3443 <span tal:replace="structure context/due/popcal" /> | |
| 3444 | |
|
1773
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3445 menu only on Link and Multilink properties - render a form select |
|
3127
021b131bd816
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3126
diff
changeset
|
3446 list for this property. Takes a number of optional arguments |
|
021b131bd816
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3126
diff
changeset
|
3447 |
|
021b131bd816
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3126
diff
changeset
|
3448 size |
|
021b131bd816
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3126
diff
changeset
|
3449 is used to limit the length of the list labels |
|
021b131bd816
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3126
diff
changeset
|
3450 height |
|
021b131bd816
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3126
diff
changeset
|
3451 is used to set the <select> tag's "size" attribute |
|
021b131bd816
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3126
diff
changeset
|
3452 showid |
|
021b131bd816
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3126
diff
changeset
|
3453 includes the item ids in the list labels |
|
021b131bd816
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3126
diff
changeset
|
3454 additional |
|
021b131bd816
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3126
diff
changeset
|
3455 lists properties which should be included in the label |
|
021b131bd816
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3126
diff
changeset
|
3456 sort_on |
|
021b131bd816
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3126
diff
changeset
|
3457 indicates the property to sort the list on as (direction, |
|
3363
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3458 (direction, property) where direction is '+' or '-'. A |
|
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3459 single string with the direction prepended may be used. |
|
7bc1e9c42a26
allow specification of pagesize, sorting and filtering in "classhelp" popups
Richard Jones <richard@users.sourceforge.net>
parents:
3293
diff
changeset
|
3460 For example: ('-', 'order'), '+name'. |
|
3470
fd32170475f5
allow preselection of values in templating menu()s (patch [SF#1396085])
Richard Jones <richard@users.sourceforge.net>
parents:
3463
diff
changeset
|
3461 value |
|
fd32170475f5
allow preselection of values in templating menu()s (patch [SF#1396085])
Richard Jones <richard@users.sourceforge.net>
parents:
3463
diff
changeset
|
3462 gives a default value to preselect in the menu |
|
3127
021b131bd816
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3126
diff
changeset
|
3463 |
|
021b131bd816
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3126
diff
changeset
|
3464 The remaining keyword arguments are used as conditions for |
|
021b131bd816
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3126
diff
changeset
|
3465 filtering the items in the list - they're passed as the |
| 3597 | 3466 "filterspec" argument to a Class.filter() call. For example:: |
| 3467 | |
| 3468 <span tal:replace="structure context/status/menu" /> | |
| 3469 | |
| 3470 <span tal:replace="python:context.status.menu(order='+name", | |
| 3471 value='chatting', | |
| 3472 filterspec={'status': '1,2,3,4'}" /> | |
|
3127
021b131bd816
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3126
diff
changeset
|
3473 |
|
2883
1ca5ebe9b16a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2858
diff
changeset
|
3474 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
|
3475 items sorted by some property, for example:: |
|
1ca5ebe9b16a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2858
diff
changeset
|
3476 |
|
1ca5ebe9b16a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2858
diff
changeset
|
3477 python:context.files.sorted('creation') |
|
1ca5ebe9b16a
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2858
diff
changeset
|
3478 |
|
5903
c3728772c594
Add reverse option to hyperdb property wrapper by David Sowder
John Rouillard <rouilj@ieee.org>
parents:
5897
diff
changeset
|
3479 Will list the files by upload date. While |
|
c3728772c594
Add reverse option to hyperdb property wrapper by David Sowder
John Rouillard <rouilj@ieee.org>
parents:
5897
diff
changeset
|
3480 |
| 5923 | 3481 python:context.files.sorted('creation', reverse=True) |
| 3482 | |
|
5903
c3728772c594
Add reverse option to hyperdb property wrapper by David Sowder
John Rouillard <rouilj@ieee.org>
parents:
5897
diff
changeset
|
3483 Will list the files by upload date in reverse order from |
|
6414
3dbf1bc5e567
issue2551120 - The sorted method of MultilinkHTMLProperty crashes ...
John Rouillard <rouilj@ieee.org>
parents:
6409
diff
changeset
|
3484 the prior example. If the property can be unset, you can |
|
3dbf1bc5e567
issue2551120 - The sorted method of MultilinkHTMLProperty crashes ...
John Rouillard <rouilj@ieee.org>
parents:
6409
diff
changeset
|
3485 use the ``NoneFirst`` parameter to sort the None/Unset |
|
3dbf1bc5e567
issue2551120 - The sorted method of MultilinkHTMLProperty crashes ...
John Rouillard <rouilj@ieee.org>
parents:
6409
diff
changeset
|
3486 values at the front or the end of the list. For example:: |
|
3dbf1bc5e567
issue2551120 - The sorted method of MultilinkHTMLProperty crashes ...
John Rouillard <rouilj@ieee.org>
parents:
6409
diff
changeset
|
3487 |
|
3dbf1bc5e567
issue2551120 - The sorted method of MultilinkHTMLProperty crashes ...
John Rouillard <rouilj@ieee.org>
parents:
6409
diff
changeset
|
3488 python:context.files.sorted('creation', NoneFirst=True) |
|
3dbf1bc5e567
issue2551120 - The sorted method of MultilinkHTMLProperty crashes ...
John Rouillard <rouilj@ieee.org>
parents:
6409
diff
changeset
|
3489 |
|
3dbf1bc5e567
issue2551120 - The sorted method of MultilinkHTMLProperty crashes ...
John Rouillard <rouilj@ieee.org>
parents:
6409
diff
changeset
|
3490 will sort files by creation date with files missing a |
|
3dbf1bc5e567
issue2551120 - The sorted method of MultilinkHTMLProperty crashes ...
John Rouillard <rouilj@ieee.org>
parents:
6409
diff
changeset
|
3491 creation date at the start of the list. The default for |
|
3dbf1bc5e567
issue2551120 - The sorted method of MultilinkHTMLProperty crashes ...
John Rouillard <rouilj@ieee.org>
parents:
6409
diff
changeset
|
3492 ``NoneFirst`` is False so these files will sort at the end |
|
3dbf1bc5e567
issue2551120 - The sorted method of MultilinkHTMLProperty crashes ...
John Rouillard <rouilj@ieee.org>
parents:
6409
diff
changeset
|
3493 by default. (Note creation date is never unset, but you |
|
6421
9c57f2814597
Fix issue2551122 (MultilinkHTMLProperty sorted method issue)
John Rouillard <rouilj@ieee.org>
parents:
6417
diff
changeset
|
3494 get the idea.) If you combine NoneFirst with |
|
9c57f2814597
Fix issue2551122 (MultilinkHTMLProperty sorted method issue)
John Rouillard <rouilj@ieee.org>
parents:
6417
diff
changeset
|
3495 ``reverse=True`` the meaning of NoneFirst is inverted: |
|
9c57f2814597
Fix issue2551122 (MultilinkHTMLProperty sorted method issue)
John Rouillard <rouilj@ieee.org>
parents:
6417
diff
changeset
|
3496 True sorts None/unset at the end and False sorts at the |
|
9c57f2814597
Fix issue2551122 (MultilinkHTMLProperty sorted method issue)
John Rouillard <rouilj@ieee.org>
parents:
6417
diff
changeset
|
3497 beginning. |
|
1773
5f15fb95180c
various cosmetic fixes
Richard Jones <richard@users.sourceforge.net>
parents:
1730
diff
changeset
|
3498 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
|
3499 items in reverse order |
|
2180
58b6d1747973
Web interface tweaks.
Richard Jones <richard@users.sourceforge.net>
parents:
2159
diff
changeset
|
3500 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
|
3501 =========== ================================================================ |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3502 |
| 5367 | 3503 __ https://docs.python.org/2/library/time.html |
|
2958
1ae91c2fa5fe
merge from maint-0-7
Richard Jones <richard@users.sourceforge.net>
parents:
2921
diff
changeset
|
3504 |
|
2138
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
3505 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
|
3506 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
|
3507 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
|
3508 |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
3509 context/title/field |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
3510 |
|
f76d1642014a
doc cleanup, editing and creation of a What's New
Richard Jones <richard@users.sourceforge.net>
parents:
2134
diff
changeset
|
3511 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
|
3512 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
|
3513 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
|
3514 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
|
3515 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
|
3516 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3517 |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
3518 The request variable |
| 1098 | 3519 ~~~~~~~~~~~~~~~~~~~~ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
3520 |
| 3052 | 3521 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
|
3522 class. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3523 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3524 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
|
3525 request. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3526 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3527 .. 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
|
3528 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3529 =========== ============================================================ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
3530 Variable Holds |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3531 =========== ============================================================ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
3532 form the CGI form as a cgi.FieldStorage |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
3533 env the CGI environment variables |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
3534 base the base URL for this tracker |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
3535 user a HTMLUser instance for this user |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
3536 classname the current classname (possibly None) |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
3537 template the current template (suffix, also possibly None) |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
3538 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
|
3539 =========== ============================================================ |
| 1083 | 3540 |
| 3541 **Index page specific variables (indexing arguments)** | |
| 3542 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3543 =========== ============================================================ |
| 1083 | 3544 Variable Holds |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3545 =========== ============================================================ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
3546 columns dictionary of the columns to display in an index page |
|
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
3547 show a convenience access to columns - request/show/colname will |
| 1098 | 3548 be true if the columns should be displayed, false otherwise |
|
3696
790363e96852
Sorting/grouping by multiple properties.
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3688
diff
changeset
|
3549 sort index sort columns [(direction, column name)] |
|
790363e96852
Sorting/grouping by multiple properties.
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3688
diff
changeset
|
3550 group index grouping properties [(direction, column name)] |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
3551 filter properties to filter the index on |
|
3718
0d561b24ceff
support sqlite3
Richard Jones <richard@users.sourceforge.net>
parents:
3717
diff
changeset
|
3552 filterspec values to filter the index on (property=value, eg |
|
0d561b24ceff
support sqlite3
Richard Jones <richard@users.sourceforge.net>
parents:
3717
diff
changeset
|
3553 ``priority=1`` or ``messages.author=42`` |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
3554 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
|
3555 =========== ============================================================ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
3556 |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3557 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
|
3558 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3559 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3560 Method Description |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3561 =============== ======================================================== |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3562 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
|
3563 page title |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3564 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
|
3565 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
|
3566 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
|
3567 of the templating |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3568 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
|
3569 list of items (see `hyperdb item wrapper`_, and |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3570 `batching`_) |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3571 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3572 |
| 1142 | 3573 The form variable |
| 3574 ::::::::::::::::: | |
| 3575 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3576 The form variable is a bit special because it's actually a python |
| 1142 | 3577 FieldStorage object. That means that you have two ways to access its |
| 3578 contents. For example, to look up the CGI form value for the variable | |
| 3579 "name", use the path expression:: | |
| 3580 | |
| 3581 request/form/name/value | |
| 3582 | |
| 3583 or the python expression:: | |
| 3584 | |
| 3585 python:request.form['name'].value | |
| 3586 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3587 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
|
3588 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
|
3589 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
|
3590 "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
|
3591 ``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
|
3592 best to know beforehand what you're dealing with. |
| 1142 | 3593 |
| 3594 | |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3595 The db variable |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3596 ~~~~~~~~~~~~~~~ |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3597 |
| 3052 | 3598 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
|
3599 class. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3600 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3601 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
|
3602 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
|
3603 |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3604 db/user |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3605 python:db.user |
|
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3606 |
|
1711
3c3e44aacdb4
Documentation fixes.
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1680
diff
changeset
|
3607 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
|
3608 ``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
|
3609 ``request/user``), but it can be useful in detectors or interfaces. |
|
3c3e44aacdb4
Documentation fixes.
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1680
diff
changeset
|
3610 |
|
1123
644d3075c2df
more documentation, fixed bug in request/description
Richard Jones <richard@users.sourceforge.net>
parents:
1113
diff
changeset
|
3611 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
|
3612 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3613 |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3614 The templates variable |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3615 ~~~~~~~~~~~~~~~~~~~~~~ |
|
1073
cf30c6cdca02
More documentation.
Richard Jones <richard@users.sourceforge.net>
parents:
1070
diff
changeset
|
3616 |
|
4723
42f6c76950a4
Cancel version bump to 1.5.0 - the impact is minimal, so just update
anatoly techtonik <techtonik@gmail.com>
parents:
4695
diff
changeset
|
3617 This was implemented by the ``roundup.cgi.templating.Templates`` |
|
42f6c76950a4
Cancel version bump to 1.5.0 - the impact is minimal, so just update
anatoly techtonik <techtonik@gmail.com>
parents:
4695
diff
changeset
|
3618 class before 1.4.20. In later versions it is the instance of appropriate |
|
42f6c76950a4
Cancel version bump to 1.5.0 - the impact is minimal, so just update
anatoly techtonik <techtonik@gmail.com>
parents:
4695
diff
changeset
|
3619 template engine loader class. |
|
42f6c76950a4
Cancel version bump to 1.5.0 - the impact is minimal, so just update
anatoly techtonik <techtonik@gmail.com>
parents:
4695
diff
changeset
|
3620 |
|
42f6c76950a4
Cancel version bump to 1.5.0 - the impact is minimal, so just update
anatoly techtonik <techtonik@gmail.com>
parents:
4695
diff
changeset
|
3621 This variable is used to access other templates in expressions and |
|
42f6c76950a4
Cancel version bump to 1.5.0 - the impact is minimal, so just update
anatoly techtonik <techtonik@gmail.com>
parents:
4695
diff
changeset
|
3622 template macros. It doesn't have any useful methods defined. The |
|
42f6c76950a4
Cancel version bump to 1.5.0 - the impact is minimal, so just update
anatoly techtonik <techtonik@gmail.com>
parents:
4695
diff
changeset
|
3623 templates can be accessed using the following path expression:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3624 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3625 templates/name |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3626 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3627 or the python expression:: |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3628 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3629 templates[name] |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3630 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3631 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
|
3632 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
|
3633 macro (called "macro_name"), use the path expression:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3634 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3635 templates/name/macros/macro_name |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3636 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3637 or the python expression:: |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3638 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3639 templates[name].macros[macro_name] |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3640 |
|
2855
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
3641 The repeat variable |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
3642 ~~~~~~~~~~~~~~~~~~~ |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
3643 |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
3644 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
|
3645 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
|
3646 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
|
3647 |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
3648 repeat/user |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
3649 python:repeat['user'] |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
3650 |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
3651 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
|
3652 |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
3653 =============== ========================================================= |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
3654 Method Description |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
3655 =============== ========================================================= |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
3656 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
|
3657 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
|
3658 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
|
3659 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
|
3660 number Current position in the sequence, starting from 1. |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
3661 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
|
3662 z, then aa through zz, and so on. |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
3663 Letter Same as letter(), except uppercase. |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
3664 roman Current position in the sequence as lowercase roman |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
3665 numerals. |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
3666 Roman Same as roman(), except uppercase. |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
3667 =============== ========================================================= |
|
874bf6abad42
doc for repeat variable
Richard Jones <richard@users.sourceforge.net>
parents:
2739
diff
changeset
|
3668 |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
3669 .. _templating utilities: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3670 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3671 The utils variable |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
3672 ~~~~~~~~~~~~~~~~~~ |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3673 |
| 3052 | 3674 This is implemented by the |
|
4921
8430576a5625
doc: Reverse engineer extension handling and add separate chapter
anatoly techtonik <techtonik@gmail.com>
parents:
4891
diff
changeset
|
3675 ``roundup.cgi.templating.TemplatingUtils`` class, which may be extended |
|
8430576a5625
doc: Reverse engineer extension handling and add separate chapter
anatoly techtonik <techtonik@gmail.com>
parents:
4891
diff
changeset
|
3676 with additional methods by extensions_. |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3677 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3678 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3679 Method Description |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3680 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3681 Batch return a batch object using the supplied list |
|
2180
58b6d1747973
Web interface tweaks.
Richard Jones <richard@users.sourceforge.net>
parents:
2159
diff
changeset
|
3682 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
|
3683 html_quote quote some text as safe in HTML (ie. <, >, ...) |
|
3292
8c7b522dc934
added date selection popup windows (thanks Marcus Priesch)
Richard Jones <richard@users.sourceforge.net>
parents:
3291
diff
changeset
|
3684 html_calendar renders an HTML calendar used by the |
|
8c7b522dc934
added date selection popup windows (thanks Marcus Priesch)
Richard Jones <richard@users.sourceforge.net>
parents:
3291
diff
changeset
|
3685 ``_generic.calendar.html`` template (itself invoked by |
|
8c7b522dc934
added date selection popup windows (thanks Marcus Priesch)
Richard Jones <richard@users.sourceforge.net>
parents:
3291
diff
changeset
|
3686 the popupCalendar DateHTMLProperty method |
|
6423
2917231d8076
Document templating.utils.anti_csrf_nonce()
John Rouillard <rouilj@ieee.org>
parents:
6421
diff
changeset
|
3687 anti_csrf_nonce returns the random noncue generated for this session |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3688 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3689 |
|
1270
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
3690 |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3691 Batching |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3692 :::::::: |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3693 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3694 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
|
3695 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
|
3696 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3697 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
|
3698 overlap=0) |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3699 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3700 or, to get the current index batch:: |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3701 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3702 request/batch |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3703 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3704 The parameters are: |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3705 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3706 ========= ============================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3707 Parameter Usage |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3708 ========= ============================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3709 sequence a list of HTMLItems |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3710 size how big to make the sequence. |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3711 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
|
3712 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
|
3713 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
|
3714 then it is combined with this batch |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3715 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
|
3716 ========= ============================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3717 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3718 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
|
3719 addition, it has several more attributes: |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3720 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3721 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3722 Attribute Description |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3723 =============== ======================================================== |
| 3052 | 3724 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
|
3725 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
|
3726 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
|
3727 index* |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3728 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
|
3729 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
|
3730 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3731 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3732 And several methods: |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3733 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3734 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3735 Method Description |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3736 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3737 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
|
3738 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
|
3739 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
|
3740 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
|
3741 =============== ======================================================== |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3742 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3743 An example of batching:: |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3744 |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3745 <table class="otherinfo"> |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3746 <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
|
3747 <tr tal:define="keywords db/keyword/list" |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3748 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
|
3749 <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
|
3750 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
|
3751 keyword here</td> |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3752 </tr> |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3753 </table> |
|
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3754 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3755 ... 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
|
3756 the "keyword" class (well, their "name" anyway). |
|
1124
1fc1f92c5f31
more doc, bugfix in Batch
Richard Jones <richard@users.sourceforge.net>
parents:
1123
diff
changeset
|
3757 |
| 2910 | 3758 |
|
4325
6ec048310de7
add simple doc about translating customised tracker content
Richard Jones <richard@users.sourceforge.net>
parents:
4300
diff
changeset
|
3759 Translations |
|
6ec048310de7
add simple doc about translating customised tracker content
Richard Jones <richard@users.sourceforge.net>
parents:
4300
diff
changeset
|
3760 ~~~~~~~~~~~~ |
|
6ec048310de7
add simple doc about translating customised tracker content
Richard Jones <richard@users.sourceforge.net>
parents:
4300
diff
changeset
|
3761 |
|
6ec048310de7
add simple doc about translating customised tracker content
Richard Jones <richard@users.sourceforge.net>
parents:
4300
diff
changeset
|
3762 Should you wish to enable multiple languages in template content that you |
|
6ec048310de7
add simple doc about translating customised tracker content
Richard Jones <richard@users.sourceforge.net>
parents:
4300
diff
changeset
|
3763 create you'll need to add new locale files in the tracker home under a |
|
6ec048310de7
add simple doc about translating customised tracker content
Richard Jones <richard@users.sourceforge.net>
parents:
4300
diff
changeset
|
3764 ``locale`` directory. Use the instructions in the ``developer's guide`` to |
|
6ec048310de7
add simple doc about translating customised tracker content
Richard Jones <richard@users.sourceforge.net>
parents:
4300
diff
changeset
|
3765 create the locale files. |
|
6ec048310de7
add simple doc about translating customised tracker content
Richard Jones <richard@users.sourceforge.net>
parents:
4300
diff
changeset
|
3766 |
|
6ec048310de7
add simple doc about translating customised tracker content
Richard Jones <richard@users.sourceforge.net>
parents:
4300
diff
changeset
|
3767 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3768 Displaying Properties |
| 1098 | 3769 --------------------- |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3770 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3771 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
|
3772 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
|
3773 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
|
3774 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
|
3775 view, that property may be displayed in an editable field. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3776 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3777 |
|
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3778 Index Views |
| 1098 | 3779 ----------- |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3780 |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3781 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
|
3782 classes. The template used is "*classname*.index". |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3783 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3784 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3785 Index View Specifiers |
| 1098 | 3786 ~~~~~~~~~~~~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3787 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3788 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
|
3789 been added for clarity):: |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3790 |
|
3036
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3791 /issue?status=unread,in-progress,resolved& |
|
3904
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
3792 keyword=security,ui& |
|
3696
790363e96852
Sorting/grouping by multiple properties.
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3688
diff
changeset
|
3793 @group=priority,-status& |
|
3036
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3794 @sort=-activity& |
|
3904
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
3795 @filters=status,keyword& |
|
3036
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3796 @columns=title,status,fixer |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3797 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3798 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
|
3799 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
|
3800 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
|
3801 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
|
3802 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
|
3803 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
|
3804 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
|
3805 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
|
3806 headings in the table. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3807 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3808 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
|
3809 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
|
3810 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
|
3811 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3812 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
|
3813 "status" of either "unread" or "in-progress" or "resolved" are |
|
3904
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
3814 displayed, and only items with "keyword" values including both "security" |
|
3696
790363e96852
Sorting/grouping by multiple properties.
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3688
diff
changeset
|
3815 and "ui" are displayed. The items are grouped by priority arranged in |
|
790363e96852
Sorting/grouping by multiple properties.
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3688
diff
changeset
|
3816 ascending order and in descending order by status; and within |
|
790363e96852
Sorting/grouping by multiple properties.
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3688
diff
changeset
|
3817 groups, sorted by activity, arranged in descending order. The filter |
|
3904
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
3818 section shows filters for the "status" and "keyword" properties, and the |
|
3696
790363e96852
Sorting/grouping by multiple properties.
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3688
diff
changeset
|
3819 table includes columns for the "title", "status", and "fixer" |
|
790363e96852
Sorting/grouping by multiple properties.
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3688
diff
changeset
|
3820 properties. |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3821 |
|
3036
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3822 ============ ============================================================= |
|
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3823 Argument Description |
|
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3824 ============ ============================================================= |
|
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3825 @sort sort by prop name, optionally preceeded with '-' to give |
|
3696
790363e96852
Sorting/grouping by multiple properties.
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3688
diff
changeset
|
3826 descending or nothing for ascending sorting. Several |
|
790363e96852
Sorting/grouping by multiple properties.
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3688
diff
changeset
|
3827 properties can be specified delimited with comma. |
|
790363e96852
Sorting/grouping by multiple properties.
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3688
diff
changeset
|
3828 Internally a search-page using several sort properties may |
|
790363e96852
Sorting/grouping by multiple properties.
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3688
diff
changeset
|
3829 use @sort0, @sort1 etc. with option @sortdir0, @sortdir1 |
|
790363e96852
Sorting/grouping by multiple properties.
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3688
diff
changeset
|
3830 etc. for the direction of sorting (a non-empty value of |
|
790363e96852
Sorting/grouping by multiple properties.
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3688
diff
changeset
|
3831 sortdir0 specifies reverse order). |
|
3036
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3832 @group group by prop name, optionally preceeded with '-' or to sort |
|
3696
790363e96852
Sorting/grouping by multiple properties.
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3688
diff
changeset
|
3833 in descending or nothing for ascending order. Several |
|
790363e96852
Sorting/grouping by multiple properties.
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3688
diff
changeset
|
3834 properties can be specified delimited with comma. |
|
790363e96852
Sorting/grouping by multiple properties.
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3688
diff
changeset
|
3835 Internally a search-page using several grouping properties may |
|
790363e96852
Sorting/grouping by multiple properties.
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3688
diff
changeset
|
3836 use @group0, @group1 etc. with option @groupdir0, @groupdir1 |
|
790363e96852
Sorting/grouping by multiple properties.
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3688
diff
changeset
|
3837 etc. for the direction of grouping (a non-empty value of |
|
790363e96852
Sorting/grouping by multiple properties.
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3688
diff
changeset
|
3838 groupdir0 specifies reverse order). |
|
3036
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3839 @columns selects the columns that should be displayed. Default is |
|
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3840 all. |
|
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3841 @filter indicates which properties are being used in filtering. |
|
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3842 Default is none. |
|
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3843 propname selects the values the item properties given by propname must |
|
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3844 have (very basic search/filter). |
|
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3845 @search_text if supplied, performs a full-text search (message bodies, |
|
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3846 issue titles, etc) |
|
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3847 ============ ============================================================= |
|
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3848 |
| 2910 | 3849 |
|
1057
8b9feca82090
some progress
Richard Jones <richard@users.sourceforge.net>
parents:
1003
diff
changeset
|
3850 Searching Views |
| 1098 | 3851 --------------- |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3852 |
| 3052 | 3853 .. note:: |
| 3854 if you add a new column to the ``@columns`` form variable potentials | |
| 3855 then you will need to add the column to the appropriate `index views`_ | |
| 3856 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
|
3857 |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3858 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
|
3859 "*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
|
3860 ``@action`` variable. The "search" action: |
|
1245
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
3861 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3862 - 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
|
3863 searching |
|
3036
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3864 - sets the ``@filter`` variable correctly |
|
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3865 - 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
|
3866 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3867 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
|
3868 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
|
3869 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
|
3870 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
|
3871 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
|
3872 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
|
3873 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
|
3874 |
|
3036
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3875 If the search view does specify the "search" ``@action``, then it may also |
|
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3876 provide an additional argument: |
|
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3877 |
|
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3878 ============ ============================================================= |
|
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3879 Argument Description |
|
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3880 ============ ============================================================= |
|
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3881 @query_name if supplied, the index parameters (including @search_text) |
|
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3882 will be saved off as a the query item and registered against |
|
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3883 the user's queries property. Note that the *classic* template |
|
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3884 schema has this ability, but the *minimal* template schema |
|
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3885 does not. |
|
8fa6b5747a53
updated searching / indexing docs
Richard Jones <richard@users.sourceforge.net>
parents:
2991
diff
changeset
|
3886 ============ ============================================================= |
|
1245
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
3887 |
|
d8c98af869ff
merge from maint-0-5
Richard Jones <richard@users.sourceforge.net>
parents:
1244
diff
changeset
|
3888 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3889 Item Views |
| 1098 | 3890 ---------- |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3891 |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3892 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
|
3893 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
|
3894 "history" section. |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3895 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3896 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3897 Editor Section |
| 1098 | 3898 ~~~~~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3899 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3900 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
|
3901 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
|
3902 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3903 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
|
3904 "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
|
3905 template):: |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3906 |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3907 <table class="form"> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3908 <tr> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
3909 <th>Title</th> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3910 <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
|
3911 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3912 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3913 <tr> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
3914 <th>Priority</th> |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3915 <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
|
3916 <th>Status</th> |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3917 <td tal:content="structure context/status/menu">status</td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3918 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3919 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3920 <tr> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
3921 <th>Superseder</th> |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3922 <td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3923 <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
|
3924 <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
|
3925 <span tal:condition="context/superseder"> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3926 <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
|
3927 </span> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3928 </td> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
3929 <th>Nosy List</th> |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3930 <td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3931 <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
|
3932 <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
|
3933 </td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3934 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3935 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3936 <tr> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
3937 <th>Assigned To</th> |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3938 <td tal:content="structure context/assignedto/menu"> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3939 assignedto menu |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3940 </td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3941 <td> </td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3942 <td> </td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3943 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3944 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3945 <tr> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
3946 <th>Change Note</th> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3947 <td colspan="3"> |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
1083
diff
changeset
|
3948 <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
|
3949 </td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3950 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3951 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3952 <tr> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
3953 <th>File</th> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3954 <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
|
3955 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3956 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3957 <tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3958 <td> </td> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3959 <td colspan="3" tal:content="structure context/submit"> |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3960 submit button will go here |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3961 </td> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3962 </tr> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
3963 </table> |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3964 |
|
673
604c84696461
link() htmltemplate function now has a "showid" option for links & multilinks.
Richard Jones <richard@users.sourceforge.net>
parents:
659
diff
changeset
|
3965 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3966 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
|
3967 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
|
3968 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
|
3969 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
|
3970 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3971 |
| 1638 | 3972 Form values |
| 3973 ::::::::::: | |
| 3974 | |
| 3975 We have a number of ways to pull properties out of the form in order to | |
| 3976 meet the various needs of: | |
| 3977 | |
| 3978 1. editing the current item (perhaps an issue item) | |
| 3979 2. editing information related to the current item (eg. messages or | |
| 3980 attached files) | |
| 3981 3. creating new information to be linked to the current item (eg. time | |
| 3982 spent on an issue) | |
| 3983 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3984 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
|
3985 ":" or "@", and other text ("required") is fixed. |
| 1638 | 3986 |
| 3987 Properties are specified as form variables: | |
| 3988 | |
| 3989 ``<propname>`` | |
| 3990 property on the current context item | |
| 3991 | |
| 3992 ``<designator>:<propname>`` | |
| 3993 property on the indicated item (for editing related information) | |
| 3994 | |
| 3995 ``<classname>-<N>:<propname>`` | |
| 3996 property on the Nth new item of classname (generally for creating new | |
| 3997 items to attach to the current item) | |
| 3998 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
3999 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
|
4000 the special form values: |
| 1638 | 4001 |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
4002 ``@required`` |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4003 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
|
4004 raised. |
| 1638 | 4005 |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
4006 ``@remove@<propname>=id(s)`` |
| 1638 | 4007 The ids will be removed from the multilink property. |
| 4008 | |
| 4009 ``:add:<propname>=id(s)`` | |
| 4010 The ids will be added to the multilink property. | |
| 4011 | |
| 4012 ``:link:<propname>=<designator>`` | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4013 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
|
4014 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
|
4015 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
|
4016 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
|
4017 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
|
4018 newly created item of class <designator> (where <designator> must be |
| 1638 | 4019 <classname>-<N>). |
| 4020 | |
| 4021 Any of the form variables may be prefixed with a classname or | |
| 4022 designator. | |
| 4023 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4024 Two special form values are supported for backwards compatibility: |
| 1638 | 4025 |
| 4026 ``:note`` | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4027 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
|
4028 context item. This is ALWAYS designated "msg-1". |
| 1638 | 4029 ``:file`` |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4030 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
|
4031 :note. This is ALWAYS designated "file-1". |
| 1638 | 4032 |
| 4033 | |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
4034 Spool Section |
| 1098 | 4035 ~~~~~~~~~~~~~ |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
4036 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4037 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
|
4038 of an issue. |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
4039 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
4040 TODO |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
4041 |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
4042 |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
4043 History Section |
| 1098 | 4044 ~~~~~~~~~~~~~~~ |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
4045 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4046 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
|
4047 journal. This is generally generated with the template:: |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
4048 |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
4049 <tal:block tal:replace="structure context/history" /> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
4050 |
|
5232
462b0f76fce8
issue2550864 - Potential information leakage via journal/history
John Rouillard <rouilj@ieee.org>
parents:
5231
diff
changeset
|
4051 or:: |
|
462b0f76fce8
issue2550864 - Potential information leakage via journal/history
John Rouillard <rouilj@ieee.org>
parents:
5231
diff
changeset
|
4052 |
|
462b0f76fce8
issue2550864 - Potential information leakage via journal/history
John Rouillard <rouilj@ieee.org>
parents:
5231
diff
changeset
|
4053 <tal:block |
|
462b0f76fce8
issue2550864 - Potential information leakage via journal/history
John Rouillard <rouilj@ieee.org>
parents:
5231
diff
changeset
|
4054 tal:replace="structure python:context.history(showall=True)" /> |
|
462b0f76fce8
issue2550864 - Potential information leakage via journal/history
John Rouillard <rouilj@ieee.org>
parents:
5231
diff
changeset
|
4055 |
|
462b0f76fce8
issue2550864 - Potential information leakage via journal/history
John Rouillard <rouilj@ieee.org>
parents:
5231
diff
changeset
|
4056 if you want to show history entries for quiet properties. |
|
462b0f76fce8
issue2550864 - Potential information leakage via journal/history
John Rouillard <rouilj@ieee.org>
parents:
5231
diff
changeset
|
4057 |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
4058 *To be done:* |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
4059 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4060 *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
|
4061 templating through the "journal" method of the item*:: |
|
1074
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
4062 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
4063 <tal:block tal:repeat="entry context/journal"> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
4064 a journal entry |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
4065 </tal:block> |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
4066 |
|
954ad22eb7d9
more doc, more cleanup
Richard Jones <richard@users.sourceforge.net>
parents:
1073
diff
changeset
|
4067 *where each journal entry is an HTMLJournalEntry.* |
|
659
e429649ed124
More documentation cleanups.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
4068 |
| 2910 | 4069 |
| 1098 | 4070 Defining new web actions |
| 4071 ------------------------ | |
| 4072 | |
|
2016
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
4073 You may define new actions to be triggered by the ``@action`` form variable. |
| 2915 | 4074 These are added to the tracker ``extensions`` directory and registered |
| 4075 using ``instance.registerAction``. | |
| 4076 | |
| 4077 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
|
4078 |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
4079 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
|
4080 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
|
4081 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
|
4082 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
|
4083 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4084 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
|
4085 issues`_" for an example. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4086 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
4087 |
|
2016
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
4088 Define the new action class |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
4089 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
4090 |
| 2915 | 4091 Create a new action class in your tracker's ``extensions`` directory, for |
| 4092 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
|
4093 |
|
3291
bb08ffc56967
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
3289
diff
changeset
|
4094 from roundup.cgi.actions import Action |
|
bb08ffc56967
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
3289
diff
changeset
|
4095 |
|
2016
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
4096 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
|
4097 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
|
4098 ''' 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
|
4099 ''' |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
4100 |
| 2915 | 4101 The *self.client* attribute is an instance of ``roundup.cgi.client.Client``. |
| 4102 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
|
4103 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4104 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
|
4105 It may then: |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
4106 |
|
4880
ca692423e401
Different approach to fix XSS in issue2550817
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4790
diff
changeset
|
4107 - add information to ``self.client._ok_message`` |
|
ca692423e401
Different approach to fix XSS in issue2550817
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4790
diff
changeset
|
4108 or ``self.client._error_message`` (by using ``self.client.add_ok_message`` |
|
ca692423e401
Different approach to fix XSS in issue2550817
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4790
diff
changeset
|
4109 or ``self.client.add_error_message``, respectively) |
|
2016
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
4110 - 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
|
4111 next |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
4112 - 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
|
4113 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
|
4114 |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
4115 |
|
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
4116 Register the action class |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
4117 ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
4118 |
| 2915 | 4119 The class is now written, but isn't available to the user until you register |
| 4120 it with the following code appended to your ``myaction.py`` file:: | |
| 4121 | |
| 4122 def init(instance): | |
| 4123 instance.registerAction('myaction', myActionClass) | |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
4124 |
|
2016
2112962f5bb1
Update documentation for the client.py split and add an upgrade notice.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
2009
diff
changeset
|
4125 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
|
4126 |
| 2915 | 4127 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
4128 Use the new action |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
4129 ~~~~~~~~~~~~~~~~~~ |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
4130 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
4131 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
|
4132 |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
4133 <input type="hidden" name="@action" value="myaction"> |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
4134 |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
4135 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
|
4136 |
|
2046
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
4137 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
|
4138 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
4139 |
|
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
4140 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
|
4141 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
|
4142 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
|
4143 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
|
4144 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
|
4145 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
|
4146 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
|
4147 |
|
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
4148 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
|
4149 |
|
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
4150 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
|
4151 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
|
4152 spreadsheet or database). |
|
f913b6beac35
document and make easier the actions-returning-content idiom
Richard Jones <richard@users.sourceforge.net>
parents:
2034
diff
changeset
|
4153 |
|
910
299f4890427d
documentation reorg post-new-security
Richard Jones <richard@users.sourceforge.net>
parents:
909
diff
changeset
|
4154 |
| 2910 | 4155 8-bit character set support in Web interface |
| 4156 -------------------------------------------- | |
| 4157 | |
| 4158 The web interface uses UTF-8 default. It may be overridden in both forms | |
| 4159 and a browser cookie. | |
| 4160 | |
| 4161 - In forms, use the ``@charset`` variable. | |
| 4162 - To use the cookie override, have the ``roundup_charset`` cookie set. | |
| 4163 | |
| 4164 In both cases, the value is a valid charset name (eg. ``utf-8`` or | |
| 4165 ``kio8-r``). | |
| 4166 | |
| 4167 Inside Roundup, all strings are stored and processed in utf-8. | |
| 4168 Unfortunately, some older browsers do not work properly with | |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4169 utf-8-encoded pages (e.g. Netscape Navigator 4 displays wrong |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4170 characters in form fields). This version allows one to change |
| 2910 | 4171 the character set for http transfers. To do so, you may add |
| 4172 the following code to your ``page.html`` template:: | |
| 4173 | |
| 4174 <tal:block define="uri string:${request/base}${request/env/PATH_INFO}"> | |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4175 <a tal:attributes="href python:request.indexargs_url(uri, |
| 2910 | 4176 {'@charset':'utf-8'})">utf-8</a> |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4177 <a tal:attributes="href python:request.indexargs_url(uri, |
| 2910 | 4178 {'@charset':'koi8-r'})">koi8-r</a> |
| 4179 </tal:block> | |
| 4180 | |
| 4181 (substitute ``koi8-r`` with appropriate charset for your language). | |
| 4182 Charset preference is kept in the browser cookie ``roundup_charset``. | |
| 4183 | |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4184 ``meta http-equiv`` lines added to the tracker templates in version 0.6.0 |
| 2910 | 4185 should be changed to include actual character set name:: |
| 4186 | |
| 4187 <meta http-equiv="Content-Type" | |
| 4188 tal:attributes="content string:text/html;; charset=${request/client/charset}" | |
| 4189 /> | |
| 4190 | |
| 4191 The charset is also sent in the http header. | |
| 4192 | |
| 6163 | 4193 .. _CustomExamples: |
| 2910 | 4194 |
| 1100 | 4195 Examples |
| 4196 ======== | |
| 4197 | |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
4198 .. contents:: |
|
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
4199 :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
|
4200 :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
|
4201 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4202 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4203 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
|
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 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4206 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
|
4207 the database. |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
4208 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4209 |
| 1228 | 4210 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
|
4211 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 1100 | 4212 |
| 3122 | 4213 This example shows how to add a simple field (a due date) to the default |
| 4214 classic schema. It does not add any additional behaviour, such as enforcing | |
| 4215 the due date, or causing automatic actions to fire if the due date passes. | |
| 4216 | |
|
3409
80dc8011228e
mention schema mutation
Richard Jones <richard@users.sourceforge.net>
parents:
3404
diff
changeset
|
4217 You add new fields by editing the ``schema.py`` file in you tracker's home. |
|
80dc8011228e
mention schema mutation
Richard Jones <richard@users.sourceforge.net>
parents:
3404
diff
changeset
|
4218 Schema changes are automatically applied to the database on the next |
|
80dc8011228e
mention schema mutation
Richard Jones <richard@users.sourceforge.net>
parents:
3404
diff
changeset
|
4219 tracker access (note that roundup-server would need to be restarted as it |
|
80dc8011228e
mention schema mutation
Richard Jones <richard@users.sourceforge.net>
parents:
3404
diff
changeset
|
4220 caches the schema). |
| 3122 | 4221 |
| 6163 | 4222 .. index:: schema; example changes |
| 4223 | |
|
3818
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4224 1. Modify the ``schema.py``:: |
| 3122 | 4225 |
| 4226 issue = IssueClass(db, "issue", | |
|
3904
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
4227 assignedto=Link("user"), keyword=Multilink("keyword"), |
| 3122 | 4228 priority=Link("priority"), status=Link("status"), |
|
3127
021b131bd816
doc fixes, one more fix to the permissions-in-listings fix
Richard Jones <richard@users.sourceforge.net>
parents:
3126
diff
changeset
|
4229 due_date=Date()) |
| 3122 | 4230 |
|
3818
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4231 2. Add an edit field to the ``issue.item.html`` template:: |
| 3122 | 4232 |
| 4233 <tr> | |
| 4234 <th>Due Date</th> | |
| 4235 <td tal:content="structure context/due_date/field" /> | |
|
3818
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4236 </tr> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4237 |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4238 If you want to show only the date part of due_date then do this instead:: |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4239 |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4240 <tr> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4241 <th>Due Date</th> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4242 <td tal:content="structure python:context.due_date.field(format='%Y-%m-%d')" /> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4243 </tr> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4244 |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4245 3. Add the property to the ``issue.index.html`` page:: |
| 3122 | 4246 |
|
3123
5894c7bea8ce
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
3122
diff
changeset
|
4247 (in the heading row) |
|
5894c7bea8ce
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
3122
diff
changeset
|
4248 <th tal:condition="request/show/due_date">Due Date</th> |
|
5894c7bea8ce
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
3122
diff
changeset
|
4249 (in the data row) |
|
3818
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4250 <td tal:condition="request/show/due_date" |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4251 tal:content="i/due_date" /> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4252 |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4253 If you want format control of the display of the due date you can |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4254 enter the following in the data row to show only the actual due date:: |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4255 |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4256 <td tal:condition="request/show/due_date" |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4257 tal:content="python:i.due_date.pretty('%Y-%m-%d')"> </td> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4258 |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4259 4. Add the property to the ``issue.search.html`` page:: |
| 3122 | 4260 |
| 4261 <tr tal:define="name string:due_date"> | |
| 4262 <th i18n:translate="">Due Date:</th> | |
| 4263 <td metal:use-macro="search_input"></td> | |
| 4264 <td metal:use-macro="column_input"></td> | |
| 4265 <td metal:use-macro="sort_input"></td> | |
| 4266 <td metal:use-macro="group_input"></td> | |
| 4267 </tr> | |
| 4268 | |
|
3818
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4269 5. If you wish for the due date to appear in the standard views listed |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4270 in the sidebar of the web interface then you'll need to add "due_date" |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4271 to the columns and columns_showall lists in your ``page.html``:: |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4272 |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4273 columns string:id,activity,due_date,title,creator,status; |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4274 columns_showall string:id,activity,due_date,title,creator,assignedto,status; |
| 3122 | 4275 |
| 4276 Adding a new constrained field to the classic schema | |
| 4277 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 4278 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4279 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
|
4280 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
|
4281 |
| 1098 | 4282 |
| 4283 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
|
4284 :::::::::::: |
| 1098 | 4285 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4286 To make the classic schema of Roundup useful as a TODO tracking system |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4287 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
|
4288 issue: a category. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4289 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4290 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
|
4291 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
|
4292 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
|
4293 best). |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4294 |
| 1098 | 4295 |
| 4296 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
|
4297 :::::::::::::::::::::::::::::: |
| 1098 | 4298 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4299 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
|
4300 plain string, nothing fancy. To change what is in the database you need |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4301 to add some lines to the ``schema.py`` file of your tracker instance. |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4302 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
|
4303 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
4304 # 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
|
4305 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
4306 add:: |
| 1098 | 4307 |
| 4308 category = Class(db, "category", name=String()) | |
| 4309 category.setkey("name") | |
| 4310 | |
| 4311 Here we are setting up a chunk of the database which we are calling | |
| 4312 "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
|
4313 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
|
4314 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
|
4315 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
|
4316 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
|
4317 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
|
4318 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
|
4319 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4320 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
|
4321 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
|
4322 categories off on its own, which isn't much use. We need to link it in |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4323 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
|
4324 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
|
4325 the category:: |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4326 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4327 issue = IssueClass(db, "issue", ... , |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4328 category=Multilink("category"), ... ) |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4329 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4330 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
|
4331 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
|
4332 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
|
4333 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4334 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
|
4335 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
|
4336 |
| 1098 | 4337 |
|
1235
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
4338 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
|
4339 ::::::::::::::::::::::::::::::::: |
|
1235
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
4340 |
|
6174
5522c950a2e4
Add indexing for roundup-admin references.
John Rouillard <rouilj@ieee.org>
parents:
6171
diff
changeset
|
4341 If you haven't initialised the database with the |
|
5522c950a2e4
Add indexing for roundup-admin references.
John Rouillard <rouilj@ieee.org>
parents:
6171
diff
changeset
|
4342 "``roundup-admin initialise``" command, then you |
|
5522c950a2e4
Add indexing for roundup-admin references.
John Rouillard <rouilj@ieee.org>
parents:
6171
diff
changeset
|
4343 can add the following to the tracker ``initial_data.py`` |
|
5522c950a2e4
Add indexing for roundup-admin references.
John Rouillard <rouilj@ieee.org>
parents:
6171
diff
changeset
|
4344 under the comment:: |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4345 |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4346 # 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
|
4347 # 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
|
4348 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4349 Add:: |
|
1235
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
4350 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
4351 category = db.getclass('category') |
|
3582
026adc5f1e13
fix "Adding a new constrained field to the classic schema" example in docs
Richard Jones <richard@users.sourceforge.net>
parents:
3580
diff
changeset
|
4352 category.create(name="scipy") |
|
026adc5f1e13
fix "Adding a new constrained field to the classic schema" example in docs
Richard Jones <richard@users.sourceforge.net>
parents:
3580
diff
changeset
|
4353 category.create(name="chaco") |
|
026adc5f1e13
fix "Adding a new constrained field to the classic schema" example in docs
Richard Jones <richard@users.sourceforge.net>
parents:
3580
diff
changeset
|
4354 category.create(name="weave") |
|
1235
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
4355 |
|
6174
5522c950a2e4
Add indexing for roundup-admin references.
John Rouillard <rouilj@ieee.org>
parents:
6171
diff
changeset
|
4356 .. index:: roundup-admin; create entries in class |
|
5522c950a2e4
Add indexing for roundup-admin references.
John Rouillard <rouilj@ieee.org>
parents:
6171
diff
changeset
|
4357 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4358 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
|
4359 ``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
|
4360 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
4361 % 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
|
4362 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
|
4363 Type "help" for help. |
|
3582
026adc5f1e13
fix "Adding a new constrained field to the classic schema" example in docs
Richard Jones <richard@users.sourceforge.net>
parents:
3580
diff
changeset
|
4364 roundup> create category name=scipy |
|
1235
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
4365 1 |
|
3582
026adc5f1e13
fix "Adding a new constrained field to the classic schema" example in docs
Richard Jones <richard@users.sourceforge.net>
parents:
3580
diff
changeset
|
4366 roundup> create category name=chaco |
|
1235
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
4367 2 |
|
3582
026adc5f1e13
fix "Adding a new constrained field to the classic schema" example in docs
Richard Jones <richard@users.sourceforge.net>
parents:
3580
diff
changeset
|
4368 roundup> create category name=weave |
|
1235
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
4369 3 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
4370 roundup> exit... |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
4371 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
|
4372 |
|
7441653e5330
added hook for external password validation, and some more docco
Richard Jones <richard@users.sourceforge.net>
parents:
1234
diff
changeset
|
4373 |
| 1098 | 4374 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
|
4375 :::::::::::::::::::::::::::::::::::::: |
| 1098 | 4376 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4377 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
|
4378 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
|
4379 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
|
4380 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
|
4381 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4382 We therefore need to change the security of the category objects. This |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4383 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
|
4384 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4385 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
|
4386 them to various roles. Simply add the new "category" to both lists:: |
| 1098 | 4387 |
| 4388 # Assign the access and edit permissions for issue, file and message | |
| 4389 # to regular users now | |
| 4390 for cl in 'issue', 'file', 'msg', 'category': | |
| 4391 p = db.security.getPermission('View', cl) | |
|
2991
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
4392 db.security.addPermissionToRole('User', 'View', cl) |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
4393 db.security.addPermissionToRole('User', 'Edit', cl) |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
4394 db.security.addPermissionToRole('User', 'Create', cl) |
| 1098 | 4395 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4396 These lines assign the "View" and "Edit" Permissions to the "User" role, |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4397 so that normal users can view and edit "category" objects. |
| 1098 | 4398 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4399 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
|
4400 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
|
4401 interface stuff. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4402 |
| 1098 | 4403 |
| 4404 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
|
4405 :::::::::::::::::::::::::::::::: |
| 1098 | 4406 |
| 4407 We need to give the users the ability to create new categories, and the | |
| 4408 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
|
4409 bar, under the "Issues" area. The file that defines how this area looks |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4410 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
|
4411 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4412 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
|
4413 "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
|
4414 excluded in the output depending on whether the condition in the |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4415 classblock is met. We are going to add the category code at the end of |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4416 the classblock for the *issue* class:: |
| 1098 | 4417 |
| 4418 <p class="classblock" | |
| 4419 tal:condition="python:request.user.hasPermission('View', 'category')"> | |
| 4420 <b>Categories</b><br> | |
| 4421 <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
|
4422 href="category?@template=item">New Category<br></a> |
| 1098 | 4423 </p> |
| 4424 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4425 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
|
4426 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
|
4427 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
|
4428 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
|
4429 get that. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4430 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4431 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
|
4432 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
|
4433 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
|
4434 they will get a link to another page which will let the user add new |
| 1098 | 4435 categories. |
| 4436 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4437 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
|
4438 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
|
4439 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
|
4440 now. I just claim that it is so I can add more links in this section |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4441 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
|
4442 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
|
4443 would see the "Categories" stuff. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4444 |
| 1098 | 4445 |
| 4446 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
|
4447 :::::::::::::::::::::::::::::::::::: |
| 1098 | 4448 |
| 4449 We defined code in the previous section which let users with the | |
| 4450 appropriate permissions see a link to a page which would let them edit | |
| 4451 conditions. Now we have to write that page. | |
| 4452 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4453 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
|
4454 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
|
4455 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
|
4456 write now. |
| 1098 | 4457 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4458 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
|
4459 of the code at all, but is useful for debugging. If you load a page in a |
| 1098 | 4460 browser and look at the page source, you can see which sections come |
| 4461 from which files by looking for these comments:: | |
| 4462 | |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4463 <!-- category.item --> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4464 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4465 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
|
4466 trappings:: |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4467 |
| 1214 | 4468 <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
|
4469 <title metal:fill-slot="head_title">Category editing</title> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4470 <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
|
4471 <h2>Category editing</h2> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4472 </td> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4473 <td class="content" metal:fill-slot="content"> |
| 1098 | 4474 |
| 4475 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
|
4476 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
|
4477 form through only once. This is to stop users hitting the send button |
| 1098 | 4478 multiple times when they are impatient and thus having the form sent |
| 4479 multiple times:: | |
| 4480 | |
| 4481 <form method="POST" onSubmit="return submit_once()" | |
| 4482 enctype="multipart/form-data"> | |
| 4483 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4484 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
|
4485 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
|
4486 they better put something in it, otherwise the whole form is pointless:: |
| 1098 | 4487 |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
4488 <input type="hidden" name="@required" value="name"> |
| 1098 | 4489 |
| 4490 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
|
4491 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
|
4492 happening:: |
| 1098 | 4493 |
| 4494 <table class="form"> | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4495 <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
|
4496 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4497 Next, we need the field into which the user is going to enter the new |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4498 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
|
4499 generate a normal HTML field of size 60, and the contents of that field |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4500 will be the "name" variable of the current context (namely "category"). |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4501 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
|
4502 to the form, a new category will be created with that name:: |
| 1098 | 4503 |
| 4504 <tr> | |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
4505 <th>Name</th> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4506 <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
|
4507 name</td> |
| 1098 | 4508 </tr> |
| 4509 | |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4510 Then a submit button so that the user can submit the new category:: |
| 1098 | 4511 |
| 4512 <tr> | |
| 4513 <td> </td> | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4514 <td colspan="3" tal:content="structure context/submit"> |
| 1098 | 4515 submit button will go here |
| 4516 </td> | |
| 4517 </tr> | |
| 4518 | |
|
5201
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
4519 The ``context/submit`` bit generates the submit button but also |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
4520 generates the @action and @csrf hidden fields. The @action field is |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
4521 used to tell Roundup how to process the form. The @csrf field provides |
|
5201
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
4522 a unique single use token to defend against CSRF attacks. (More about |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
4523 anti-csrf measures can be found in ``upgrading.txt``.) |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
4524 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4525 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
|
4526 stuff:: |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4527 |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4528 </td> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4529 </tal:block> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4530 |
| 1098 | 4531 So putting it all together, and closing the table and form we get:: |
| 4532 | |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4533 <!-- category.item --> |
| 1214 | 4534 <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
|
4535 <title metal:fill-slot="head_title">Category editing</title> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4536 <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
|
4537 <h2>Category editing</h2> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4538 </td> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4539 <td class="content" metal:fill-slot="content"> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4540 <form method="POST" onSubmit="return submit_once()" |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4541 enctype="multipart/form-data"> |
| 1098 | 4542 |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4543 <table class="form"> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4544 <tr><th class="header" colspan="2">Category</th></tr> |
| 1098 | 4545 |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4546 <tr> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
4547 <th>Name</th> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4548 <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
|
4549 name</td> |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4550 </tr> |
| 1098 | 4551 |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4552 <tr> |
|
1829
4e4afbe3cd30
Move '<input type="hidden">' elements into a block.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1825
diff
changeset
|
4553 <td> |
|
4e4afbe3cd30
Move '<input type="hidden">' elements into a block.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1825
diff
changeset
|
4554 |
|
4e4afbe3cd30
Move '<input type="hidden">' elements into a block.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1825
diff
changeset
|
4555 <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
|
4556 </td> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4557 <td colspan="3" tal:content="structure context/submit"> |
|
1213
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4558 submit button will go here |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4559 </td> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4560 </tr> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4561 </table> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4562 </form> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4563 </td> |
|
3a5e05edcd87
added doc for METAL
Richard Jones <richard@users.sourceforge.net>
parents:
1164
diff
changeset
|
4564 </tal:block> |
| 1098 | 4565 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4566 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
|
4567 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
|
4568 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
|
4569 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
|
4570 |
| 1098 | 4571 |
| 4572 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
|
4573 :::::::::::::::::::::::::::::::: |
| 1098 | 4574 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4575 We now have the ability to create issues to our heart's content, but |
| 1098 | 4576 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
|
4577 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
|
4578 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
|
4579 is created. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4580 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4581 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
|
4582 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
|
4583 stuff, it is entirely up to your sense of aesthetics:: |
| 1098 | 4584 |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
4585 <th>Category</th> |
|
3582
026adc5f1e13
fix "Adding a new constrained field to the classic schema" example in docs
Richard Jones <richard@users.sourceforge.net>
parents:
3580
diff
changeset
|
4586 <td> |
|
026adc5f1e13
fix "Adding a new constrained field to the classic schema" example in docs
Richard Jones <richard@users.sourceforge.net>
parents:
3580
diff
changeset
|
4587 <span tal:replace="structure context/category/field" /> |
|
026adc5f1e13
fix "Adding a new constrained field to the classic schema" example in docs
Richard Jones <richard@users.sourceforge.net>
parents:
3580
diff
changeset
|
4588 <span tal:replace="structure python:db.category.classhelp('name', |
|
026adc5f1e13
fix "Adding a new constrained field to the classic schema" example in docs
Richard Jones <richard@users.sourceforge.net>
parents:
3580
diff
changeset
|
4589 property='category', width='200')" /> |
| 1098 | 4590 </td> |
| 4591 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4592 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
|
4593 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
|
4594 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
|
4595 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
|
4596 issue). |
| 1098 | 4597 |
| 4598 The classhelp lines generate a link (labelled "list") to a popup window | |
| 4599 which contains the list of currently known categories. | |
| 4600 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4601 |
| 1098 | 4602 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
|
4603 ::::::::::::::::::::::: |
| 1098 | 4604 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4605 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
|
4606 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
|
4607 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
|
4608 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
|
4609 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4610 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
|
4611 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
|
4612 ``<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
|
4613 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
|
4614 ``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
|
4615 change. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4616 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4617 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
|
4618 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
|
4619 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
|
4620 |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
4621 <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
|
4622 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
|
4623 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
|
4624 <th>Priority:</th> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
4625 <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
|
4626 <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
|
4627 <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
|
4628 <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
|
4629 </tr> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
4630 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4631 The definitions in the ``<tr>`` opening tag are used by the macros: |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4632 |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4633 - ``search_select`` expands to a drop-down box with all categories using |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4634 ``db_klass`` and ``db_content``. |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4635 - ``column_input`` expands to a checkbox for selecting what columns |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4636 should be displayed. |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4637 - ``sort_input`` expands to a radio button for selecting what property |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4638 should be sorted on. |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4639 - ``group_input`` expands to a radio button for selecting what property |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4640 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
|
4641 |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
4642 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
|
4643 |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
4644 <tr> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
4645 <th>Category:</th> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
4646 <td> |
| 1098 | 4647 <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
|
4648 <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
|
4649 <option value="">------------</option> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
4650 <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
|
4651 <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
|
4652 <option value="3">weave</option> |
| 1098 | 4653 </select> |
|
1730
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
4654 </td> |
|
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
4655 <td><input type="checkbox" name=":columns" value="category"></td> |
|
3696
790363e96852
Sorting/grouping by multiple properties.
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3688
diff
changeset
|
4656 <td><input type="radio" name=":sort0" value="category"></td> |
|
790363e96852
Sorting/grouping by multiple properties.
Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
parents:
3688
diff
changeset
|
4657 <td><input type="radio" name=":group0" value="category"></td> |
|
1730
2dd6b4c825e9
Final touches to fix query editing. It should work now.
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1711
diff
changeset
|
4658 </tr> |
| 1098 | 4659 |
| 4660 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
|
4661 ::::::::::::::::::::::::::::::::::: |
| 1098 | 4662 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4663 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
|
4664 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
|
4665 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
|
4666 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
|
4667 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
|
4668 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4669 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
|
4670 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
|
4671 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
|
4672 forth. |
| 1098 | 4673 |
| 4674 Firstly we need to add an appropriate header to the start of the table:: | |
| 4675 | |
| 4676 <th tal:condition="request/show/category">Category</th> | |
| 4677 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4678 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
|
4679 Category column if the user has selected not to see it. |
| 1098 | 4680 |
| 4681 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
|
4682 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
|
4683 that every issue gets assigned to "i" in turn. |
| 1098 | 4684 |
| 4685 The new part of code to display the category will look like this:: | |
| 4686 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4687 <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
|
4688 tal:content="i/category"></td> |
| 1098 | 4689 |
| 4690 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
|
4691 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
|
4692 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
|
4693 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4694 Finally we have to edit ``html/page.html`` again. This time, we need to |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4695 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
|
4696 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
|
4697 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
|
4698 The option that we are interested in is the ``:columns=`` one which |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
4699 tells Roundup which fields of the issue to display. Simply add |
| 1098 | 4700 "category" to that list and it all should work. |
| 4701 | |
| 1262 | 4702 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
|
4703 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 1262 | 4704 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4705 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
|
4706 be able to give a summary of the total time spent on a particular issue. |
| 1262 | 4707 |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
4708 1. Add a new class to your tracker ``schema.py``:: |
| 1262 | 4709 |
| 4710 # storage for time logging | |
| 4711 timelog = Class(db, "timelog", period=Interval()) | |
| 4712 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4713 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
|
4714 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
|
4715 |
|
3652
3a19d31be628
add in note about perms
Richard Jones <richard@users.sourceforge.net>
parents:
3649
diff
changeset
|
4716 You will need to grant "Creation" permission to the users who are |
| 3653 | 4717 allowed to add timelog entries. You may do this with:: |
|
3652
3a19d31be628
add in note about perms
Richard Jones <richard@users.sourceforge.net>
parents:
3649
diff
changeset
|
4718 |
|
3a19d31be628
add in note about perms
Richard Jones <richard@users.sourceforge.net>
parents:
3649
diff
changeset
|
4719 db.security.addPermissionToRole('User', 'Create', 'timelog') |
|
3a19d31be628
add in note about perms
Richard Jones <richard@users.sourceforge.net>
parents:
3649
diff
changeset
|
4720 db.security.addPermissionToRole('User', 'View', 'timelog') |
|
3a19d31be628
add in note about perms
Richard Jones <richard@users.sourceforge.net>
parents:
3649
diff
changeset
|
4721 |
| 3653 | 4722 If users are also able to *edit* timelog entries, then also include:: |
|
3652
3a19d31be628
add in note about perms
Richard Jones <richard@users.sourceforge.net>
parents:
3649
diff
changeset
|
4723 |
|
3a19d31be628
add in note about perms
Richard Jones <richard@users.sourceforge.net>
parents:
3649
diff
changeset
|
4724 db.security.addPermissionToRole('User', 'Edit', 'timelog') |
|
3a19d31be628
add in note about perms
Richard Jones <richard@users.sourceforge.net>
parents:
3649
diff
changeset
|
4725 |
| 6163 | 4726 .. index:: schema; example changes |
| 4727 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4728 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
|
4729 ``schema.py``):: |
| 1262 | 4730 |
| 4731 issue = IssueClass(db, "issue", | |
|
3904
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
4732 assignedto=Link("user"), keyword=Multilink("keyword"), |
| 1262 | 4733 priority=Link("priority"), status=Link("status"), |
| 4734 times=Multilink("timelog")) | |
| 4735 | |
| 4736 the "times" property is the new link to the "timelog" class. | |
| 4737 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4738 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
|
4739 interface we'll have a new entry field. This is a special field |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4740 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
|
4741 affects a different item (a timelog item) and not the template's |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4742 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
|
4743 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
|
4744 documentation on `special form variables`_). In particular, we add a |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4745 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
|
4746 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
4747 <tr> |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
4748 <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
|
4749 <td colspan=3><input type="text" name="timelog-1@period" /> |
|
3818
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4750 (enter as '3y 1m 4d 2:40:02' or parts thereof) |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
4751 </td> |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
4752 </tr> |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
4753 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
4754 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
|
4755 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
|
4756 like this:: |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
4757 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
4758 <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
|
4759 |
|
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
4760 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
|
4761 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
|
4762 added to it. |
|
3818
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4763 |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4764 The full entry will now look like this:: |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4765 |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4766 <tr> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4767 <th>Time Log</th> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4768 <td colspan=3><input type="text" name="timelog-1@period" /> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4769 (enter as '3y 1m 4d 2:40:02' or parts thereof) |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4770 <input type="hidden" name="@link@times" value="timelog-1" /> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4771 </td> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4772 </tr> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4773 |
|
1679
e2caeaa34ed4
fix timelog documentation, add new cgi special for variable doc
Richard Jones <richard@users.sourceforge.net>
parents:
1674
diff
changeset
|
4774 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4775 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
|
4776 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
|
4777 some Python code, since it's beyond the scope of PageTemplates to |
| 2915 | 4778 perform such calculations. We do this by adding a module ``timespent.py`` |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4779 to the ``extensions`` directory in our tracker. The contents of this |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4780 file is as follows:: |
| 2915 | 4781 |
|
3717
5770f1802cd0
better conflict retry in postgresql backend [SF#1552809]
Richard Jones <richard@users.sourceforge.net>
parents:
3697
diff
changeset
|
4782 from roundup import date |
|
5770f1802cd0
better conflict retry in postgresql backend [SF#1552809]
Richard Jones <richard@users.sourceforge.net>
parents:
3697
diff
changeset
|
4783 |
| 2915 | 4784 def totalTimeSpent(times): |
| 4785 ''' Call me with a list of timelog items (which have an | |
| 4786 Interval "period" property) | |
|
1270
c3424abf7f77
added ability to implement new templating utility methods
Richard Jones <richard@users.sourceforge.net>
parents:
1262
diff
changeset
|
4787 ''' |
|
3717
5770f1802cd0
better conflict retry in postgresql backend [SF#1552809]
Richard Jones <richard@users.sourceforge.net>
parents:
3697
diff
changeset
|
4788 total = date.Interval('0d') |
| 2915 | 4789 for time in times: |
| 4790 total += time.period._value | |
| 4791 return total | |
| 4792 | |
| 4793 def init(instance): | |
| 4794 instance.registerUtil('totalTimeSpent', totalTimeSpent) | |
| 4795 | |
| 4796 We will now be able to access the ``totalTimeSpent`` function via the | |
| 4797 ``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
|
4798 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4799 5. Display the timelog for an issue:: |
| 1262 | 4800 |
| 4801 <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
|
4802 <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
|
4803 <tal:block |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4804 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
|
4805 </th></tr> |
| 1262 | 4806 <tr><th>Date</th><th>Period</th><th>Logged By</th></tr> |
| 4807 <tr tal:repeat="time context/times"> | |
| 4808 <td tal:content="time/creation"></td> | |
| 4809 <td tal:content="time/period"></td> | |
| 4810 <td tal:content="time/creator"></td> | |
| 4811 </tr> | |
| 4812 </table> | |
| 4813 | |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4814 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
|
4815 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
|
4816 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
|
4817 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
|
4818 and 40 minutes). |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
4819 |
|
3818
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4820 6. If you're using a persistent web server - ``roundup-server`` or |
|
5891
6e341009593b
Deprecate mod_python issue2551005
John Rouillard <rouilj@ieee.org>
parents:
5881
diff
changeset
|
4821 ``mod_wsgi`` 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
|
4822 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
|
4823 time logging interface. |
| 1262 | 4824 |
|
3657
f7db2771e87d
add info about storing Store TimeLog with Messages
Richard Jones <richard@users.sourceforge.net>
parents:
3653
diff
changeset
|
4825 An extension of this modification attaches the timelog entries to any |
|
f7db2771e87d
add info about storing Store TimeLog with Messages
Richard Jones <richard@users.sourceforge.net>
parents:
3653
diff
changeset
|
4826 change message entered at the time of the timelog entry: |
|
f7db2771e87d
add info about storing Store TimeLog with Messages
Richard Jones <richard@users.sourceforge.net>
parents:
3653
diff
changeset
|
4827 |
|
3818
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4828 A. Add a link to the timelog to the msg class in ``schema.py``: |
|
3657
f7db2771e87d
add info about storing Store TimeLog with Messages
Richard Jones <richard@users.sourceforge.net>
parents:
3653
diff
changeset
|
4829 |
|
f7db2771e87d
add info about storing Store TimeLog with Messages
Richard Jones <richard@users.sourceforge.net>
parents:
3653
diff
changeset
|
4830 msg = FileClass(db, "msg", |
|
f7db2771e87d
add info about storing Store TimeLog with Messages
Richard Jones <richard@users.sourceforge.net>
parents:
3653
diff
changeset
|
4831 author=Link("user", do_journal='no'), |
|
f7db2771e87d
add info about storing Store TimeLog with Messages
Richard Jones <richard@users.sourceforge.net>
parents:
3653
diff
changeset
|
4832 recipients=Multilink("user", do_journal='no'), |
|
f7db2771e87d
add info about storing Store TimeLog with Messages
Richard Jones <richard@users.sourceforge.net>
parents:
3653
diff
changeset
|
4833 date=Date(), |
|
f7db2771e87d
add info about storing Store TimeLog with Messages
Richard Jones <richard@users.sourceforge.net>
parents:
3653
diff
changeset
|
4834 summary=String(), |
|
f7db2771e87d
add info about storing Store TimeLog with Messages
Richard Jones <richard@users.sourceforge.net>
parents:
3653
diff
changeset
|
4835 files=Multilink("file"), |
|
f7db2771e87d
add info about storing Store TimeLog with Messages
Richard Jones <richard@users.sourceforge.net>
parents:
3653
diff
changeset
|
4836 messageid=String(), |
|
3818
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4837 inreplyto=String(), |
|
3657
f7db2771e87d
add info about storing Store TimeLog with Messages
Richard Jones <richard@users.sourceforge.net>
parents:
3653
diff
changeset
|
4838 times=Multilink("timelog")) |
|
f7db2771e87d
add info about storing Store TimeLog with Messages
Richard Jones <richard@users.sourceforge.net>
parents:
3653
diff
changeset
|
4839 |
|
3818
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4840 B. Add a new hidden field that links that new timelog item (new |
|
3657
f7db2771e87d
add info about storing Store TimeLog with Messages
Richard Jones <richard@users.sourceforge.net>
parents:
3653
diff
changeset
|
4841 because it's marked as having id "-1") to the new message. |
|
3818
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4842 The link is placed in ``issue.item.html`` in the same section that |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4843 handles the timelog entry. |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4844 |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4845 It looks like this after this addition:: |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4846 |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4847 <tr> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4848 <th>Time Log</th> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4849 <td colspan=3><input type="text" name="timelog-1@period" /> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4850 (enter as '3y 1m 4d 2:40:02' or parts thereof) |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4851 <input type="hidden" name="@link@times" value="timelog-1" /> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4852 <input type="hidden" name="msg-1@link@times" value="timelog-1" /> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4853 </td> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4854 </tr> |
|
3657
f7db2771e87d
add info about storing Store TimeLog with Messages
Richard Jones <richard@users.sourceforge.net>
parents:
3653
diff
changeset
|
4855 |
|
f7db2771e87d
add info about storing Store TimeLog with Messages
Richard Jones <richard@users.sourceforge.net>
parents:
3653
diff
changeset
|
4856 The "times" property of the message will have the new id added to it. |
|
f7db2771e87d
add info about storing Store TimeLog with Messages
Richard Jones <richard@users.sourceforge.net>
parents:
3653
diff
changeset
|
4857 |
|
3818
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4858 C. Add the timelog listing from step 5. to the ``msg.item.html`` template |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4859 so that the timelog entry appears on the message view page. Note that |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4860 the call to totalTimeSpent is not used here since there will only be one |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4861 single timelog entry for each message. |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4862 |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4863 I placed it after the Date entry like this:: |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4864 |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4865 <tr> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4866 <th i18n:translate="">Date:</th> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4867 <td tal:content="context/date"></td> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4868 </tr> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4869 </table> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4870 |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4871 <table class="otherinfo" tal:condition="context/times"> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4872 <tr><th colspan="3" class="header">Time Log</th></tr> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4873 <tr><th>Date</th><th>Period</th><th>Logged By</th></tr> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4874 <tr tal:repeat="time context/times"> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4875 <td tal:content="time/creation"></td> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4876 <td tal:content="time/period"></td> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4877 <td tal:content="time/creator"></td> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4878 </tr> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4879 </table> |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4880 |
|
e5043875a03d
Improved due_date and timelog customisation docs [SF#1625124]
Richard Jones <richard@users.sourceforge.net>
parents:
3796
diff
changeset
|
4881 <table class="messages"> |
|
3657
f7db2771e87d
add info about storing Store TimeLog with Messages
Richard Jones <richard@users.sourceforge.net>
parents:
3653
diff
changeset
|
4882 |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4883 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4884 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
|
4885 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4886 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4887 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
|
4888 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
|
4889 able to support multiple types of issues. This example demonstrates adding |
| 3289 | 4890 a system support issue class to a 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
|
4891 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4892 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
|
4893 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
|
4894 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
|
4895 |
| 3289 | 4896 2. Add the new issue class to your tracker's ``schema.py``. Just after the |
| 4897 "issue" class definition, add:: | |
| 4898 | |
| 4899 # list our systems | |
| 4900 system = Class(db, "system", name=String(), order=Number()) | |
| 4901 system.setkey("name") | |
| 4902 | |
| 4903 # store issues related to those systems | |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4904 support = IssueClass(db, "support", |
|
3904
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
4905 assignedto=Link("user"), keyword=Multilink("keyword"), |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4906 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
|
4907 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
|
4908 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4909 3. Copy the existing ``issue.*`` (item, search and index) templates in the |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4910 tracker's ``html`` to ``support.*``. Edit them so they use the properties |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4911 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
|
4912 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
|
4913 required properties. |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
4914 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4915 4. Edit the modules in the ``detectors``, adding lines to their ``init`` |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4916 functions where appropriate. Look for ``audit`` and ``react`` registrations |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4917 on the ``issue`` class, and duplicate them for ``support``. |
|
2159
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
4918 |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
4919 5. Create a new sidebar box for the new support class. Duplicate the |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4920 existing issues one, changing the ``issue`` class name to ``support``. |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4921 |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4922 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
|
4923 |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
4924 |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
4925 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
|
4926 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
|
4927 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
|
4928 |
|
2991
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
4929 db.security.addPermissionToRole('SysAdmin', 'View', 'support') |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
4930 db.security.addPermissionToRole('SysAdmin', 'Create', 'support') |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
4931 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
|
4932 |
|
2159
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
4933 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
|
4934 users, and add "SysAdmin" to their Roles list. |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
4935 |
|
c22329f379ae
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2156
diff
changeset
|
4936 Alternatively, you might want to change the Edit/View permissions granted |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4937 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
|
4938 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
|
4939 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
|
4940 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4941 |
|
4891
ad3d628e73f2
docs: Link custom authentication examples in admin guide
anatoly techtonik <techtonik@gmail.com>
parents:
4888
diff
changeset
|
4942 .. _external-authentication: |
|
ad3d628e73f2
docs: Link custom authentication examples in admin guide
anatoly techtonik <techtonik@gmail.com>
parents:
4888
diff
changeset
|
4943 |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4944 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
|
4945 ----------------------------- |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4946 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4947 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
|
4948 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4949 |
|
3228
1b15e9eeb592
fixes to the "Using an external password validation source"...
Richard Jones <richard@users.sourceforge.net>
parents:
3130
diff
changeset
|
4950 .. note:: You will need to either have an "admin" user in your external |
|
1b15e9eeb592
fixes to the "Using an external password validation source"...
Richard Jones <richard@users.sourceforge.net>
parents:
3130
diff
changeset
|
4951 password source *or* have one of your regular users have |
|
1b15e9eeb592
fixes to the "Using an external password validation source"...
Richard Jones <richard@users.sourceforge.net>
parents:
3130
diff
changeset
|
4952 the Admin Role assigned. If you need to assign the Role *after* |
|
1b15e9eeb592
fixes to the "Using an external password validation source"...
Richard Jones <richard@users.sourceforge.net>
parents:
3130
diff
changeset
|
4953 making the changes below, you may use the ``roundup-admin`` |
|
1b15e9eeb592
fixes to the "Using an external password validation source"...
Richard Jones <richard@users.sourceforge.net>
parents:
3130
diff
changeset
|
4954 program to edit a user's details. |
|
1b15e9eeb592
fixes to the "Using an external password validation source"...
Richard Jones <richard@users.sourceforge.net>
parents:
3130
diff
changeset
|
4955 |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4956 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
|
4957 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
|
4958 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
|
4959 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
|
4960 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
|
4961 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
|
4962 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4963 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
|
4964 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4965 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
|
4966 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
|
4967 need to override the standard ``verifyPassword`` method defined in |
| 2915 | 4968 ``roundup.cgi.actions.LoginAction`` and register the new class. The |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
4969 following is added as ``externalpassword.py`` in the tracker ``extensions`` |
| 2915 | 4970 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
|
4971 |
|
3228
1b15e9eeb592
fixes to the "Using an external password validation source"...
Richard Jones <richard@users.sourceforge.net>
parents:
3130
diff
changeset
|
4972 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
|
4973 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
|
4974 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4975 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
|
4976 def verifyPassword(self, userid, password): |
| 2915 | 4977 '''Look through the file, line by line, looking for a |
| 4978 name that matches. | |
| 4979 ''' | |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4980 # 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
|
4981 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
|
4982 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4983 # 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
|
4984 # 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
|
4985 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
|
4986 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4987 # 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
|
4988 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
|
4989 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
|
4990 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
|
4991 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
|
4992 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
4993 # 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
|
4994 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
|
4995 |
| 2915 | 4996 def init(instance): |
| 4997 instance.registerAction('login', ExternalPasswordLoginAction) | |
| 4998 | |
| 4999 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
|
5000 template. |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5001 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5002 |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5003 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
|
5004 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5005 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
5006 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
|
5007 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
|
5008 and primary user group. |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
5009 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
5010 Roundup can use this store as its primary source of user information, |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
5011 but it needs additional information too - email address(es), Roundup |
|
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
5012 Roles, vacation flags, Roundup hyperdb item ids, etc. Also, "retired" |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
5013 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
|
5014 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
|
5015 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
5016 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
|
5017 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
|
5018 described in the previous example, `using an external password |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5019 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
|
5020 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
|
5021 immediate access is needed. In short, it: |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5022 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5023 1. parses the passwd file, finding usernames, passwords and real names, |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
5024 2. compares that list to the current Roundup user list: |
|
1299
b2d04ce03802
Email improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
1293
diff
changeset
|
5025 |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5026 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
|
5027 b. entries with mismatching real names are *updated* |
| 1293 | 5028 c. entries only exist in the passwd file are *created* |
|
1299
b2d04ce03802
Email improvements.
Richard Jones <richard@users.sourceforge.net>
parents:
1293
diff
changeset
|
5029 |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5030 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
|
5031 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
5032 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
|
5033 to ``retire()`` or ``set()``. The creation operation requires more |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5034 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
|
5035 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
|
5036 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
|
5037 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
|
5038 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
|
5039 |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
5040 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
|
5041 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
|
5042 tracker we're to work on:: |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5043 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5044 import sys, os, smtplib |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5045 from roundup import instance, date |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5046 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5047 # open the tracker |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5048 tracker_home = sys.argv[1] |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5049 tracker = instance.open(tracker_home) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5050 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5051 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
|
5052 |
|
3228
1b15e9eeb592
fixes to the "Using an external password validation source"...
Richard Jones <richard@users.sourceforge.net>
parents:
3130
diff
changeset
|
5053 # read in the users from the "passwd.txt" file |
|
1b15e9eeb592
fixes to the "Using an external password validation source"...
Richard Jones <richard@users.sourceforge.net>
parents:
3130
diff
changeset
|
5054 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
|
5055 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
|
5056 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
5057 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
|
5058 appear in the file):: |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5059 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5060 # 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
|
5061 # "real" users |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5062 ignore = ['ekmmon', 'bfast', 'csrmail'] |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5063 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5064 # 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
|
5065 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
|
5066 'cs_pool', 'anonymous', 'system_pool', 'automated'] |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5067 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5068 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
|
5069 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5070 roles = { |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5071 '501': 'User,Tech', # tech |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5072 '502': 'User', # finance |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5073 '503': 'User,CSR', # customer service reps |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5074 '504': 'User', # sales |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5075 '505': 'User', # marketing |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5076 } |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5077 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
5078 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
|
5079 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
|
5080 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
|
5081 now do all the work:: |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5082 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5083 # open the database |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5084 db = tracker.open('admin') |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5085 try: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5086 # 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
|
5087 msg = [] |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5088 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5089 # 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
|
5090 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
|
5091 if user in ignore: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5092 # this user shouldn't appear in our tracker |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5093 continue |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5094 keep.append(user) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5095 try: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5096 # see if the user exists in the tracker |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5097 uid = db.user.lookup(user) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5098 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5099 # 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
|
5100 if real != db.user.get(uid, 'realname'): |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5101 db.user.set(uid, realname=real) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5102 msg.append('FIX %s - %s'%(user, real)) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5103 except KeyError: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5104 # nope, the user doesn't exist |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5105 db.user.create(username=user, realname=real, |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5106 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
|
5107 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
|
5108 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
5109 # 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
|
5110 # "keep" list - retire those who aren't |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5111 for uid in db.user.list(): |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5112 user = db.user.get(uid, 'username') |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5113 if user not in keep: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5114 db.user.retire(uid) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5115 msg.append('RET %s'%user) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5116 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5117 # 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
|
5118 if msg: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5119 # create the email |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5120 msg = '''Subject: %s user database maintenance |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5121 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5122 %s |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5123 '''%(db.config.TRACKER_NAME, '\n'.join(msg)) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5124 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5125 # send the email |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5126 smtp = smtplib.SMTP(db.config.MAILHOST) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5127 addr = db.config.ADMIN_EMAIL |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5128 smtp.sendmail(addr, addr, msg) |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5129 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5130 # now we're done - commit the changes |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5131 db.commit() |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5132 finally: |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5133 # always close the database cleanly |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5134 db.close() |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5135 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5136 And that's it! |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5137 |
|
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5138 |
|
1680
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
5139 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
|
5140 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
1680
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
5141 |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
5142 A script that reads users from an LDAP store using |
| 5367 | 5143 https://pypi.org/project/python-ldap/ and then compares the list to the users in the |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
5144 Roundup user database would be pretty easy to write. You'd then have it run |
|
1680
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
5145 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
|
5146 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
|
5147 for more information about doing this. |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
5148 |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
5149 To authenticate off the LDAP store (rather than using the passwords in the |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5150 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
|
5151 extension to the cgi interface. You'd do this by overriding the method called |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5152 ``verifyPassword`` on the ``LoginAction`` class in your tracker's |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5153 ``extensions`` directory (see `using an external password validation |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5154 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
|
5155 |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
5156 def verifyPassword(self, userid, password): |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
5157 ''' Verify the password that the user has supplied |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
5158 ''' |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
5159 stored = self.db.user.get(self.userid, 'password') |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
5160 if password == stored: |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
5161 return 1 |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
5162 if not password and not stored: |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
5163 return 1 |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
5164 return 0 |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
5165 |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
5166 So you could reimplement this as something like:: |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
5167 |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
5168 def verifyPassword(self, userid, password): |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
5169 ''' Verify the password that the user has supplied |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
5170 ''' |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
5171 # 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
|
5172 username = self.db.user.get(self.userid, 'username') |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
5173 # 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
|
5174 |
|
86cc794cc3a0
added simplistic LDAP authentication example
Richard Jones <richard@users.sourceforge.net>
parents:
1679
diff
changeset
|
5175 |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5176 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
|
5177 ---------------------------- |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5178 |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
5179 .. index:: single: auditors; how to register (example) |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
5180 single: reactors; how to register (example) |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
5181 |
|
3830
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5182 Preventing SPAM |
|
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5183 ~~~~~~~~~~~~~~~ |
|
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5184 |
|
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5185 The following detector code may be installed in your tracker's |
|
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5186 ``detectors`` directory. It will block any messages being created that |
|
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5187 have HTML attachments (a very common vector for spam and phishing) |
|
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5188 and any messages that have more than 2 HTTP URLs in them. Just copy |
|
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5189 the following into ``detectors/anti_spam.py`` in your tracker:: |
|
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5190 |
|
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5191 from roundup.exceptions import Reject |
|
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5192 |
|
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5193 def reject_html(db, cl, nodeid, newvalues): |
|
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5194 if newvalues['type'] == 'text/html': |
|
5332
d0689aaa83db
Applied patch 0038 from issue2550960 to upgrade code examples in
John Rouillard <rouilj@ieee.org>
parents:
5268
diff
changeset
|
5195 raise Reject('not allowed') |
|
3830
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5196 |
|
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5197 def reject_manylinks(db, cl, nodeid, newvalues): |
|
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5198 content = newvalues['content'] |
|
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5199 if content.count('http://') > 2: |
|
5332
d0689aaa83db
Applied patch 0038 from issue2550960 to upgrade code examples in
John Rouillard <rouilj@ieee.org>
parents:
5268
diff
changeset
|
5200 raise Reject('not allowed') |
|
3830
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5201 |
|
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5202 def init(db): |
|
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5203 db.file.audit('create', reject_html) |
|
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5204 db.msg.audit('create', reject_manylinks) |
|
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5205 |
|
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5206 You may also wish to block image attachments if your tracker does not |
|
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5207 need that ability:: |
|
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5208 |
|
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5209 if newvalues['type'].startswith('image/'): |
|
5332
d0689aaa83db
Applied patch 0038 from issue2550960 to upgrade code examples in
John Rouillard <rouilj@ieee.org>
parents:
5268
diff
changeset
|
5210 raise Reject('not allowed') |
|
3830
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5211 |
|
a48c514c465f
Add simple anti-spam recipe to docs
Richard Jones <richard@users.sourceforge.net>
parents:
3818
diff
changeset
|
5212 |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5213 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
|
5214 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5215 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5216 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
|
5217 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
|
5218 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
|
5219 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5220 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
|
5221 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5222 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
|
5223 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
|
5224 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
|
5225 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
|
5226 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
|
5227 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
|
5228 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
|
5229 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5230 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
|
5231 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
|
5232 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5233 <tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5234 <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
|
5235 <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
|
5236 </tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5237 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5238 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
|
5239 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
|
5240 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5241 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
|
5242 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
|
5243 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
|
5244 # 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
|
5245 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
|
5246 try: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5247 # 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
|
5248 sendto = [] |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5249 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
|
5250 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
|
5251 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
|
5252 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
|
5253 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5254 # 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
|
5255 # 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
|
5256 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
|
5257 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5258 # 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
|
5259 # 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
|
5260 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
|
5261 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
|
5262 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
|
5263 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
|
5264 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5265 # 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
|
5266 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
|
5267 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
|
5268 # 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
|
5269 # 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
|
5270 # 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
|
5271 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
|
5272 continue |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5273 # make sure they haven't seen the message already |
|
5332
d0689aaa83db
Applied patch 0038 from issue2550960 to upgrade code examples in
John Rouillard <rouilj@ieee.org>
parents:
5268
diff
changeset
|
5274 if nosyid not in seen_message: |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5275 # 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
|
5276 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
|
5277 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
|
5278 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5279 # 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
|
5280 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
|
5281 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
|
5282 else: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5283 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
|
5284 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5285 # 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
|
5286 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
|
5287 # 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
|
5288 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
|
5289 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
|
5290 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5291 # 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
|
5292 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
|
5293 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5294 # 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
|
5295 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
|
5296 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5297 # 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
|
5298 cl.send_message(nodeid, msgid, note, sendto) |
|
5248
198b6e810c67
Use Python-3-compatible 'as' syntax for except statements
Eric S. Raymond <esr@thyrsus.com>
parents:
5239
diff
changeset
|
5299 except roundupdb.MessageSendError as message: |
|
198b6e810c67
Use Python-3-compatible 'as' syntax for except statements
Eric S. Raymond <esr@thyrsus.com>
parents:
5239
diff
changeset
|
5300 raise roundupdb.DetectorError(message) |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5301 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5302 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
|
5303 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
|
5304 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5305 # 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
|
5306 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
|
5307 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5308 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
|
5309 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5310 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
|
5311 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5312 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5313 Sometimes tracker admins want to control the states to which users may |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5314 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
|
5315 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5316 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
|
5317 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
|
5318 template:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5319 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5320 <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
|
5321 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5322 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
|
5323 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5324 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
|
5325 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5326 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
|
5327 ...) |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5328 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5329 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
|
5330 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5331 a. through the web using the class list -> status class editor, or |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5332 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
|
5333 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5334 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
|
5335 ``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
|
5336 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5337 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
|
5338 ''' 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
|
5339 property. |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5340 ''' |
|
5332
d0689aaa83db
Applied patch 0038 from issue2550960 to upgrade code examples in
John Rouillard <rouilj@ieee.org>
parents:
5268
diff
changeset
|
5341 if 'status' not in newvalues: |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5342 return |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5343 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
|
5344 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
|
5345 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
|
5346 return |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5347 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
|
5348 if new not in ok: |
|
5332
d0689aaa83db
Applied patch 0038 from issue2550960 to upgrade code examples in
John Rouillard <rouilj@ieee.org>
parents:
5268
diff
changeset
|
5349 raise ValueError('Status not allowed to move from "%s" to "%s"'%( |
|
d0689aaa83db
Applied patch 0038 from issue2550960 to upgrade code examples in
John Rouillard <rouilj@ieee.org>
parents:
5268
diff
changeset
|
5350 db.status.get(current, 'name'), db.status.get(new, 'name'))) |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5351 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5352 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
|
5353 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
|
5354 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5355 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
|
5356 from:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5357 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5358 <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
|
5359 <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
|
5360 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5361 to:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5362 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5363 <th>Status</th> |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5364 <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
|
5365 <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
|
5366 <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
|
5367 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
|
5368 <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
|
5369 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
|
5370 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
|
5371 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
|
5372 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
|
5373 </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
|
5374 </select> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5375 <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
|
5376 tal:replace="structure context/status/menu" /> |
|
1292
f7d9fefcae88
Fixes for SourceForge tracker bugs.
Richard Jones <richard@users.sourceforge.net>
parents:
1278
diff
changeset
|
5377 </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
|
5378 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5379 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
|
5380 |
| 1262 | 5381 |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5382 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
|
5383 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5384 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5385 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
|
5386 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
|
5387 resolved. To achieve this: |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
5388 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5389 1. Create a new property on the ``issue`` class: |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5390 ``blockers=Multilink("issue")``. To do this, edit the definition of |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5391 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
|
5392 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5393 issue = IssueClass(db, "issue", |
|
3904
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5394 assignedto=Link("user"), keyword=Multilink("keyword"), |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5395 priority=Link("priority"), status=Link("status")) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5396 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5397 to this, adding the blockers entry:: |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5398 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5399 issue = IssueClass(db, "issue", |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5400 blockers=Multilink("issue"), |
|
3904
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5401 assignedto=Link("user"), keyword=Multilink("keyword"), |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5402 priority=Link("priority"), status=Link("status")) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5403 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5404 2. Add the new ``blockers`` property to the ``issue.item.html`` edit |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5405 page, using something like:: |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5406 |
|
1825
fad32dafc174
Replaced all uses of the 'nowrap' attribute with its CSS equivalent:
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
1817
diff
changeset
|
5407 <th>Waiting On</th> |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5408 <td> |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5409 <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
|
5410 size=20)" /> |
|
3881
e7050411a774
fix documentation per [SF#731171] thanks to Forest Wilkinson
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3878
diff
changeset
|
5411 <span tal:replace="structure python:db.issue.classhelp('id,title', |
|
e7050411a774
fix documentation per [SF#731171] thanks to Forest Wilkinson
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3878
diff
changeset
|
5412 property='blockers')" /> |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
5413 <span tal:condition="context/blockers" |
|
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
5414 tal:repeat="blk context/blockers"> |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5415 <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
|
5416 tal:content="blk/id"></a> |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5417 </span> |
|
3881
e7050411a774
fix documentation per [SF#731171] thanks to Forest Wilkinson
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3878
diff
changeset
|
5418 </td> |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5419 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
5420 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
|
5421 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
|
5422 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
|
5423 the "superseders" field. |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5424 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5425 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
|
5426 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5427 - 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
|
5428 - 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
|
5429 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5430 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
|
5431 |
| 3258 | 5432 |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5433 def blockresolution(db, cl, nodeid, newvalues): |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5434 ''' 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
|
5435 ''' |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5436 if nodeid is None: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5437 blockers = [] |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5438 else: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5439 blockers = cl.get(nodeid, 'blockers') |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5440 blockers = newvalues.get('blockers', blockers) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5441 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
5442 # 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
|
5443 # changed |
|
5332
d0689aaa83db
Applied patch 0038 from issue2550960 to upgrade code examples in
John Rouillard <rouilj@ieee.org>
parents:
5268
diff
changeset
|
5444 if not blockers or 'status' not in newvalues: |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5445 return |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5446 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5447 # get the resolved state ID |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5448 resolved_id = db.status.lookup('resolved') |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5449 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5450 # format the info |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5451 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
|
5452 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
|
5453 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
|
5454 if len(blockers) == 1: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5455 s = 'issue %s is'%s |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5456 else: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5457 s = 'issues %s are'%s |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5458 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5459 # 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
|
5460 if newvalues['status'] == resolved_id: |
|
5332
d0689aaa83db
Applied patch 0038 from issue2550960 to upgrade code examples in
John Rouillard <rouilj@ieee.org>
parents:
5268
diff
changeset
|
5461 raise ValueError("This issue can't be resolved until %s resolved."%s) |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5462 |
| 3258 | 5463 |
| 5464 def resolveblockers(db, cl, nodeid, oldvalues): | |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5465 ''' 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
|
5466 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
|
5467 ''' |
| 3258 | 5468 newstatus = cl.get(nodeid,'status') |
| 5469 | |
| 5470 # no change? | |
| 5471 if oldvalues.get('status', None) == newstatus: | |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5472 return |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5473 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5474 resolved_id = db.status.lookup('resolved') |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5475 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5476 # interesting? |
| 3258 | 5477 if newstatus != resolved_id: |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5478 return |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5479 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
5480 # 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
|
5481 # their blockers list |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5482 issues = cl.find(blockers=nodeid) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5483 for issueid in issues: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5484 blockers = cl.get(issueid, 'blockers') |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5485 if nodeid in blockers: |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5486 blockers.remove(nodeid) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5487 cl.set(issueid, blockers=blockers) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5488 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5489 def init(db): |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5490 # 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
|
5491 db.issue.audit('create', blockresolution) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5492 db.issue.audit('set', blockresolution) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5493 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5494 # can only happen on a set |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5495 db.issue.react('set', resolveblockers) |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5496 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5497 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
|
5498 "detectors" directory. |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5499 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
5500 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
|
5501 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
|
5502 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
|
5503 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
|
5504 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
|
5505 |
|
3796
aef19fff38dd
If-Modified-Since handling was broken
Richard Jones <richard@users.sourceforge.net>
parents:
3772
diff
changeset
|
5506 <a href="#" |
|
aef19fff38dd
If-Modified-Since handling was broken
Richard Jones <richard@users.sourceforge.net>
parents:
3772
diff
changeset
|
5507 tal:attributes="href python:request.indexargs_url('issue', { |
|
aef19fff38dd
If-Modified-Since handling was broken
Richard Jones <richard@users.sourceforge.net>
parents:
3772
diff
changeset
|
5508 '@sort': '-activity', |
|
aef19fff38dd
If-Modified-Since handling was broken
Richard Jones <richard@users.sourceforge.net>
parents:
3772
diff
changeset
|
5509 '@group': 'priority', |
|
aef19fff38dd
If-Modified-Since handling was broken
Richard Jones <richard@users.sourceforge.net>
parents:
3772
diff
changeset
|
5510 '@filter': 'status', |
|
aef19fff38dd
If-Modified-Since handling was broken
Richard Jones <richard@users.sourceforge.net>
parents:
3772
diff
changeset
|
5511 '@columns': columns_showall, |
|
aef19fff38dd
If-Modified-Since handling was broken
Richard Jones <richard@users.sourceforge.net>
parents:
3772
diff
changeset
|
5512 '@search_text': '', |
|
aef19fff38dd
If-Modified-Since handling was broken
Richard Jones <richard@users.sourceforge.net>
parents:
3772
diff
changeset
|
5513 'status': status_notresolved, |
|
aef19fff38dd
If-Modified-Since handling was broken
Richard Jones <richard@users.sourceforge.net>
parents:
3772
diff
changeset
|
5514 '@dispname': i18n.gettext('Show All'), |
|
aef19fff38dd
If-Modified-Since handling was broken
Richard Jones <richard@users.sourceforge.net>
parents:
3772
diff
changeset
|
5515 })" |
|
aef19fff38dd
If-Modified-Since handling was broken
Richard Jones <richard@users.sourceforge.net>
parents:
3772
diff
changeset
|
5516 i18n:translate="">Show All</a><br> |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5517 |
|
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5518 modify it to add the "blockers" info to the URL (note, both the |
| 3590 | 5519 "@filter" *and* "blockers" values must be specified):: |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5520 |
|
3796
aef19fff38dd
If-Modified-Since handling was broken
Richard Jones <richard@users.sourceforge.net>
parents:
3772
diff
changeset
|
5521 <a href="#" |
|
aef19fff38dd
If-Modified-Since handling was broken
Richard Jones <richard@users.sourceforge.net>
parents:
3772
diff
changeset
|
5522 tal:attributes="href python:request.indexargs_url('issue', { |
|
aef19fff38dd
If-Modified-Since handling was broken
Richard Jones <richard@users.sourceforge.net>
parents:
3772
diff
changeset
|
5523 '@sort': '-activity', |
|
aef19fff38dd
If-Modified-Since handling was broken
Richard Jones <richard@users.sourceforge.net>
parents:
3772
diff
changeset
|
5524 '@group': 'priority', |
|
aef19fff38dd
If-Modified-Since handling was broken
Richard Jones <richard@users.sourceforge.net>
parents:
3772
diff
changeset
|
5525 '@filter': 'status,blockers', |
|
aef19fff38dd
If-Modified-Since handling was broken
Richard Jones <richard@users.sourceforge.net>
parents:
3772
diff
changeset
|
5526 '@columns': columns_showall, |
|
aef19fff38dd
If-Modified-Since handling was broken
Richard Jones <richard@users.sourceforge.net>
parents:
3772
diff
changeset
|
5527 '@search_text': '', |
|
aef19fff38dd
If-Modified-Since handling was broken
Richard Jones <richard@users.sourceforge.net>
parents:
3772
diff
changeset
|
5528 'status': status_notresolved, |
|
aef19fff38dd
If-Modified-Since handling was broken
Richard Jones <richard@users.sourceforge.net>
parents:
3772
diff
changeset
|
5529 'blockers': '-1', |
|
aef19fff38dd
If-Modified-Since handling was broken
Richard Jones <richard@users.sourceforge.net>
parents:
3772
diff
changeset
|
5530 '@dispname': i18n.gettext('Show All'), |
|
aef19fff38dd
If-Modified-Since handling was broken
Richard Jones <richard@users.sourceforge.net>
parents:
3772
diff
changeset
|
5531 })" |
|
aef19fff38dd
If-Modified-Since handling was broken
Richard Jones <richard@users.sourceforge.net>
parents:
3772
diff
changeset
|
5532 i18n:translate="">Show All</a><br> |
| 2409 | 5533 |
| 3052 | 5534 The above examples are line-wrapped on the trailing & and should |
| 5535 be unwrapped. | |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5536 |
|
1674
0807e3676133
Reflowed to 72 columns, some tidying, updating & rephrasing ..
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1671
diff
changeset
|
5537 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
|
5538 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
|
5539 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
|
5540 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
|
5541 another issue's "blockers" property. |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5542 |
|
3904
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5543 Add users to the nosy list based on the keyword |
|
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5544 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5545 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5546 Let's say we need the ability to automatically add users to the nosy |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5547 list based |
|
3904
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5548 on the occurance of a keyword. Every user should be allowed to edit their |
|
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5549 own list of keywords for which they want to be added to the nosy list. |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5550 |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5551 Below, we'll show that this change can be done with minimal |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5552 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
|
5553 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5554 This requires three changes to the tracker: a change in the database to |
|
3904
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5555 allow per-user recording of the lists of keywords for which he wants to |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5556 be put on the nosy list, a change in the user view allowing them to edit |
|
3904
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5557 this list of keywords, and addition of an auditor which updates the nosy |
|
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5558 list when a keyword is set. |
|
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5559 |
|
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5560 Adding the nosy keyword list |
|
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5561 :::::::::::::::::::::::::::: |
|
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5562 |
|
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5563 The change to make in the database, is that for any user there should be a list |
|
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5564 of keywords for which he wants to be put on the nosy list. Adding a |
|
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5565 ``Multilink`` of ``keyword`` seems to fullfill this. As such, all that has to |
|
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5566 be done is to add a new field to the definition of ``user`` within the file |
|
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5567 ``schema.py``. We will call this new field ``nosy_keywords``, and the updated |
|
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5568 definition of user will be:: |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5569 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5570 user = Class(db, "user", |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5571 username=String(), password=Password(), |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5572 address=String(), realname=String(), |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5573 phone=String(), organisation=String(), |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5574 alternate_addresses=String(), |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5575 queries=Multilink('query'), roles=String(), |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5576 timezone=String(), |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5577 nosy_keywords=Multilink('keyword')) |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5578 |
|
3904
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5579 Changing the user view to allow changing the nosy keyword list |
|
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5580 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5581 |
|
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5582 We want any user to be able to change the list of keywords for which |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5583 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
|
5584 to the user view, as is generated by the file ``html/user.item.html``. |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5585 We can easily |
|
3904
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5586 see that the keyword field in the issue view has very similar editing |
|
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5587 requirements as our nosy keywords, both being lists of keywords. As |
|
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5588 such, we look for Keywords 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
|
5589 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
|
5590 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
|
5591 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
|
5592 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5593 <tr> |
|
3904
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5594 <th>Nosy Keywords</th> |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5595 <td> |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5596 <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
|
5597 <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
|
5598 </td> |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5599 </tr> |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5600 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5601 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5602 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
|
5603 :::::::::::::::::::::::::::::::::::::::::::::: |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5604 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5605 The more difficult part is the logic to add |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5606 the users to the nosy list when required. |
|
3904
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5607 We choose to perform this action whenever the keywords on an |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5608 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
|
5609 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
|
5610 ``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
|
5611 ``detectors/nosy_keyword_reaction.py``. |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5612 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
|
5613 to the nosy list. A look through the code reveals that the |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5614 ``nosyreaction`` function actually sends the e-mail. |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5615 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
|
5616 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5617 def init(db): |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5618 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
|
5619 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
|
5620 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5621 After that, we rename the ``updatenosy`` function to ``update_kw_nosy``. |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5622 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
|
5623 ``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
|
5624 functionality is left in the new auditor. The following block of |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5625 code, which handled adding the assignedto user(s) to the nosy list in |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5626 ``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
|
5627 interested users to the nosy list. We choose here to loop over all |
|
3904
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5628 new keywords, than looping over all users, |
|
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5629 and assign the user to the nosy list when the keyword occurs in the user's |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5630 ``nosy_keywords``. The next part in ``updatenosy`` -- adding the author |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5631 and/or recipients of a message to the nosy list -- is obviously not |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5632 relevant here and is thus deleted from the new auditor. The last |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5633 part, copying the new nosy list to ``newvalues``, can stay as is. |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5634 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
|
5635 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5636 def update_kw_nosy(db, cl, nodeid, newvalues): |
|
3904
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5637 '''Update the nosy list for changes to the keywords |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5638 ''' |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5639 # 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
|
5640 current = {} |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5641 if nodeid is None: |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5642 ok = ('new', 'yes') |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5643 else: |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5644 ok = ('yes',) |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5645 # 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
|
5646 # changed |
|
5332
d0689aaa83db
Applied patch 0038 from issue2550960 to upgrade code examples in
John Rouillard <rouilj@ieee.org>
parents:
5268
diff
changeset
|
5647 if 'nosy' not in newvalues: |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5648 nosy = cl.get(nodeid, 'nosy') |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5649 for value in nosy: |
|
5332
d0689aaa83db
Applied patch 0038 from issue2550960 to upgrade code examples in
John Rouillard <rouilj@ieee.org>
parents:
5268
diff
changeset
|
5650 if value not in current: |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5651 current[value] = 1 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5652 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5653 # if the nosy list changed in this transaction, init from the new value |
|
5332
d0689aaa83db
Applied patch 0038 from issue2550960 to upgrade code examples in
John Rouillard <rouilj@ieee.org>
parents:
5268
diff
changeset
|
5654 if 'nosy' in newvalues: |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5655 nosy = newvalues.get('nosy', []) |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5656 for value in nosy: |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5657 if not db.hasnode('user', value): |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5658 continue |
|
5332
d0689aaa83db
Applied patch 0038 from issue2550960 to upgrade code examples in
John Rouillard <rouilj@ieee.org>
parents:
5268
diff
changeset
|
5659 if value not in current: |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5660 current[value] = 1 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5661 |
|
3904
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5662 # add users with keyword in nosy_keywords to the nosy list |
|
5332
d0689aaa83db
Applied patch 0038 from issue2550960 to upgrade code examples in
John Rouillard <rouilj@ieee.org>
parents:
5268
diff
changeset
|
5663 if 'keyword' in newvalues and newvalues['keyword'] is not None: |
|
3904
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5664 keyword_ids = newvalues['keyword'] |
|
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5665 for keyword in keyword_ids: |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5666 # loop over all users, |
|
3904
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5667 # and assign user to nosy when keyword in nosy_keywords |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5668 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
|
5669 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
|
5670 found = 0 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5671 for kw in nosy_kw: |
|
3904
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5672 if kw == keyword: |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5673 found = 1 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5674 if found: |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5675 current[user_id] = 1 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5676 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5677 # that's it, save off the new nosy list |
|
5332
d0689aaa83db
Applied patch 0038 from issue2550960 to upgrade code examples in
John Rouillard <rouilj@ieee.org>
parents:
5268
diff
changeset
|
5678 newvalues['nosy'] = list(current.keys()) |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5679 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5680 These two function are the only ones needed in the file. |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5681 |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5682 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
|
5683 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5684 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
|
5685 ::::::: |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5686 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5687 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
|
5688 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5689 Multiple additions |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5690 When a user, after automatic selection, is manually removed |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5691 from the nosy list, he is added to the nosy list again when the |
|
3904
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5692 keyword list of the issue is updated. A better design might be |
|
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5693 to only check which keywords are new compared to the old list |
|
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5694 of keywords, and only add users when they have indicated |
|
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5695 interest on a new keyword. |
|
1808
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5696 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5697 The code could also be changed to only trigger on the ``create()`` |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5698 event, rather than also on the ``set()`` event, thus only setting |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5699 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
|
5700 |
|
3ac35c8e1782
new example and some more installation docs
Richard Jones <richard@users.sourceforge.net>
parents:
1800
diff
changeset
|
5701 Scalability |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5702 In the auditor, there is a loop over all users. For a site with |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5703 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
|
5704 many users this will be a serious performance bottleneck. |
|
3904
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5705 A way out would be to link from the keywords to the users who |
|
91008ec8f9a0
retire "topic" usage
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3881
diff
changeset
|
5706 selected these keywords as nosy keywords. This will eliminate the |
|
6168
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
5707 loop over all users. See the ``rev_multilink`` attribute to make |
|
de9d602c8ce6
more index entries and CHANGES.txt update for them.
John Rouillard <rouilj@ieee.org>
parents:
6163
diff
changeset
|
5708 this easier. |
|
1559
6bfb9c9de03c
added blockers customisation example to doc
Richard Jones <richard@users.sourceforge.net>
parents:
1522
diff
changeset
|
5709 |
| 4781 | 5710 Restricting updates that arrive by email |
| 5711 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 5712 | |
| 5713 Roundup supports multiple update methods: | |
| 5714 | |
| 5715 1. command line | |
| 5716 2. plain email | |
| 5717 3. pgp signed email | |
| 5718 4. web access | |
| 5719 | |
| 5720 in some cases you may need to prevent changes to properties by some of | |
| 5721 these methods. For example you can set up issues that are viewable | |
| 5722 only by people on the nosy list. So you must prevent unauthenticated | |
| 5723 changes to the nosy list. | |
| 5724 | |
| 5725 Since plain email can be easily forged, it does not provide sufficient | |
| 5726 authentication in this senario. | |
| 5727 | |
| 5728 To prevent this we can add a detector that audits the source of the | |
| 5729 transaction and rejects the update if it changes the nosy list. | |
| 5730 | |
| 5731 Create the detector (auditor) module and add it to the detectors | |
| 5732 directory of your tracker:: | |
| 5733 | |
| 5734 from roundup import roundupdb, hyperdb | |
| 5735 | |
| 5736 from roundup.mailgw import Unauthorized | |
| 5737 | |
| 5738 def restrict_nosy_changes(db, cl, nodeid, newvalues): | |
| 5739 '''Do not permit changes to nosy via email.''' | |
| 5740 | |
|
5332
d0689aaa83db
Applied patch 0038 from issue2550960 to upgrade code examples in
John Rouillard <rouilj@ieee.org>
parents:
5268
diff
changeset
|
5741 if 'nosy' not in newvalues: |
| 4781 | 5742 # the nosy field has not changed so no need to check. |
| 5743 return | |
| 5744 | |
|
5881
9938c40e03bc
Add "rest" and "xmlrpc" values for database tx_Source property
John Rouillard <rouilj@ieee.org>
parents:
5759
diff
changeset
|
5745 if db.tx_Source in ['web', 'rest', 'xmlrpc', 'email-sig-openpgp', 'cli' ]: |
| 4781 | 5746 # if the source of the transaction is from an authenticated |
| 5747 # source or a privileged process allow the transaction. | |
| 5748 # Other possible sources: 'email' | |
| 5749 return | |
| 5750 | |
| 5751 # otherwise raise an error | |
|
5248
198b6e810c67
Use Python-3-compatible 'as' syntax for except statements
Eric S. Raymond <esr@thyrsus.com>
parents:
5239
diff
changeset
|
5752 raise Unauthorized( \ |
| 4781 | 5753 'Changes to nosy property not allowed via %s for this issue.'%\ |
|
5248
198b6e810c67
Use Python-3-compatible 'as' syntax for except statements
Eric S. Raymond <esr@thyrsus.com>
parents:
5239
diff
changeset
|
5754 tx_Source) |
| 4781 | 5755 |
| 5756 def init(db): | |
| 5757 ''' Install restrict_nosy_changes to run after other auditors. | |
| 5758 | |
| 5759 Allow initial creation email to set nosy. | |
| 5760 So don't execute: db.issue.audit('create', requestedbyauditor) | |
| 5761 | |
| 5762 Set priority to 110 to run this auditor after other auditors | |
| 5763 that can cause nosy to change. | |
| 5764 ''' | |
| 5765 db.issue.audit('set', restrict_nosy_changes, 110) | |
| 5766 | |
| 5767 This detector (auditor) will prevent updates to the nosy field if it | |
| 5768 arrives by email. Since it runs after other auditors (due to the | |
| 5769 priority of 110), it will also prevent changes to the nosy field that | |
| 5770 are done by other auditors if triggered by an email. | |
| 5771 | |
| 5772 Note that db.tx_Source was not present in roundup versions before | |
|
4790
07014a4b8a49
tx_Source property: doc fix.
Bernhard Reiter <bernhard@intevation.de>
parents:
4781
diff
changeset
|
5773 1.4.22, so you must be running a newer version to use this detector. |
| 4781 | 5774 Read the CHANGES.txt document in the roundup source code for further |
| 5775 details on tx_Source. | |
| 5776 | |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5777 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
|
5778 ----------------------------------- |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5779 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5780 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
|
5781 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5782 |
|
2983
9614a101b68f
Stuff from the train ride this morning:
Richard Jones <richard@users.sourceforge.net>
parents:
2958
diff
changeset
|
5783 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
|
5784 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5785 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
|
5786 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5787 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
|
5788 "issue":: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5789 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5790 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
|
5791 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
|
5792 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5793 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
|
5794 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5795 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
|
5796 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5797 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
|
5798 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
|
5799 list:: |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5800 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5801 <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
|
5802 <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
|
5803 <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
|
5804 <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
|
5805 '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
|
5806 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
|
5807 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
|
5808 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
|
5809 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
|
5810 </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
|
5811 </select> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5812 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5813 For extra security, you may wish to setup an auditor to enforce the |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5814 Permission requirement (install this as ``assignedtoFixer.py`` in your |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5815 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
|
5816 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5817 def assignedtoMustBeFixer(db, cl, nodeid, newvalues): |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5818 ''' 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
|
5819 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
|
5820 ''' |
|
5332
d0689aaa83db
Applied patch 0038 from issue2550960 to upgrade code examples in
John Rouillard <rouilj@ieee.org>
parents:
5268
diff
changeset
|
5821 if 'assignedto' not in newvalues: |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5822 # 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
|
5823 return |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5824 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5825 # 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
|
5826 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
|
5827 if not db.security.hasPermission('Fixer', userid, cl.classname): |
|
5332
d0689aaa83db
Applied patch 0038 from issue2550960 to upgrade code examples in
John Rouillard <rouilj@ieee.org>
parents:
5268
diff
changeset
|
5828 raise ValueError('You do not have permission to edit %s'%cl.classname) |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5829 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5830 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
|
5831 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
|
5832 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
|
5833 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5834 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
|
5835 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
|
5836 |
| 3121 | 5837 |
|
1954
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
5838 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
|
5839 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
1954
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
5840 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5841 In this case, users registering themselves are granted Provisional |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5842 access, meaning they |
|
1954
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
5843 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
|
5844 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
|
5845 and has limited access. One of the Permissions they have is the new "Edit |
| 3121 | 5846 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
|
5847 |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
5848 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
|
5849 ``schema.py``:: |
|
1954
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
5850 |
| 3121 | 5851 # |
|
1954
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
5852 # New users not approved by the admin |
| 3121 | 5853 # |
|
1954
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
5854 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
|
5855 description='New user registered via web or email') |
|
2991
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
5856 |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
5857 # 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
|
5858 # and view their own |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
5859 db.security.addPermissionToRole('Provisional User', 'Create', 'issue') |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
5860 def own_issue(db, userid, itemid): |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
5861 '''Determine whether the userid matches the creator of the issue.''' |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
5862 return userid == db.issue.get(itemid, 'creator') |
|
3079
64df8d65cc54
fix "Users may only edit their issues"
Richard Jones <richard@users.sourceforge.net>
parents:
3052
diff
changeset
|
5863 p = db.security.addPermission(name='Edit', klass='issue', |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5864 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
|
5865 db.security.addPermissionToRole('Provisional User', p) |
|
3079
64df8d65cc54
fix "Users may only edit their issues"
Richard Jones <richard@users.sourceforge.net>
parents:
3052
diff
changeset
|
5866 p = db.security.addPermission(name='View', klass='issue', |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5867 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
|
5868 db.security.addPermissionToRole('Provisional User', p) |
|
5537
d698d3d843a9
'Provisional User' example needed to have search permissions added
John Rouillard <rouilj@ieee.org>
parents:
5367
diff
changeset
|
5869 # This allows the interface to get the names of the properties |
|
d698d3d843a9
'Provisional User' example needed to have search permissions added
John Rouillard <rouilj@ieee.org>
parents:
5367
diff
changeset
|
5870 # in the issue. Used for selecting sorting and grouping |
|
d698d3d843a9
'Provisional User' example needed to have search permissions added
John Rouillard <rouilj@ieee.org>
parents:
5367
diff
changeset
|
5871 # on the index page. |
|
d698d3d843a9
'Provisional User' example needed to have search permissions added
John Rouillard <rouilj@ieee.org>
parents:
5367
diff
changeset
|
5872 p = db.security.addPermission(name='Search', klass='issue') |
|
d698d3d843a9
'Provisional User' example needed to have search permissions added
John Rouillard <rouilj@ieee.org>
parents:
5367
diff
changeset
|
5873 db.security.addPermissionToRole ('Provisional User', p) |
|
d698d3d843a9
'Provisional User' example needed to have search permissions added
John Rouillard <rouilj@ieee.org>
parents:
5367
diff
changeset
|
5874 |
|
2991
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
5875 |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
5876 # Assign the Permissions for issue-related classes |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
5877 for cl in 'file', 'msg', 'query', 'keyword': |
| 3121 | 5878 db.security.addPermissionToRole('Provisional User', 'View', cl) |
| 5879 db.security.addPermissionToRole('Provisional User', 'Edit', cl) | |
| 5880 db.security.addPermissionToRole('Provisional User', 'Create', cl) | |
|
2991
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
5881 for cl in 'priority', 'status': |
| 3121 | 5882 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
|
5883 |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
5884 # 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
|
5885 db.security.addPermissionToRole('Provisional User', 'Web Access') |
|
b9a55628a78d
more doc fixes
Richard Jones <richard@users.sourceforge.net>
parents:
2983
diff
changeset
|
5886 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
|
5887 |
|
3260
e41e1540a287
fix provisional user so they can view their own record
Richard Jones <richard@users.sourceforge.net>
parents:
3258
diff
changeset
|
5888 # make sure they can view & edit their own user record |
|
e41e1540a287
fix provisional user so they can view their own record
Richard Jones <richard@users.sourceforge.net>
parents:
3258
diff
changeset
|
5889 def own_record(db, userid, itemid): |
|
e41e1540a287
fix provisional user so they can view their own record
Richard Jones <richard@users.sourceforge.net>
parents:
3258
diff
changeset
|
5890 '''Determine whether the userid matches the item being accessed.''' |
|
e41e1540a287
fix provisional user so they can view their own record
Richard Jones <richard@users.sourceforge.net>
parents:
3258
diff
changeset
|
5891 return userid == itemid |
|
e41e1540a287
fix provisional user so they can view their own record
Richard Jones <richard@users.sourceforge.net>
parents:
3258
diff
changeset
|
5892 p = db.security.addPermission(name='View', klass='user', check=own_record, |
|
e41e1540a287
fix provisional user so they can view their own record
Richard Jones <richard@users.sourceforge.net>
parents:
3258
diff
changeset
|
5893 description="User is allowed to view their own user details") |
|
e41e1540a287
fix provisional user so they can view their own record
Richard Jones <richard@users.sourceforge.net>
parents:
3258
diff
changeset
|
5894 db.security.addPermissionToRole('Provisional User', p) |
|
e41e1540a287
fix provisional user so they can view their own record
Richard Jones <richard@users.sourceforge.net>
parents:
3258
diff
changeset
|
5895 p = db.security.addPermission(name='Edit', klass='user', check=own_record, |
|
e41e1540a287
fix provisional user so they can view their own record
Richard Jones <richard@users.sourceforge.net>
parents:
3258
diff
changeset
|
5896 description="User is allowed to edit their own user details") |
|
e41e1540a287
fix provisional user so they can view their own record
Richard Jones <richard@users.sourceforge.net>
parents:
3258
diff
changeset
|
5897 db.security.addPermissionToRole('Provisional User', p) |
|
1954
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
5898 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5899 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
|
5900 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
|
5901 |
|
2921
ad4fb8a14a97
more doc updates, not so many TODOs any more
Richard Jones <richard@users.sourceforge.net>
parents:
2915
diff
changeset
|
5902 [main] |
|
ad4fb8a14a97
more doc updates, not so many TODOs any more
Richard Jones <richard@users.sourceforge.net>
parents:
2915
diff
changeset
|
5903 ... |
|
4941
b76710818d31
Roundup Tracker isssue #: 2550857
John Rouillard <rouilj@ieee.org>
parents:
4921
diff
changeset
|
5904 new_web_user_roles = Provisional User |
|
b76710818d31
Roundup Tracker isssue #: 2550857
John Rouillard <rouilj@ieee.org>
parents:
4921
diff
changeset
|
5905 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
|
5906 |
|
a71bc3a6f433
Added 'Users may only edit their issues' customisation example.
Richard Jones <richard@users.sourceforge.net>
parents:
1952
diff
changeset
|
5907 |
|
3126
a2889d22db4a
the cgi templating code now checks item-level
Richard Jones <richard@users.sourceforge.net>
parents:
3123
diff
changeset
|
5908 All users may only view and edit issues, files and messages they create |
|
a2889d22db4a
the cgi templating code now checks item-level
Richard Jones <richard@users.sourceforge.net>
parents:
3123
diff
changeset
|
5909 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
a2889d22db4a
the cgi templating code now checks item-level
Richard Jones <richard@users.sourceforge.net>
parents:
3123
diff
changeset
|
5910 |
|
a2889d22db4a
the cgi templating code now checks item-level
Richard Jones <richard@users.sourceforge.net>
parents:
3123
diff
changeset
|
5911 Replace the standard "classic" tracker View and Edit Permission assignments |
|
a2889d22db4a
the cgi templating code now checks item-level
Richard Jones <richard@users.sourceforge.net>
parents:
3123
diff
changeset
|
5912 for the "issue", "file" and "msg" classes with the following:: |
|
a2889d22db4a
the cgi templating code now checks item-level
Richard Jones <richard@users.sourceforge.net>
parents:
3123
diff
changeset
|
5913 |
|
a2889d22db4a
the cgi templating code now checks item-level
Richard Jones <richard@users.sourceforge.net>
parents:
3123
diff
changeset
|
5914 def checker(klass): |
|
a2889d22db4a
the cgi templating code now checks item-level
Richard Jones <richard@users.sourceforge.net>
parents:
3123
diff
changeset
|
5915 def check(db, userid, itemid, klass=klass): |
|
a2889d22db4a
the cgi templating code now checks item-level
Richard Jones <richard@users.sourceforge.net>
parents:
3123
diff
changeset
|
5916 return db.getclass(klass).get(itemid, 'creator') == userid |
|
3580
5c26b9bbd31a
fix "All users may only view and edit issues, files and messages they...
Richard Jones <richard@users.sourceforge.net>
parents:
3548
diff
changeset
|
5917 return check |
|
3126
a2889d22db4a
the cgi templating code now checks item-level
Richard Jones <richard@users.sourceforge.net>
parents:
3123
diff
changeset
|
5918 for cl in 'issue', 'file', 'msg': |
|
a2889d22db4a
the cgi templating code now checks item-level
Richard Jones <richard@users.sourceforge.net>
parents:
3123
diff
changeset
|
5919 p = db.security.addPermission(name='View', klass=cl, |
|
6534
7cfb7d4fce60
Fix docs mising Search permission for example.
John Rouillard <rouilj@ieee.org>
parents:
6470
diff
changeset
|
5920 check=checker(cl), |
|
7cfb7d4fce60
Fix docs mising Search permission for example.
John Rouillard <rouilj@ieee.org>
parents:
6470
diff
changeset
|
5921 description='User can view only if creator.') |
|
3126
a2889d22db4a
the cgi templating code now checks item-level
Richard Jones <richard@users.sourceforge.net>
parents:
3123
diff
changeset
|
5922 db.security.addPermissionToRole('User', p) |
|
a2889d22db4a
the cgi templating code now checks item-level
Richard Jones <richard@users.sourceforge.net>
parents:
3123
diff
changeset
|
5923 p = db.security.addPermission(name='Edit', klass=cl, |
|
6534
7cfb7d4fce60
Fix docs mising Search permission for example.
John Rouillard <rouilj@ieee.org>
parents:
6470
diff
changeset
|
5924 check=checker(cl), |
|
7cfb7d4fce60
Fix docs mising Search permission for example.
John Rouillard <rouilj@ieee.org>
parents:
6470
diff
changeset
|
5925 description='User can edit only if creator.') |
|
3126
a2889d22db4a
the cgi templating code now checks item-level
Richard Jones <richard@users.sourceforge.net>
parents:
3123
diff
changeset
|
5926 db.security.addPermissionToRole('User', p) |
|
a2889d22db4a
the cgi templating code now checks item-level
Richard Jones <richard@users.sourceforge.net>
parents:
3123
diff
changeset
|
5927 db.security.addPermissionToRole('User', 'Create', cl) |
|
6534
7cfb7d4fce60
Fix docs mising Search permission for example.
John Rouillard <rouilj@ieee.org>
parents:
6470
diff
changeset
|
5928 # This allows the interface to get the names of the properties |
|
7cfb7d4fce60
Fix docs mising Search permission for example.
John Rouillard <rouilj@ieee.org>
parents:
6470
diff
changeset
|
5929 # in the issue. Used for selecting sorting and grouping |
|
7cfb7d4fce60
Fix docs mising Search permission for example.
John Rouillard <rouilj@ieee.org>
parents:
6470
diff
changeset
|
5930 # on the index page. |
|
7cfb7d4fce60
Fix docs mising Search permission for example.
John Rouillard <rouilj@ieee.org>
parents:
6470
diff
changeset
|
5931 p = db.security.addPermission(name='Search', klass='issue') |
|
7cfb7d4fce60
Fix docs mising Search permission for example.
John Rouillard <rouilj@ieee.org>
parents:
6470
diff
changeset
|
5932 db.security.addPermissionToRole ('User', p) |
|
3126
a2889d22db4a
the cgi templating code now checks item-level
Richard Jones <richard@users.sourceforge.net>
parents:
3123
diff
changeset
|
5933 |
|
a2889d22db4a
the cgi templating code now checks item-level
Richard Jones <richard@users.sourceforge.net>
parents:
3123
diff
changeset
|
5934 |
|
4300
608919e3bbbf
add another simple recipe
Richard Jones <richard@users.sourceforge.net>
parents:
4296
diff
changeset
|
5935 Moderating user registration |
|
608919e3bbbf
add another simple recipe
Richard Jones <richard@users.sourceforge.net>
parents:
4296
diff
changeset
|
5936 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
608919e3bbbf
add another simple recipe
Richard Jones <richard@users.sourceforge.net>
parents:
4296
diff
changeset
|
5937 |
|
608919e3bbbf
add another simple recipe
Richard Jones <richard@users.sourceforge.net>
parents:
4296
diff
changeset
|
5938 You could set up new-user moderation in a public tracker by: |
|
608919e3bbbf
add another simple recipe
Richard Jones <richard@users.sourceforge.net>
parents:
4296
diff
changeset
|
5939 |
|
608919e3bbbf
add another simple recipe
Richard Jones <richard@users.sourceforge.net>
parents:
4296
diff
changeset
|
5940 1. creating a new highly-restricted user role "Pending", |
|
608919e3bbbf
add another simple recipe
Richard Jones <richard@users.sourceforge.net>
parents:
4296
diff
changeset
|
5941 2. set the config new_web_user_roles and/or new_email_user_roles to that |
|
608919e3bbbf
add another simple recipe
Richard Jones <richard@users.sourceforge.net>
parents:
4296
diff
changeset
|
5942 role, |
|
608919e3bbbf
add another simple recipe
Richard Jones <richard@users.sourceforge.net>
parents:
4296
diff
changeset
|
5943 3. have an auditor that emails you when new users are created with that |
|
608919e3bbbf
add another simple recipe
Richard Jones <richard@users.sourceforge.net>
parents:
4296
diff
changeset
|
5944 role using roundup.mailer |
|
608919e3bbbf
add another simple recipe
Richard Jones <richard@users.sourceforge.net>
parents:
4296
diff
changeset
|
5945 4. edit the role to "User" for valid users. |
|
608919e3bbbf
add another simple recipe
Richard Jones <richard@users.sourceforge.net>
parents:
4296
diff
changeset
|
5946 |
|
608919e3bbbf
add another simple recipe
Richard Jones <richard@users.sourceforge.net>
parents:
4296
diff
changeset
|
5947 Some simple javascript might help in the last step. If you have high volume |
|
608919e3bbbf
add another simple recipe
Richard Jones <richard@users.sourceforge.net>
parents:
4296
diff
changeset
|
5948 you could search for all currently-Pending users and do a bulk edit of all |
|
608919e3bbbf
add another simple recipe
Richard Jones <richard@users.sourceforge.net>
parents:
4296
diff
changeset
|
5949 their roles at once (again probably with some simple javascript help). |
|
608919e3bbbf
add another simple recipe
Richard Jones <richard@users.sourceforge.net>
parents:
4296
diff
changeset
|
5950 |
|
3126
a2889d22db4a
the cgi templating code now checks item-level
Richard Jones <richard@users.sourceforge.net>
parents:
3123
diff
changeset
|
5951 |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5952 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
|
5953 --------------------------------- |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5954 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5955 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
|
5956 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5957 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5958 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
|
5959 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5960 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
|
5961 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5962 <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
|
5963 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
|
5964 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5965 "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
|
5966 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
5967 <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
|
5968 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
|
5969 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5970 ... 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
|
5971 |
|
1966
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
5972 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
|
5973 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
1966
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
5974 |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
5975 A simple ``tal:attributes`` statement will do the bulk of the work here. In |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5976 the ``issue.index.html`` template, add this to the ``<tr>`` that |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5977 displays the rows of data:: |
|
1966
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
5978 |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
5979 <tr tal:attributes="class string:priority-${i/priority/plain}"> |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
5980 |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
5981 and then in your stylesheet (``style.css``) specify the colouring for the |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
5982 different priorities, as follows:: |
|
1966
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
5983 |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
5984 tr.priority-critical td { |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
5985 background-color: red; |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
5986 } |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
5987 |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
5988 tr.priority-urgent td { |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
5989 background-color: orange; |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
5990 } |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
5991 |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
5992 and so on, with far less offensive colours :) |
|
c8d8d03b6d94
another example
Richard Jones <richard@users.sourceforge.net>
parents:
1954
diff
changeset
|
5993 |
|
2009
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
5994 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
|
5995 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
2009
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
5996 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
5997 To edit the status of all items in the item index view, edit the |
|
6329
207b0fc82fc1
Fix incorrect template (Nagy Gabor); spelling fix
John Rouillard <rouilj@ieee.org>
parents:
6293
diff
changeset
|
5998 ``issue.index.html``: |
|
2009
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
5999 |
|
2726
aa95c79cff8b
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2589
diff
changeset
|
6000 1. add a form around the listing table (separate from the existing |
|
aa95c79cff8b
clarification
Richard Jones <richard@users.sourceforge.net>
parents:
2589
diff
changeset
|
6001 index-page form), so at the top it reads:: |
|
2009
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6002 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6003 <form method="POST" tal:attributes="action request/classname"> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6004 <table class="list"> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6005 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6006 and at the bottom of that table:: |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6007 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6008 </table> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6009 </form |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6010 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6011 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
|
6012 navigation table or the subsequent form table. |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6013 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6014 2. in the display for the issue property, change:: |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6015 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6016 <td tal:condition="request/show/status" |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6017 tal:content="python:i.status.plain() or default"> </td> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6018 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6019 to:: |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6020 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6021 <td tal:condition="request/show/status" |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6022 tal:content="structure i/status/field"> </td> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6023 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6024 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
|
6025 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
6026 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
|
6027 ``tal:repeat="i batch"``) add a new table row:: |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6028 |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6029 <tr> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6030 <td tal:attributes="colspan python:len(request.columns)"> |
|
5201
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
6031 <input name="@csrf" type="hidden" |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
6032 tal:attributes="value python:utils.anti_csrf_nonce()"> |
|
2009
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6033 <input type="submit" value=" Save Changes "> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6034 <input type="hidden" name="@action" value="edit"> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6035 <tal:block replace="structure request/indexargs_form" /> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6036 </td> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6037 </tr> |
|
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6038 |
|
5201
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
6039 which gives us a submit button, indicates that we are performing an |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
6040 edit on any changed statuses, and provides a defense against cross |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
6041 site request forgery attacks. |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
6042 |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
6043 The final ``tal:block`` will make sure that the current index view |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
6044 parameters (filtering, columns, etc) will be used in rendering the |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
6045 next page (the results of the editing). |
|
2009
3594e5d2b411
added new example
Richard Jones <richard@users.sourceforge.net>
parents:
2007
diff
changeset
|
6046 |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6047 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6048 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
|
6049 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6050 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
6051 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
|
6052 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6053 <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
|
6054 <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
|
6055 <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
|
6056 <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
|
6057 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
|
6058 <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
|
6059 <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
|
6060 <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
|
6061 <td> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6062 <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
|
6063 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
|
6064 </td> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6065 </tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6066 </table> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6067 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6068 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6069 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
|
6070 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6071 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6072 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
|
6073 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
|
6074 our template alongside the summary display, and then introduce a switch |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
6075 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
|
6076 ``@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
|
6077 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6078 <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
|
6079 <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
|
6080 <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
|
6081 <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
|
6082 <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
|
6083 </th> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6084 </tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6085 <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
|
6086 <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
|
6087 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
|
6088 <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
|
6089 <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
|
6090 <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
|
6091 <td> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6092 <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
|
6093 </td> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6094 </tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6095 </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
|
6096 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6097 <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
|
6098 <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
|
6099 <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
|
6100 <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
|
6101 </th> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6102 </tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6103 <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
|
6104 <tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6105 <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
|
6106 <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
|
6107 <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
|
6108 (<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
|
6109 </th> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6110 </tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6111 <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
|
6112 </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
|
6113 </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
|
6114 </table> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6115 |
| 3121 | 6116 |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6117 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
|
6118 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6119 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6120 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
|
6121 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
|
6122 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
|
6123 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
|
6124 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
|
6125 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6126 <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
|
6127 enctype="multipart/form-data"> |
|
5201
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
6128 <input name="@csrf" type="hidden" |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
6129 tal:attributes="value python:utils.anti_csrf_nonce()"> |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6130 <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
|
6131 <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
|
6132 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6133 <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
|
6134 <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
|
6135 <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
|
6136 </form> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6137 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6138 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
|
6139 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
|
6140 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6141 <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
|
6142 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
|
6143 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
|
6144 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
|
6145 |
|
5201
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
6146 <input name="@csrf" type="hidden" |
|
a9ace22e0a2f
issue 2550690 - Adding anti-csrf measures to roundup following
John Rouillard <rouilj@ieee.org>
parents:
5196
diff
changeset
|
6147 tal:attributes="value python:utils.anti_csrf_nonce()"> |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6148 <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
|
6149 <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
|
6150 <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
|
6151 . |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6152 . |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6153 . |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6154 </form> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6155 |
|
3130
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
6156 Note that later in the form, I use the value of "cat" to decide which |
|
7308c3c5a943
docs editing from Jean Jordaan
Richard Jones <richard@users.sourceforge.net>
parents:
3127
diff
changeset
|
6157 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
|
6158 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6159 <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
|
6160 <tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6161 <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
|
6162 <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
|
6163 </tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6164 <tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6165 <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
|
6166 <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
|
6167 </tr> |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6168 </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
|
6169 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6170 ... 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
|
6171 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
|
6172 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6173 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
|
6174 usually to validate user choices and determine what page is next. Now encode |
| 2915 | 6175 those actions in a new ``Action`` class (see `defining new web actions`_):: |
| 6176 | |
| 6177 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
|
6178 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6179 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
|
6180 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
|
6181 ''' 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
|
6182 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
|
6183 ''' |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6184 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
|
6185 if category == '-1': |
|
4880
ca692423e401
Different approach to fix XSS in issue2550817
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4790
diff
changeset
|
6186 self.client.add_error_message('You must select a category of report') |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6187 return |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6188 # everything's ok, move on to the next page |
|
4464
c62c0f383e41
Fix incorrect setting of template in customizing.txt example action
Richard Jones <richard@users.sourceforge.net>
parents:
4435
diff
changeset
|
6189 self.client.template = 'add_page2' |
|
2156
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6190 |
| 2915 | 6191 def init(instance): |
| 6192 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
|
6193 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6194 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
|
6195 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
|
6196 |
|
d68eeb9d363f
reorg of the (now quite long) examples section and add new example
Richard Jones <richard@users.sourceforge.net>
parents:
2154
diff
changeset
|
6197 |
|
5714
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6198 Silent Submit |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6199 ~~~~~~~~~~~~~ |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6200 |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6201 When working on an issue, most of the time the people on the nosy list |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6202 need to be notified of changes. There are cases where a user wants to |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6203 add a comment to an issue and not bother other users on the nosy |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6204 list. |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6205 This feature is called Silent Submit because it allows the user to |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6206 silently modify an issue and not tell anyone. |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6207 |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6208 There are several parts to this change. The main activity part |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6209 involves editing the stock detectors/nosyreaction.py file in your |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6210 tracker. Insert the following lines near the top of the nosyreaction |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6211 function:: |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6212 |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6213 # Did user click button to do a silent change? |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6214 try: |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6215 if db.web['submit'] == "silent_change": |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6216 return |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6217 except (AttributeError, KeyError) as err: |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6218 # The web attribute or submit key don't exist. |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6219 # That's fine. We were probably triggered by an email |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6220 # or cli based change. |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6221 pass |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6222 |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6223 This checks the submit button to see if it is the silent type. If there |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6224 are exceptions trying to make that determination they are ignored and |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6225 processing continues. You may wonder how db.web gets set. This is done |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6226 by creating an extension. Add the file extensions/edit.py with |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6227 this content:: |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6228 |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6229 from roundup.cgi.actions import EditItemAction |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6230 |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6231 class Edit2Action(EditItemAction): |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6232 def handle(self): |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6233 self.db.web = {} # create the dict |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6234 # populate the dict by getting the value of the submit_button |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6235 # element from the form. |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6236 self.db.web['submit'] = self.form['submit_button'].value |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6237 |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6238 # call the core EditItemAction to process the edit. |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6239 EditItemAction.handle(self) |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6240 |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6241 def init(instance): |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6242 '''Override the default edit action with this new version''' |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6243 instance.registerAction('edit', Edit2Action) |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6244 |
|
7268
91125d474c1e
doc updates, normalize roundup => Roundup, add links, typo fixes
John Rouillard <rouilj@ieee.org>
parents:
7267
diff
changeset
|
6245 This code is a wrapper for the Roundup EditItemAction. It checks the |
|
5714
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6246 form's submit button to save the value element. The rest of the changes |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6247 needed for the Silent Submit feature involves editing |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6248 html/issue.item.html to add the silent submit button. In |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6249 the stock issue.item.html the submit button is on a line that contains |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6250 "submit button". Replace that line with something like the following:: |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6251 |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6252 <input type="submit" name="submit_button" |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6253 tal:condition="context/is_edit_ok" |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6254 value="Submit Changes"> |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6255 <button type="submit" name="submit_button" |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6256 tal:condition="context/is_edit_ok" |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6257 title="Click this to submit but not send nosy email." |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6258 value="silent_change" i18n:translate=""> |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6259 Silent Change</button> |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6260 |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6261 Note the difference in the value attribute for the two submit buttons. |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6262 The value "silent_change" in the button specification must match the |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6263 string in the nosy reaction function. |
|
a5f5c044049f
Documentation additions by Tom Ekberg to add example of performing
John Rouillard <rouilj@ieee.org>
parents:
5538
diff
changeset
|
6264 |
|
3548
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
6265 Debugging Trackers |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
6266 ================== |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
6267 |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
6268 There are three switches in tracker configs that turn on debugging in |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
6269 Roundup: |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
6270 |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
6271 1. web :: debug |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
6272 2. mail :: debug |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
6273 3. logging :: level |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
6274 |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
6275 See the config.ini file or the `tracker configuration`_ section above for |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
6276 more information. |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
6277 |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
6278 Additionally, the ``roundup-server.py`` script has its own debugging mode |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
6279 in which it reloads edited templates immediately when they are changed, |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
6280 rather than requiring a web server restart. |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
6281 |
|
61d48244e7a8
login may now be for a single session
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
6282 |
|
1244
8dd4f736370b
merge from maintenance branch
Richard Jones <richard@users.sourceforge.net>
parents:
1236
diff
changeset
|
6283 .. _`design documentation`: design.html |
|
4325
6ec048310de7
add simple doc about translating customised tracker content
Richard Jones <richard@users.sourceforge.net>
parents:
4300
diff
changeset
|
6284 .. _`developer's guide`: developers.html |
|
5980
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
6285 .. _`rest interface documentation`: rest.html#programming-the-rest-api |
|
7289
74778ed75aad
Add changing rest rate limiting to interface.py section.
John Rouillard <rouilj@ieee.org>
parents:
7276
diff
changeset
|
6286 .. _change the rate limiting method: rest.html#creating-custom-rate-limits |
|
6160
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
6287 .. _`directions in the rest interface documentation`: rest.html#enabling-the-rest-api |
|
9619d64c0351
Doc updates for customizing.txt, start of index generation
John Rouillard <rouilj@ieee.org>
parents:
6159
diff
changeset
|
6288 .. _`xmlrpc interface documentation`: xmlrpc.html#through-roundup |
|
5980
54d0080769f9
Support setting cache-control headers for static files
John Rouillard <rouilj@ieee.org>
parents:
5923
diff
changeset
|
6289 .. _`zxcvbn`: https://github.com/dwolfhub/zxcvbn-python |
|
6535
47b4391e1503
Fix docs mising Search permission for example. - addition
John Rouillard <rouilj@ieee.org>
parents:
6534
diff
changeset
|
6290 |
