Skip to content

Commit b5590d1

Browse files
committed
Allow sensor descriptions with a length of zero.
But don't currently force these to None
1 parent a4cf3af commit b5590d1

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

model.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ class Responder(db.Model):
5858
manufacturer = db.ReferenceProperty(Manufacturer, required=True)
5959
# The Device Model ID field from DEVICE_INFO
6060
device_model_id = db.IntegerProperty()
61-
# The DEVICE_MODEL_DESCRIPTION
61+
# Description can't be required, as DEVICE_MODEL_DESCRIPTION is not a
62+
# mandatory PID.
6263
model_description = db.StringProperty(default=None)
6364
# The product category
6465
product_category = db.ReferenceProperty(ProductCategory,
@@ -100,7 +101,10 @@ class SoftwareVersion(db.Model):
100101
"""Represents a particular software version on a responder."""
101102
# Version id
102103
version_id = db.IntegerProperty(required=True)
103-
# Version label
104+
# Version label should be required, as SOFTWARE_VERSION_LABEL is a mandatory
105+
# PID but we've had real world devices without it, or there could be issues
106+
# with their implementation such as it being empty (which App Engine treats
107+
# as not present)
104108
label = db.StringProperty(default=None)
105109
# supported params
106110
supported_parameters = db.ListProperty(int)
@@ -127,7 +131,11 @@ class ResponderPersonality(db.Model):
127131

128132
class ResponderSensor(db.Model):
129133
"""Represents a Sensor on a responder."""
130-
description = db.StringProperty(required=True)
134+
# Sensor description should be required, as the description field is part of
135+
# the SENSOR_DEFINITION PID but there may be real world devices with issues
136+
# with their implementation such as it being empty (which App Engine treats
137+
# as not present)
138+
description = db.StringProperty(default=None)
131139
index = db.IntegerProperty(required=True)
132140
type = db.IntegerProperty(required=True)
133141
supports_min_max_recording = db.BooleanProperty()

0 commit comments

Comments
 (0)