comparison doc/upgrading.txt @ 8262:2a7c3eeaf167

feat: add templating utils method dynamically; method to set http code Added new utils.set_http_response(integer) to set the HTML response code from a template. Useful for error handling inside template. Also noted that a real TemplatingUtils (like set_http_response) method gets the TemplatingUtils object instance, but there is no way to do this with registerUtil() from an extension file. Added new instance.registerUtilMethod() method to register a function in an extension as a method passing the client instance in as the first parameter (aka self).
author John Rouillard <rouilj@ieee.org>
date Tue, 07 Jan 2025 20:22:33 -0500
parents 6bd11a73f2ed
children 35beff316883
comparison
equal deleted inserted replaced
8261:28c5030757d3 8262:2a7c3eeaf167
250 250
251 In this release, the validation of the output format and version 251 In this release, the validation of the output format and version
252 occurs before any database changes are made. Now, all errors related 252 occurs before any database changes are made. Now, all errors related
253 to the data format (mime type, API version) will return 406 errors, 253 to the data format (mime type, API version) will return 406 errors,
254 where some previously resulted in 400 errors. 254 where some previously resulted in 400 errors.
255
256 New method for registering templating utils (info)
257 --------------------------------------------------
258
259 If you are building a template utility function that needs access
260 to:
261
262 * the database
263 * the client instance
264 * the form the user submitted
265
266 you had to pass these objects from the template using the ``db``,
267 ``request.client`` or ``request.form`` arguments.
268
269 A new method for registering a template utility has been
270 added. If you use the ``instance`` object's
271 ``registerUtilMethod()`` to register a utility function, you do
272 not need to pass these arguments. The function is called as a
273 method and the first argument is a ``client`` instance from which
274 the database (client.db), form (client.form).
275
276 You can find an example in :ref:`dynamic_csp`.
255 277
256 .. index:: Upgrading; 2.3.0 to 2.4.0 278 .. index:: Upgrading; 2.3.0 to 2.4.0
257 279
258 Migrating from 2.3.0 to 2.4.0 280 Migrating from 2.3.0 to 2.4.0
259 ============================= 281 =============================

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