Skip to content
This repository has been archived by the owner on Feb 15, 2018. It is now read-only.

Commit

Permalink
Don't have None based relationships
Browse files Browse the repository at this point in the history
  • Loading branch information
madninja committed Dec 24, 2016
1 parent b9bfd50 commit c2ba7e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions helium/device_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def _resource_type(cls):
return 'device-configuration'

@classmethod
def create(cls, session, device=None, configuration=None):
def create(cls, session, device=None, configuration=None, **kwargs):
"""Create a device configuration.
Create a device configuration with the given device and
Expand All @@ -45,7 +45,7 @@ def create(cls, session, device=None, configuration=None):
any failure occurs.
"""
rels = {}
rels = kwargs.setdefault('relationships', {})
if configuration is not None:
rel = build_request_relationship(configuration._resource_type(),
configuration.id)
Expand All @@ -57,7 +57,7 @@ def create(cls, session, device=None, configuration=None):
rels['device'] = rel

return super(DeviceConfiguration, cls).create(session,
relationships=rels)
**kwargs)

def is_loaded(self):
"""Check is a device configuration is loaded.
Expand Down
7 changes: 4 additions & 3 deletions helium/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
class Label(Resource):
@classmethod
def create(cls, session,
attributes=None, sensors=None, relationships=None):
attributes=None, sensors=None, **kwargs):
if sensors is not None:
relationships = relationships or {}
relationships = kwargs.setdefault('relationships', {})
sensor_ids = [r.id for r in sensors]
relationships['sensor'] = build_request_relationship('sensor',
sensor_ids)

return super(Label, cls).create(session,
attributes=attributes,
relationships=relationships)
**kwargs)

0 comments on commit c2ba7e3

Please sign in to comment.