Ticket #185 (new enhancement)

Opened 3 months ago

Last modified 3 months ago

record.exists() does not behave as expected on records that have been loaded using load(id=pk,otherField=something)

Reported by: TomChiverton Owned by: dhughes
Type: enhancement Priority: normal
Milestone: 1.0 Release Component: Reactor - Record
Version: Severity: normal
Keywords: Cc:

Description

Record.exists() will return true if the primary key of the current interal TO is valid (i.e. exists in the database).
The fact that the object was loaded using some other fields, and so may or many not represent a real item in the database, is ignored.
In fact the transfer object that gets returned will have the 'real' value of 'otherField' over written by the value given in the load() method, which is even odder.

The work around is to load the record and then check the field.

See also http://www.rachaelandtom.info/content/gotcha-reactor-records-and-exists

I'm not sure what the 'fix' should be, but my first though involves tracking which fields have been set, and how. Eww.

Change History

Changed 3 months ago by mark.drew@…

  • milestone set to 1.0 Release

Changed 3 months ago by TomChiverton

I'd be tempted to note this in the release notes and postpone till after v1

Note: See TracTickets for help on using tickets.