xrg has proposed merging lp:~xrg/openobject-client/trunk-fix-model-get into 
lp:openobject-client.

Requested reviews:
  OpenERP sa GTK client R&D (openerp-dev-gtk)


Fixed as discussed. Still, no logging for the get_color exception, because no 
loggers have ever
been used in that level of code, so need some example (of what loggers are 
available etc.).

-- 
https://code.launchpad.net/~xrg/openobject-client/trunk-fix-model-get/+merge/28485
Your team OpenERP sa GTK client R&D is requested to review the proposed merge 
of lp:~xrg/openobject-client/trunk-fix-model-get into lp:openobject-client.
=== modified file 'bin/widget/model/field.py'
--- bin/widget/model/field.py	2010-05-12 14:03:03 +0000
+++ bin/widget/model/field.py	2010-06-25 08:15:37 +0000
@@ -192,10 +192,12 @@
 
     def get(self, model, check_load=True, readonly=True, modified=False):
         self.__check_model(model)
-        self.__check_load(model, modified, False)
-        if not model.value.get(self.name, False):
+        if check_load:
+            self.__check_load(model, modified, False)
+        res = model.value.get(self.name, False)
+        if not res:
             return model.value.get(self.get_size_name(), False) or False
-        return model.value.get(self.name, False) or False
+        return res
 
     def get_client(self, model):
         self.__check_model(model)

=== modified file 'bin/widget/view/tree_gtk/parser.py'
--- bin/widget/view/tree_gtk/parser.py	2010-05-05 13:18:56 +0000
+++ bin/widget/view/tree_gtk/parser.py	2010-06-25 08:15:37 +0000
@@ -299,10 +299,14 @@
 
     def get_color(self, model):
         to_display = ''
-        for color, expr in self.treeview.colors.items():
-            if model.expr_eval(expr, check_load=False):
-                to_display = color
-                break
+        try:
+            for color, expr in self.treeview.colors.items():
+                if model.expr_eval(expr, check_load=False):
+                    to_display = color
+                    break
+        except Exception:
+            # we can still continue if we can't get the color..
+            pass
         return to_display or 'black'
 
     def open_remote(self, model, create, changed=False, text=None):

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to