- def __str__(self):
- return str(self.value)
-
- def __unicode__(self):
- return unicode(self.value)
-
- def __nonzero__(self):
- return bool(self.value)
-
-
-class StringSetting(BaseSetting):
- def _parse(self, value):
- if isinstance(value, unicode):
- return value.encode('utf8')
- else:
- return str(value)
-
- def __unicode__(self):
- return unicode(self.value.decode('utf8'))
-
- def __add__(self, other):
- return "%s%s" % (unicode(self), other)
-
- def __cmp__(self, other):
- return cmp(str(self), str(other))
-
-class IntegerSetting(BaseSetting):
- def _parse(self, value):
- return int(value)
-
- def __int__(self):
- return int(self.value)
-
- def __add__(self, other):
- return int(self) + int(other)
-
- def __sub__(self, other):
- return int(self) - int(other)
-
- def __cmp__(self, other):
- return int(self) - int(other)
-
-class FloatSetting(BaseSetting):
- def _parse(self, value):
- return float(value)
-
- def __int__(self):
- return int(self.value)
-
- def __float__(self):
- return float(self.value)
-
- def __add__(self, other):
- return float(self) + float(other)
-
- def __sub__(self, other):
- return float(self) - float(other)
-
- def __cmp__(self, other):
- return float(self) - float(other)