Mercurial > p > roundup > code
annotate doc/implementation.txt @ 5639:f576957cbb1f
Add support for prev/next/self links when returning paginated results.
To do this:
1) change "data" envelope from an array to a dict
2) move the "data" array to the "collection" property,
which is an array of elements in the collection.
3) add @links dict keyed by link relation: self, next, prev.
Each relation is an array of dicts with uri and rel keys.
In this case there is only one element, but there is nothing
preventing a relation from having multiple url's. So this follows
the formatting needed for the general case.
Relations are present only if it makes sense. So first page has no
prev and last page has no next.
4) add @total_size with number of element selected if they were
not paginated. Replicates data in X-Count-Total header.
Changed index to start at 1. So the first page is page_index 1 and not
page_index 0. (So I am no longer surprised when I set page_index to 1
and am missing a bunch of records 8-)).
Also a small fixup, json response ends with a newline so printing
the data, or using curl makes sure that anything printing after the
json output (like shell prompts) is on a new line.
Tests added for all cases.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sat, 09 Mar 2019 11:06:10 -0500 |
| parents | 33a1f03b9de0 |
| children | 9ca128103a3a |
| rev | line source |
|---|---|
|
688
b38f4f95bffd
More doc tweaks
Richard Jones <richard@users.sourceforge.net>
parents:
686
diff
changeset
|
1 ==================== |
|
111
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2 Implementation notes |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3 ==================== |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
4 |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
5 [see also the roundup package docstring] |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
6 |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
7 There have been some modifications to the spec. I've marked these in the |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
8 source with 'XXX' comments when I remember to. |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
9 |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
10 In short: |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
11 Class.find() - may match multiple properties, uses keyword args. |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
12 |
|
1661
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
13 Class.filter() - isn't in the spec and it's very useful to have at the |
|
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
14 Class level. |
|
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
15 |
|
111
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
16 CGI interface index view specifier layout part - lose the '+' from the |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
17 sorting arguments (it's a reserved URL character ;). Just made no |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
18 prefix mean ascending and '-' prefix descending. |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
19 |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
20 ItemClass - renamed to IssueClass to better match it only having one |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
21 hypderdb class "issue". Allowing > 1 hyperdb class breaks the |
|
1661
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
22 "superseder" multilink (since it can only link to one thing, and |
|
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
23 we'd want bugs to link to support and vice-versa). |
|
111
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
24 |
|
1661
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
25 template - the call="link()" is handled by special-case mechanisms in |
|
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
26 my top-level CGI handler. In a nutshell, the handler looks for a |
|
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
27 method on itself called 'index%s' or 'item%s' where %s is a class. |
|
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
28 Most items pass on to the templating mechanism, but the file class |
|
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
29 _always_ does downloading. It'll probably stay this way too... |
|
111
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
30 |
|
1089
43ab730ee194
instance -> tracker, node -> item
Richard Jones <richard@users.sourceforge.net>
parents:
907
diff
changeset
|
31 template - call="link(property)" may be used to link "the current item" |
|
111
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
32 (from an index) - the link text is the property specified. |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
33 |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
34 template - added functions that I found very useful: List, History and |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
35 Submit. |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
36 |
|
1661
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
37 template - items must specify the message lists, history, etc. Having |
|
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
38 them by default was sometimes not wanted. |
|
111
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
39 |
|
1661
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
40 template - index view determines its default columns from the |
|
b9c1226cb600
Reflowed text to 72 cols...
Jean Jordaan <neaj@users.sourceforge.net>
parents:
1089
diff
changeset
|
41 template's ``tal:condition="request/show/<property>"`` directives. |
|
111
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
42 |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
43 template - menu() and field() look awfully similar now .... ;) |
|
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
44 |
|
907
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
688
diff
changeset
|
45 roundup_admin.py - the command-line tool has a lot more commands at its |
|
38a74d1351c5
documentation updates
Richard Jones <richard@users.sourceforge.net>
parents:
688
diff
changeset
|
46 disposal |
|
111
6e8197a5880f
Split off implementation notes into separate file in doc directory.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
47 |
|
686
c52122f38c9b
Documentation cleanup, added info for potential (and current) developers
Richard Jones <richard@users.sourceforge.net>
parents:
111
diff
changeset
|
48 ----------------- |
|
c52122f38c9b
Documentation cleanup, added info for potential (and current) developers
Richard Jones <richard@users.sourceforge.net>
parents:
111
diff
changeset
|
49 |
|
c52122f38c9b
Documentation cleanup, added info for potential (and current) developers
Richard Jones <richard@users.sourceforge.net>
parents:
111
diff
changeset
|
50 Back to `Table of Contents`_ |
|
c52122f38c9b
Documentation cleanup, added info for potential (and current) developers
Richard Jones <richard@users.sourceforge.net>
parents:
111
diff
changeset
|
51 |
|
c52122f38c9b
Documentation cleanup, added info for potential (and current) developers
Richard Jones <richard@users.sourceforge.net>
parents:
111
diff
changeset
|
52 .. _`Table of Contents`: index.html |
|
c52122f38c9b
Documentation cleanup, added info for potential (and current) developers
Richard Jones <richard@users.sourceforge.net>
parents:
111
diff
changeset
|
53 |
