Skip to content
This repository was archived by the owner on Jun 7, 2021. It is now read-only.

Commit 7d6ec61

Browse files
authored
Use title instead of name for things. (#55)
1 parent 65d467c commit 7d6ec61

3 files changed

Lines changed: 18 additions & 11 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
## [Unreleased]
44
### Added
55
- Ability to set a base URL path on server.
6+
### Changed
7+
- Things now use `title` rather than `name`.
8+
9+
## [0.11.3] - 2019-04-10
10+
### Changed
11+
- Simpler dependencies with no native requirements.
612

713
## [0.11.2] - 2019-03-11
814
### Added
@@ -22,8 +28,9 @@
2228
### Changed
2329
- Property, Action, and Event description now use `links` rather than `href`. - [Spec PR](https://github.com/mozilla-iot/wot/pull/119)
2430

25-
[Unreleased]: https://github.com/mozilla-iot/webthing-python/compare/v0.11.2...HEAD
26-
[0.11.1]: https://github.com/mozilla-iot/webthing-python/compare/v0.11.1...v0.11.2
31+
[Unreleased]: https://github.com/mozilla-iot/webthing-python/compare/v0.11.3...HEAD
32+
[0.11.3]: https://github.com/mozilla-iot/webthing-python/compare/v0.11.2...v0.11.3
33+
[0.11.2]: https://github.com/mozilla-iot/webthing-python/compare/v0.11.1...v0.11.2
2734
[0.11.1]: https://github.com/mozilla-iot/webthing-python/compare/v0.11.0...v0.11.1
2835
[0.11.0]: https://github.com/mozilla-iot/webthing-python/compare/v0.10.0...v0.11.0
2936
[0.10.0]: https://github.com/mozilla-iot/webthing-python/compare/v0.9.2...v0.10.0

webthing/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def get_things(self):
4141

4242
def get_name(self):
4343
"""Get the mDNS server name."""
44-
return self.thing.name
44+
return self.thing.title
4545

4646

4747
class MultipleThings:

webthing/thing.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
class Thing:
1010
"""A Web Thing."""
1111

12-
def __init__(self, name, type_=[], description=''):
12+
def __init__(self, title, type_=[], description=''):
1313
"""
1414
Initialize the object.
1515
16-
name -- the thing's name
16+
title -- the thing's title
1717
type_ -- the thing's type(s)
1818
description -- description of the thing
1919
"""
@@ -22,7 +22,7 @@ def __init__(self, name, type_=[], description=''):
2222

2323
self.context = 'https://iot.mozilla.org/schemas'
2424
self.type = type_
25-
self.name = name
25+
self.title = title
2626
self.description = description
2727
self.properties = {}
2828
self.available_actions = {}
@@ -40,7 +40,7 @@ def as_thing_description(self):
4040
Returns the state as a dictionary.
4141
"""
4242
thing = {
43-
'name': self.name,
43+
'title': self.title,
4444
'href': self.href_prefix if self.href_prefix else '/',
4545
'@context': self.context,
4646
'@type': self.type,
@@ -127,13 +127,13 @@ def set_ui_href(self, href):
127127
"""
128128
self.ui_href = href
129129

130-
def get_name(self):
130+
def get_title(self):
131131
"""
132-
Get the name of the thing.
132+
Get the title of the thing.
133133
134-
Returns the name as a string.
134+
Returns the title as a string.
135135
"""
136-
return self.name
136+
return self.title
137137

138138
def get_context(self):
139139
"""

0 commit comments

Comments
 (0)