Opened 12 years ago
Closed 12 years ago
#47 closed (fixed)
typo in Slice __init__ method prevents uuid from being set
Reported by: | chaos@bbn.com | Owned by: | somebody |
---|---|---|---|
Priority: | major | Milestone: | 2012-09-04 client release |
Component: | Clients | Version: | |
Keywords: | v0.3.0 | Cc: | |
Dependencies: |
Description
The code:
gmoc.Slice( 'urn:publicid:IDN+pgeni.gpolab.bbn.com+slice+chaos-montreve-macaddr', uuid = 'ff6d2b12-f10e-11e0-bf86-000c29f89f7b', created = datetime.datetime.fromtimestamp(1318028753), expires = datetime.datetime.fromtimestamp(1348981200), )
yields
Traceback (most recent call last): File "./report_foam_relations", line 227, in <module> expires = datetime.datetime.fromtimestamp(1348981200), TypeError: __init__() got an unexpected keyword argument 'uuid'
This is because of a typo in the Slice.__init__()
function:
def __init__(self, id, uuid_ = None, created = None, expires = None, creator = None, operator = None, sa = None)
(uuid_
instead of uuid
).
Change History (3)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
Keywords: | v0.3.0 added; v0.2.1 removed |
---|
Not fixed:
s = gmoc.Slice( 'urn:publicid:IDN+pgeni.gpolab.bbn.com+slice+chaos-montreve-macaddr', uuid_ = 'ff6d2b12-f10e-11e0-bf86-000c29f89f7b', created = datetime.datetime.fromtimestamp(1318028753), expires = datetime.datetime.fromtimestamp(1348981200), creator = users['urn:publicid:IDN+pgeni.gpolab.bbn.com+user+chaos'], ) print s.uuid print s.uuid_
yields:
None Traceback (most recent call last): File "./report_foam_relations", line 241, in <module> print s.uuid_ AttributeError: 'Slice' object has no attribute 'uuid_'
Note that there are two bugs here:
- Setting a string uuid in the Slice.init() doesn't work
uuid_
is not an appropriate visible name for a paramter
comment:3 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Setting a string UUID in Slice.__init__()
now works.
I still don't like uuid_
, but i'm going to open a different (minor) bug for that.
Note: See
TracTickets for help on using
tickets.
Actually, don't just change the one character: actually look at this function. It looks like you switched from
uuid
touuid_
to avoid conflicts with theuuid
module, but the current state is quite inconsistent. I don't think you can call a named parameteruuid_
because that's confusing to end-users. I'd recommend either:from uuid import UUID
rather than importing the whole moduleslice_uuid
(and, later,sliver_uuid
) to avoid conflict