comparison doc/customizing.txt @ 7853:03c1b7ae3a68

issue2551328/issue2551264 unneeded next link and total_count incorrect Fix: issue2551328 - REST results show next link if number of results is a multiple of page size. (Found by members of team 3 in the UMass-Boston CS682 Spring 2024 class.) issue2551264 - REST X-Total-Count header and @total_size count incorrect when paginated These issues arose because we retrieved the exact number of rows from the database as requested by the user using the @page_size parameter. With this changeset, we retrieve up to 10 million + 1 rows from the database. If the total number of rows exceeds 10 million, we set the total_count indicators to -1 as an invalid size. (The max number of requested rows (default 10 million +1) can be modified by the admin through interfaces.py.) By retrieving more data than necessary, we can calculate the total count by adding @page_index*@page_size to the number of rows returned by the query. Furthermore, since we return more than @page_size rows, we can determine the existence of a row at @page_size+1 and use that information to determine if a next link should be provided. Previously, a next link was returned if @page_size rows were retrieved. This change does not guarantee that the user will get @page_size rows returned. Access policy filtering occurs after the rows are returned, and discards rows inaccessible by the user. Using the current @page_index/@page_size it would be difficult to have the roundup code refetch data and make sure that a full @page_size set of rows is returned. E.G. @page_size=100 and 5 of them are dropped due to access restrictions. We then fetch 10 items and add items 1-4 and 6 (5 is inaccessible). There is no way to calculate the new database offset at: @page_index*@page_size + 6 from the URL. We would need to add an @page_offset=6 or something. This could work since the client isn't adding 1 to @page_index to get the next page. Thanks to HATEOAS, the client just uses the 'next' url. But I am not going to cross that bridge without a concrete use case. This can also be handled client side by merging a short response with the next response and re-paginating client side. Also added extra index markers to the docs to highlight use of interfaces.py.
author John Rouillard <rouilj@ieee.org>
date Mon, 01 Apr 2024 09:57:16 -0400
parents 697062addac4
children 6cebbb42c883
comparison
equal deleted inserted replaced
7852:9e686e3f39c1 7853:03c1b7ae3a68
2174 string in the nosy reaction function. 2174 string in the nosy reaction function.
2175 2175
2176 Changing How the Core Code Works 2176 Changing How the Core Code Works
2177 -------------------------------- 2177 --------------------------------
2178 2178
2179 .. index:: single: interfaces.py; cache-control headers
2180
2179 Changing Cache-Control Headers 2181 Changing Cache-Control Headers
2180 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2182 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2181 2183
2182 The Client class in cgi/client.py has a lookup table that is used to 2184 The Client class in cgi/client.py has a lookup table that is used to
2183 set the Cache-Control headers for static files. The entries in this 2185 set the Cache-Control headers for static files. The entries in this
2200 * a file named rss.xml will be cached for 15 minutes 2202 * a file named rss.xml will be cached for 15 minutes
2201 * a file named local.js will be cached for 2 hours 2203 * a file named local.js will be cached for 2 hours
2202 2204
2203 Note that a file name match overrides the mime type settings. 2205 Note that a file name match overrides the mime type settings.
2204 2206
2207 .. index:: single: interfaces.py; password complexity checking
2205 2208
2206 Implement Password Complexity Checking 2209 Implement Password Complexity Checking
2207 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2210 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2208 2211
2209 .. index:: tracker; lib directory (example) 2212 .. index:: tracker; lib directory (example)
2238 password.Password.setPassword = mpPasswordFunc 2241 password.Password.setPassword = mpPasswordFunc
2239 2242
2240 it replaces the setPassword method in the Password class. The new 2243 it replaces the setPassword method in the Password class. The new
2241 version validates that the password is sufficiently complex. Then it 2244 version validates that the password is sufficiently complex. Then it
2242 passes off the setting of password to the original method. 2245 passes off the setting of password to the original method.
2246
2247 .. index:: single: interfaces.py; interpreting time interval values
2243 2248
2244 Enhance Time Intervals Forms 2249 Enhance Time Intervals Forms
2245 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2250 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2246 2251
2247 To make the user interface easier to use, you may want to support 2252 To make the user interface easier to use, you may want to support

Roundup Issue Tracker: http://roundup-tracker.org/