Ticket #2071 (new defect)

Opened 10 years ago

Last modified 9 years ago

Resync concepts between DataModel and StorageAdapter

Reported by: gracinet Owned by: madarche
Priority: P2 Milestone: CPS 3.5.7
Component: CPSSchemas Version: TRUNK
Severity: normal Keywords: datamodel storage adapter risk
Cc:

Description (last modified by gracinet) (diff)

A DataModel is tied to up to 3 possibly different python objects:

  • object: this is the object passed to the storage adapter for read/write operations
  • proxy: this is the proxy the object might be see through. Used for instance to get a new, editable, revision if object is frozen.
  • context: this used to be object, but now is being viewed as an independent acquisition context (the code says that it's deprecated, meaning implicitely as the object, but it's used for security).

It's rare that the three really hold different values. Most of the times, if proxy is not None, context is proxy. But context can be really useful in case the datamodel is used as the model for a non-persistent view, like the advanced search form & result pages. Now the problem is that storage adapters only have two corresponding notions: context and proxy. Most probably, they didn't follow the introduction of object in DataModel. The storage adapters perform read and write on context. This is confusing, and besides, having an easily accessible context in non-persistent views can be really useful, so "object" should be brought to StorageAdapter as well.

For the record, CPSDefault's advanced search form uses a special widget to forward the user context rpath to the catalog. In some other cases, this approach might be non applicable or end up in a layout duplication that could be avoided.

Should never end up in 3.4 branch

Change History

comment:1 Changed 10 years ago by gracinet

  • Description modified (diff)

Corrected error about which object is used for security + cosmetic changes

comment:2 Changed 10 years ago by gracinet

  • Description modified (diff)

comment:3 Changed 9 years ago by gracinet

  • Keywords datamodel storage adapter risk added
  • Type changed from task to defect
Note: See TracTickets for help on using tickets.