Skip to content

Commit

Permalink
Merge pull request #896 from kernc/fixup
Browse files Browse the repository at this point in the history
widgets.utils.getdeepattr() simpler
  • Loading branch information
janezd committed Dec 4, 2015
2 parents 077ddc1 + 80125aa commit eb975cd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Orange/widgets/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ def getdeepattr(obj, attr, *arg, **kwarg):
if isinstance(obj, dict):
return obj.get(attr)
try:
return reduce(lambda o, n: getattr(o, n), attr.split("."), obj)
except:
return reduce(getattr, attr.split("."), obj)
except AttributeError:
if arg:
return arg[0]
if kwarg:
return kwarg["default"]
raise AttributeError("'%s' has no attribute '%s'" % (obj, attr))
raise

def getHtmlCompatibleString(strVal):
return strVal.replace("<=", "&#8804;").replace(">=","&#8805;").replace("<", "&#60;").replace(">","&#62;").replace("=\\=", "&#8800;")

0 comments on commit eb975cd

Please sign in to comment.