git://git.onelab.eu
/
plcapi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7274975
)
don't bother with isinstance, a better way to get an int or str.
author
Barış Metin
<Talip-Baris.Metin@sophia.inria.fr>
Wed, 10 Mar 2010 10:23:43 +0000
(10:23 +0000)
committer
Barış Metin
<Talip-Baris.Metin@sophia.inria.fr>
Wed, 10 Mar 2010 10:23:43 +0000
(10:23 +0000)
aspects/omfaspects.py
patch
|
blob
|
history
diff --git
a/aspects/omfaspects.py
b/aspects/omfaspects.py
index
a9bc179
..
7139b26
100644
(file)
--- a/
aspects/omfaspects.py
+++ b/
aspects/omfaspects.py
@@
-25,10
+25,11
@@
class BaseOMF(object):
def get_slice(self, api, id_or_name):
slice_filter = {}
- if isinstance(id_or_name, str):
+ try: # if integer
+ slice_filter['slice_id'] = int(str(id_or_name))
+ except ValueError:
+ # we have a string
slice_filter['name'] = id_or_name
- else:
- slice_filter['slice_id']= id_or_name
slice = Slices(api, slice_filter = slice_filter)[0]
# don't bother to check for slice tags for the moment. we'll only
# create XMPP pubsub groups for all slices