[Zope] Zope Persistence (was: XML-RPC within ZOPE)
Lennart Regebro
regebro at gmail.com
Sun Dec 18 17:11:36 EST 2005
On 12/18/05, Jan-Ole Esleben <esleben at gmail.com> wrote:
> What you say is all perfectly true except:
>
> 1. In the example, just setting _p_changed=1 does _not_ lead to a
> conflict error. With the ineffectual code above it (that never gets
> executed) it _does_. So there _is_ some implicit magical stuff going
> on and ZOPE tries to take care that only subobjects change (but
> incompletely)!
Possibly, but that is irrelevant. If you try to force a conflict error
in a place where there should not be one in a real situation, you can
hardly complain that there is no conflict error. ;-)
> 2. You shouldn't use lists and dicts - it should say this "on the
> front page". It is never really mentioned in any way that intuitively
> leads to such problems as we are now talking about. It isn't very
> obvious that things work like this when you look at the documentation,
> and
Well, there may be a documentation problem in this area, I haven't
read any docs for years. :-) But it is pretty clearly stated that
objects should be aware of persistency, and dicts and lists aren't.
That's where there are PersistentLists and PersistentDicts.
> 3. It is especially confusing that ZOPE behaves differently when using
> XML-RPC calls.
I don't think it is.
> From what you say, it should be the same within the
> ZOPE system as when using XML-RPC. It gets more complicated with
> XML-RPC though!
No, it doesn't. Really. It doesn't. Stop overcomplicating things. It's
much easier than you think. We just need the right way to explain it
to you and we haven't found it yet. We will soon.
> All the stuff that you claim as being obvious really
> isn't all that obvious. And of course, once you've been burned by
> something like this and the confusion it engenders, you will only use
> PersistentMapping etc., but I still don't know what _exactly_ to
> expect from ZOPE in terms of behaviour with mutable objects that
> aren't Persistent (because of the XML-RPC inconsistency and the
> self._p_changed inconsistency both mentioned above).
You should know not to mutate them. Full stop. Do not use mutable
objects unless they are persistent aware.
I still think you are over-complicating things. It may not be obvious,
but its is pretty darn easy. :-)
--
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
More information about the Zope
mailing list