projects
/
osm
/
N2VC.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
088c314
)
Allow underscore to dash translation when accessing model attributes (#101)
author
simonklb
<simonkollberg@gmail.com>
Mon, 3 Apr 2017 16:21:22 +0000
(18:21 +0200)
committer
Cory Johns
<johnsca@gmail.com>
Mon, 3 Apr 2017 16:21:22 +0000
(12:21 -0400)
juju/model.py
patch
|
blob
|
history
diff --git
a/juju/model.py
b/juju/model.py
index
55ad086
..
0278ae6
100644
(file)
--- a/
juju/model.py
+++ b/
juju/model.py
@@
-230,7
+230,14
@@
class ModelEntity(object):
model.
"""
- return self.safe_data[name]
+ try:
+ return self.safe_data[name]
+ except KeyError:
+ name = name.replace('_', '-')
+ if name in self.safe_data:
+ return self.safe_data[name]
+ else:
+ raise
def __bool__(self):
return bool(self.data)