[Zope] Re: Zope Persistence (was: XML-RPC within ZOPE)
Florent Guillaume
fg at nuxeo.com
Sun Dec 18 15:17:14 EST 2005
Jan-Ole Esleben wrote:
> security.declareProtected("Use TestPChanged", "test_internal")
> def test_internal(self, args=None, args2=None):
> "Called by test via XML-RPC"
> if args2:
> self.a.append(1)
> self._p_changed = 1
> if not args:
> import xmlrpclib
> s = xmlrpclib.ServerProxy("http://USER:PASSWORD@localhost:8080/",
> allow_none=True)
> s.TestPChanged.test_internal(1)
> return self.a
>
> security.declareProtected("Use TestPChanged", "test")
> def test(self, args2=None):
> "Called directly via ZOPE"
> if args2:
> self.a.append(1)
> self._p_changed = 1
> import xmlrpclib
> s = xmlrpclib.ServerProxy("http://USER:PASSWORD@localhost:8080/",
> allow_none=True)
> return s.TPCDest.test_internal()
>
>
> 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)!
I strongly doubt it. Zope does not "inspect code". There must be a
problem in your testing. Note that if self.a is a standard list, the
self.a.append(1) doesn't have any impact on the persistence mechanism or
transactions either.
> 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
You should understand the persistence mechanism of a framework before
using it. Zope's is simple to understand in the case where you work with
a single transaction. Here you have a remote server that does a callback
to the local and thus starts a new transaction parallel to the current
one. In addition it touches the same object. Frankly that's a bizarre
use case, nothing is "simple" about it.
> 3. It is especially confusing that ZOPE behaves differently when using
> XML-RPC calls. 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!
The successive XML-RPC call you describe provoke new transactions,
surely you're aware of that? Whereas just calling a function of course
doesn't.
Florent
--
Florent Guillaume, Nuxeo (Paris, France) Director of R&D
+33 1 40 33 71 59 http://nuxeo.com fg at nuxeo.com
More information about the Zope
mailing list