Date: Sun, 8 Jul 2007 06:08:28 GMT From: Andrew Turner <andrew@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 123089 for review Message-ID: <200707080608.l6868SAm039571@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=123089 Change 123089 by andrew@andrew_hermies on 2007/07/08 06:07:50 Add classes to handle facund objects Add a class to be used for calls Affected files ... .. //depot/projects/soc2007/andrew-update/frontend/facund/call.py#1 add .. //depot/projects/soc2007/andrew-update/frontend/facund/data.py#2 edit Differences ... ==== //depot/projects/soc2007/andrew-update/frontend/facund/data.py#2 (text+ko) ==== @@ -28,7 +28,7 @@ #TODO: Create an exception class(es) for bad data, etc -class Object(object): +class Object: def __init__(self, type): self.__parent = None self.__data = None @@ -54,18 +54,22 @@ return self.__data class Bool(Object): - def __init__(self): + def __init__(self, data = None): Object.__init__(self, "bool") + if data is not None: + self.setData(data) def setData(self, data): data = str(data).lower() Object.setData(self, data == 'true') class Int(Object): - def __init__(self): + def __init__(self, data = None): Object.__init__(self, "int") self.__min = (-0x7fffffff-1) self.__max = (0x7fffffff) + if data is not None: + self.setData(data) def setData(self, data): data = int(data) @@ -74,10 +78,12 @@ Object.setData(self, int(data)) class UnsignedInt(Object): - def __init__(self): + def __init__(self, data = None): Object.__init__(self, "unsigned int") self.__min = 0 self.__max = (0xffffffff) + if data is not None: + self.setData(data) def setData(self, data): data = int(data) @@ -86,8 +92,10 @@ Object.setData(self, int(data)) class String(Object): - def __init__(self): + def __init__(self, data = None): Object.__init__(self, "string") + if data is not None: + self.setData(data) def setData(self, data): Object.setData(self, str(data))
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200707080608.l6868SAm039571>