Discussion:
[Erp5-dev] Restricted traverse and module "concept" - confusion
Łukasz Nowak
2008-03-27 13:52:50 UTC
Permalink
Hello,

First - please look at attached test. I hope it is explaining what I
try to explain below.

In person_module there are objects with id '1' and '2'.

If I invoke '1'.getObject()restrictedTraverse('2') I've got object '2'
returned. Well - AFAIK is it ok from acquisition point of view.

But isn't it not correct from module oriented concept? Such problems
are rising in simulations, when they use restricted traverse, and then
operate on wrong object, eg. on sale_order_module/1 Sale Order instead
of sale_order_module/12312/1 Sale Order Line, which has disappeared
(has been deleted for example), but wasn't removed from simulation
movement order - but restrictedTraverse returned sale_order_module/1
while invoked on sale_order_module/12312 with parameters '1', instead
of rising exception.

Any comments, explanations, ideas welcome. I'm quite confused.

Regards,
Luke
--
?ukasz Nowak R&D Ventis http://www.ventis.com.pl/
tel: +48 32 768 16 85 fax: +48 32 392 10 61
``Use the Source, Luke...'' I am only craftsman.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testTraverseQuestion.py
Type: text/x-python
Size: 1614 bytes
Desc: not available
URL: <http://mail.tiolive.com/pipermail/erp5-dev/attachments/20080327/00f98fb6/attachment.py>
Jérome Perrin
2008-03-27 13:57:35 UTC
Permalink
Hello,

IIRC this https://svn.erp5.org/?view=rev&revision=17429 has been done to
fix the issue you are refering to.

J?rome
Post by Łukasz Nowak
Hello,
First - please look at attached test. I hope it is explaining what I
try to explain below.
In person_module there are objects with id '1' and '2'.
If I invoke '1'.getObject()restrictedTraverse('2') I've got object '2'
returned. Well - AFAIK is it ok from acquisition point of view.
But isn't it not correct from module oriented concept? Such problems
are rising in simulations, when they use restricted traverse, and then
operate on wrong object, eg. on sale_order_module/1 Sale Order instead
of sale_order_module/12312/1 Sale Order Line, which has disappeared
(has been deleted for example), but wasn't removed from simulation
movement order - but restrictedTraverse returned sale_order_module/1
while invoked on sale_order_module/12312 with parameters '1', instead
of rising exception.
Any comments, explanations, ideas welcome. I'm quite confused.
Regards,
Luke
------------------------------------------------------------------------
_______________________________________________
Erp5-dev mailing list
Erp5-dev at erp5.org
http://mail.nexedi.com/mailman/listinfo/erp5-dev
Łukasz Nowak
2008-03-27 14:02:33 UTC
Permalink
Hello,

On 2008-03-27, 14:57:35
Post by Łukasz Nowak
Hello,
IIRC this https://svn.erp5.org/?view=rev&revision=17429 has been done
to fix the issue you are refering to.
Hm. But I got:

Path: CMFActivity
Revision: 18850
Path: CMFCategory
Revision: 18850
Path: ERP5
Revision: 18850
Path: ERP5Banking
Revision: 18850
Path: ERP5Catalog
Revision: 18850
Path: ERP5Form
Revision: 18850
Path: ERP5OOo
Revision: 18850
Path: ERP5Security
Revision: 18850
Path: ERP5Subversion
Revision: 18850
Path: ERP5SyncML
Revision: 18850
Path: ERP5Type
Revision: 18850

And this test is not passing. Zope used is Zope 2.8.9.1-final, python
2.4.4, linux2.

Regards,
Luke
--
?ukasz Nowak R&D Ventis http://www.ventis.com.pl/
tel: +48 32 768 16 85 fax: +48 32 392 10 61
``Use the Source, Luke...'' I am only craftsman.
Jérome Perrin
2008-03-27 14:13:54 UTC
Permalink
Post by Łukasz Nowak
Hello,
On 2008-03-27, 14:57:35
Post by Łukasz Nowak
Hello,
IIRC this https://svn.erp5.org/?view=rev&revision=17429 has been done
to fix the issue you are refering to.
Path: CMFActivity
Revision: 18850
Path: CMFCategory
Revision: 18850
Path: ERP5
Revision: 18850
Path: ERP5Banking
Revision: 18850
Path: ERP5Catalog
Revision: 18850
Path: ERP5Form
Revision: 18850
Path: ERP5OOo
Revision: 18850
Path: ERP5Security
Revision: 18850
Path: ERP5Subversion
Revision: 18850
Path: ERP5SyncML
Revision: 18850
Path: ERP5Type
Revision: 18850
And this test is not passing. Zope used is Zope 2.8.9.1-final, python
2.4.4, linux2.
Yes, it doesn't change restrictedTraverse, it changes resolveCategory,
which is used by category accessors, like when you call getOrderValue or
getDeliveryValue on a Simulation Movement.

J?rome
Łukasz Nowak
2008-03-27 14:18:10 UTC
Permalink
Hello,

On 2008-03-27, 15:13:54
J?rome Perrin <jerome at nexedi.com> wrote:

(...)
Post by Jérome Perrin
Yes, it doesn't change restrictedTraverse, it changes
resolveCategory, which is used by category accessors, like when you
call getOrderValue or getDeliveryValue on a Simulation Movement.
Ok - understood.

So behaviour from my test is correct? System shall return object from
same module using restrictedTraverse? (Just wanted to be sure.)

Regards,
Luke
--
?ukasz Nowak R&D Ventis http://www.ventis.com.pl/
tel: +48 32 768 16 85 fax: +48 32 392 10 61
``Use the Source, Luke...'' I am only craftsman.
Jérome Perrin
2008-03-27 14:25:24 UTC
Permalink
Post by Łukasz Nowak
Hello,
On 2008-03-27, 15:13:54
(...)
Post by Jérome Perrin
Yes, it doesn't change restrictedTraverse, it changes
resolveCategory, which is used by category accessors, like when you
call getOrderValue or getDeliveryValue on a Simulation Movement.
Ok - understood.
So behaviour from my test is correct? System shall return object from
same module using restrictedTraverse? (Just wanted to be sure.)
Yes, it's how zope's acquisition works in this case.

J?rome

Loading...