Edgewall Software

Opened 9 years ago

Closed 9 years ago

#12140 closed enhancement (fixed)

Replace uses of ticket.values with Ticket item accessors — at Version 3

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.2
Component: ticket system Version:
Severity: normal Keywords: refactoring
Cc: Branch:
Release Notes:

Refactored modules in ticket package to use item accessors rather than manipulating ticket.values directly.

API Changes:

The Ticket class implements __contains__.

Internal Changes:

Description

The ticket class implements __getitem__ and __setitem__ to set and get from the values attribute, but many places in the code still work with the values attribute directly. For example, ticket.values['reporter'] has been used since [1831] but it appears it can be replaced with ticket['reporter'].

Directly setting to values could even be problematic due to the logic in __setitem__: tags/trac-1.1.6/trac/ticket/model.py#L186.

I considered trying to make values a protected attribute, but it is used to serialize the ticket properties:

Change History (3)

comment:1 by Ryan J Ollos, 9 years ago

comment:2 by Ryan J Ollos, 9 years ago

Owner: set to Ryan J Ollos
Status: newassigned

comment:3 by Ryan J Ollos, 9 years ago

API Changes: modified (diff)
Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed to trunk in [14213].

Note: See TracTickets for help on using tickets.