the default ID is an empty string, not None

This commit is contained in:
Romain Bignon 2014-11-05 08:21:31 +01:00
commit 75bfb5a38a

View file

@ -32,7 +32,7 @@ class Temperature(BaseObject):
value = FloatField('Temperature value') value = FloatField('Temperature value')
unit = StringField('Input unit') unit = StringField('Input unit')
def __init__(self, value=None, unit = u''): def __init__(self, value='', unit = u''):
BaseObject.__init__(self, value) BaseObject.__init__(self, value)
self.value = value self.value = value
if unit not in [u'C', u'F']: if unit not in [u'C', u'F']:
@ -69,7 +69,7 @@ class Forecast(BaseObject):
high = Field('High temperature', Temperature) high = Field('High temperature', Temperature)
text = StringField('Comment on forecast') text = StringField('Comment on forecast')
def __init__(self, date=None, low=None, high=None, text=None, unit=None): def __init__(self, date='', low=None, high=None, text=None, unit=None):
BaseObject.__init__(self, unicode(date)) BaseObject.__init__(self, unicode(date))
self.date = date self.date = date
self.low = Temperature(low, unit) self.low = Temperature(low, unit)
@ -85,7 +85,7 @@ class Current(BaseObject):
text = StringField('Comment about current weather') text = StringField('Comment about current weather')
temp = Field('Current temperature', Temperature) temp = Field('Current temperature', Temperature)
def __init__(self, date=None, temp=None, text=None, unit=None): def __init__(self, date='', temp=None, text=None, unit=None):
BaseObject.__init__(self, unicode(date)) BaseObject.__init__(self, unicode(date))
self.date = date self.date = date
self.text = text self.text = text
@ -98,7 +98,7 @@ class City(BaseObject):
""" """
name = StringField('Name of city') name = StringField('Name of city')
def __init__(self, id=None, name=None): def __init__(self, id='', name=None):
BaseObject.__init__(self, id) BaseObject.__init__(self, id)
self.name = name self.name = name