Menu

#333 TaurusGUI listerer - Inconsistency with MntGrp with capital letters

Jan17
resolved
None
bug
2016-08-24
2016-08-12
No

The listener Raise a Exception on use MntGrps with Capital letters.
"ActiveMntGrp XX is not defined"

Discussion

  • Daniel Roldan

    Daniel Roldan - 2016-08-12

    The PATCH has been sent

     
  • Daniel Roldan

    Daniel Roldan - 2016-08-22

    PATCH

     
    • Zbigniew Reszela

      See the improved patch sent to the develop mailing list.

       
      • Carlos Pascual

        Carlos Pascual - 2016-08-23

        I have some issues with the approach. I think we should not use lower() here. See some motivation in https://sourceforge.net/p/sardana/tickets/498/#e443/678e

        I think we should consider an alternative approach, maybe based in using case-insensitive comparisons from CaselessDict. See this snippet:

        from taurus.core.util import CaselessDict
        
        d=CaselessDict({'BAR':1})
        
        print 'bar' in d.keys() #--> True
        print 'BAR' in d.keys() #--> False
        print 'bar' in d        #--> True
        print 'BAR' in d        #--> True
        

        So I think we should not use the .keys() (and not use lower()), and also make sure that we are really using a CaselessDict (i.e., that we did not cast it to a normal dict at some point).

        BTW, even for regular dicts, the PEP8 also recommends using foo in mydict over foo in mydict.keys()

         
  • Zbigniew Reszela

    • labels: listener -->
    • assigned_to: Zbigniew Reszela
    • Milestone: unassigned --> Jan17
     
  • Zbigniew Reszela

    The new patch was sent to the develop mailing list.

     
  • Carlos Pascual

    Carlos Pascual - 2016-08-23
    • status: waiting --> resolved
     
  • Carlos Pascual

    Carlos Pascual - 2016-08-23

    Patch applied to develop and support-3.x branches

     
  • Daniel Roldan

    Daniel Roldan - 2016-08-24

    Great solution, thanks!