← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 806342] [NEW] Special chars in selection fields can not be selected on editable tree

 

Public bug reported:

Hello,

This happens with the gtk client 6.0 (revno 1868).

To reproduce it, you need a selection field in a editable tree view.
For example, add editable="bottom" in the attendances tree view and set your client in french.
The "Sign In" choice becomes "Pointer l'entrée".

When you select this value in the selection field, as soon as you left
the field, it becomes empty.

This is displayed in the logs :
/opt/client_60/bin/widget/view/tree_gtk/parser.py:630: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if txt[:len(text)].lower() == text.lower():

In the widget method
    def value_from_text(self, model, text):
        selection = self.attrs['selection']
        text = tools.ustr(text)
        res = False
        for val, txt in selection:
            if txt[:len(text)].lower() == text.lower():
                if len(txt) == len(text):
                    return val
                res = val
        return res
Variables are equal to :
txt : "Pointer l'entr\xc3\xa9e"
text parameter input : "Pointer l'entr\xc3\xa9e"
text after tools.ustr u"Pointer l'entr\xe9e"

A unicode conversion is done on the text, but it is compared to a non-
unicode string so the selection is never found.

So, the fix is either not to convert the variable, or to convert the
two.

A patch is attached.

Thanks
Guewen

** Affects: openobject-client
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/806342

Title:
  Special chars in selection fields can not be selected on editable tree

Status in OpenERP GTK Client:
  New

Bug description:
  Hello,

  This happens with the gtk client 6.0 (revno 1868).

  To reproduce it, you need a selection field in a editable tree view.
  For example, add editable="bottom" in the attendances tree view and set your client in french.
  The "Sign In" choice becomes "Pointer l'entrée".

  When you select this value in the selection field, as soon as you left
  the field, it becomes empty.

  This is displayed in the logs :
  /opt/client_60/bin/widget/view/tree_gtk/parser.py:630: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
    if txt[:len(text)].lower() == text.lower():

  In the widget method
      def value_from_text(self, model, text):
          selection = self.attrs['selection']
          text = tools.ustr(text)
          res = False
          for val, txt in selection:
              if txt[:len(text)].lower() == text.lower():
                  if len(txt) == len(text):
                      return val
                  res = val
          return res
  Variables are equal to :
  txt : "Pointer l'entr\xc3\xa9e"
  text parameter input : "Pointer l'entr\xc3\xa9e"
  text after tools.ustr u"Pointer l'entr\xe9e"

  A unicode conversion is done on the text, but it is compared to a non-
  unicode string so the selection is never found.

  So, the fix is either not to convert the variable, or to convert the
  two.

  A patch is attached.

  Thanks
  Guewen

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-client/+bug/806342/+subscriptions


Follow ups

References