git://git.onelab.eu
/
sfa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0409ce2
)
allow Xrn class to be instantiated with None
author
Tony Mack
<tmack@paris.CS.Princeton.EDU>
Fri, 12 Nov 2010 21:11:52 +0000
(16:11 -0500)
committer
Tony Mack
<tmack@paris.CS.Princeton.EDU>
Fri, 12 Nov 2010 21:11:52 +0000
(16:11 -0500)
sfa/util/xrn.py
patch
|
blob
|
history
diff --git
a/sfa/util/xrn.py
b/sfa/util/xrn.py
index
71731d9
..
0d5e6bf
100644
(file)
--- a/
sfa/util/xrn.py
+++ b/
sfa/util/xrn.py
@@
-61,19
+61,17
@@
class Xrn:
# self.path
# provide either urn, or (hrn + type)
def __init__ (self, xrn, type=None):
# self.path
# provide either urn, or (hrn + type)
def __init__ (self, xrn, type=None):
+ if not xrn: xrn = ""
# user has specified xrn : guess if urn or hrn
# user has specified xrn : guess if urn or hrn
- if xrn is not None:
- if xrn.startswith(Xrn.URN_PREFIX):
- self.hrn=None
- self.urn=xrn
- self.urn_to_hrn()
- else:
- self.urn=None
- self.hrn=xrn
- self.type=type
- self.hrn_to_urn()
+ if xrn.startswith(Xrn.URN_PREFIX):
+ self.hrn=None
+ self.urn=xrn
+ self.urn_to_hrn()
else:
else:
- raise SfaAPIError,"Xrn.__init__"
+ self.urn=None
+ self.hrn=xrn
+ self.type=type
+ self.hrn_to_urn()
# happens all the time ..
# if not type:
# sfa_logger().debug("type-less Xrn's are not safe")
# happens all the time ..
# if not type:
# sfa_logger().debug("type-less Xrn's are not safe")