[CapWeather] browser2 adaptation : do not require an id in constructor

This commit is contained in:
Bezleputh 2014-11-03 15:29:17 +01:00 committed by Romain Bignon
commit de4a938d7e

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, unit = u''): def __init__(self, value=None, 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, low, high, text, unit): def __init__(self, date=None, 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, temp, text, unit): def __init__(self, date=None, 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, name): def __init__(self, id=None, name=None):
BaseObject.__init__(self, id) BaseObject.__init__(self, id)
self.name = name self.name = name