Edgewall Software

Opened 7 years ago

Last modified 4 years ago

#12684 closed enhancement

_RequestArgs.get should alias getfirst — at Version 2

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.3.2
Component: general Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Fixed exceptions due to req.args.get unexpectedly returning a list.

API Changes:

_RequestArgs.get aliases getfirst.

Internal Changes:

Description (last modified by Ryan J Ollos)

Discussed in #12682, to make the API more pythonic and to fix issues like the one seen in #12682, req.args.get should return a string rather than a string or list. If a list is expected req.args.getlist should be used.

_RequestArgs.getbinary will be added, as a shorthand for: req.args.getint('key', default, min=0, max=1).

The as_ methods of _RequestArgs should be modified/extended to be consistent with the changes.

Code in query.py can also be refactored to use _RequestArgs: trunk/trac/ticket/query.py@15573:949-971#L948.

Change History (2)

comment:1 by Ryan J Ollos, 7 years ago

Description: modified (diff)

comment:2 by Ryan J Ollos, 7 years ago

API Changes: modified (diff)
Milestone: next-dev-1.3.x1.3.2
Owner: set to Ryan J Ollos
Release Notes: modified (diff)
Status: newassigned
Note: See TracTickets for help on using tickets.