Cédric,

one other small issue I ran into while working with Proteus

When adding objects that reference other objects, each object will
have a different instance (or threadlocal copy) of the Config object.

Currently proteus does a few assertions to make sure that both the target and source of the reference are the same, I assume to make sure there is no mixup in backends/databases.

When I add and party.address which holds a reference to a party.party I get:

Traceback (most recent call last):
  File "./tests.py", line 249, in setUp
    new = self.a.add(**addr)
  File "/home/paul/service/src/nfg.erp/nfg/erp/erp.py", line 80, in add
    new = addr(**kw)
File "/home/paul/service/src/proteus/proteus/__init__.py", line 275, in __init__
    setattr(self, field_name, value)
File "/home/paul/service/src/proteus/proteus/__init__.py", line 90, in set_method
    assert value._config == self._config
AssertionError

But this can easily be solved with attached patch assuming my assumption is correct with regards to the reason for this assertion


--
  ________________________________________________________________
  Paul Stevens                                      paul at nfg.nl
  NET FACILITIES GROUP                     GPG/PGP: 1024D/11F8CD31
  The Netherlands________________________________http://www.nfg.nl

--
[email protected] mailing list
# HG changeset patch
# User Paul J Stevens <[email protected]>
# Date 1285766372 -7200
# Node ID 1cbdde19119507777c86ba3813e25ad4f0c4bdab
# Parent  4842c72ea0fa3b8993443652627bb9af01fb549d
properly compare config objects

diff -r 4842c72ea0fa -r 1cbdde191195 proteus/config.py
--- a/proteus/config.py	Thu Sep 02 17:53:39 2010 +0200
+++ b/proteus/config.py	Wed Sep 29 15:19:32 2010 +0200
@@ -36,6 +36,9 @@
     def get_proxy_methods(self, name):
         raise NotImplementedError
 
+    def __eq__(self, other):
+        return repr(self) == repr(other)
+
 class _TrytondMethod(object):
 
     def __init__(self, name, model, config):

Reply via email to