Skip to content

Commit 84eb402

Browse files
authored
Fix typo in IOTileProjectSlug preventing p--0000-0000 from working (#36)
* Fix typo in IOTileProjectSlug preventing p--0000-0000 from working * Allow delete() to take a payload
1 parent b9eca57 commit 84eb402

5 files changed

Lines changed: 16 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
### v0.8.12 (2018-03-07)
2+
3+
* Fix typo in IOTileProjectSlug preventing `p--0000-0000` from been accepted as valid.
4+
* Allow delete() to accept data
5+
16
### v0.8.11 (2018-03-04)
27

38
* Change IOTileDeviceSlug back to accepting 64bits by default, but add a new allow_64bits option to be turned off

iotile_cloud/api/connection.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,15 @@ def put(self, data=None, **kwargs):
201201

202202
return self._process_response(resp)
203203

204-
def delete(self, **kwargs):
204+
def delete(self, data=None, **kwargs):
205+
if data:
206+
payload = json.dumps(data)
207+
else:
208+
payload = None
209+
205210
try:
206211
resp = requests.delete(
207-
self.url(), headers=self._get_header(), params=kwargs, verify=self._store['verify']
212+
self.url(), headers=self._get_header(), data=payload, params=kwargs, verify=self._store['verify']
208213
)
209214
except requests.exceptions.SSLError as err:
210215
raise HttpCouldNotVerifyServerError("Could not verify the server's SSL certificate", err)

iotile_cloud/utils/gid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def __init__(self, id):
9090

9191
# Convert to int and back to get rid of anything above 48 bits
9292
id = gid2int(pid)
93-
if id <= 0 or id >= pow(16, 8):
93+
if id < 0 or id >= pow(16, 8):
9494
raise ValueError('IOTileProjectSlug: UUID should be greater than zero and less than 16^8')
9595
pid = int2pid(id)
9696

tests/test_gid.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ def test_project_slug(self):
1313
# We allow projects to be zero as we use that to represent no project
1414
id = IOTileProjectSlug(0)
1515
self.assertEqual(str(id), 'p--0000-0000')
16+
id = IOTileProjectSlug('p--0000-0000')
17+
self.assertEqual(str(id), 'p--0000-0000')
1618

1719
id = IOTileProjectSlug('p--0000-1234')
1820
self.assertEqual(str(id), 'p--0000-1234')

version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version = '0.8.11'
1+
version = '0.8.12'

0 commit comments

Comments
 (0)