From owner-p4-projects@FreeBSD.ORG Sun Jul 8 06:08:29 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5E49016A469; Sun, 8 Jul 2007 06:08:29 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 321E516A421 for ; Sun, 8 Jul 2007 06:08:29 +0000 (UTC) (envelope-from andrew@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 1E4FD13C448 for ; Sun, 8 Jul 2007 06:08:29 +0000 (UTC) (envelope-from andrew@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l6868Tho039574 for ; Sun, 8 Jul 2007 06:08:29 GMT (envelope-from andrew@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l6868SAm039571 for perforce@freebsd.org; Sun, 8 Jul 2007 06:08:28 GMT (envelope-from andrew@freebsd.org) Date: Sun, 8 Jul 2007 06:08:28 GMT Message-Id: <200707080608.l6868SAm039571@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to andrew@freebsd.org using -f From: Andrew Turner To: Perforce Change Reviews Cc: Subject: PERFORCE change 123089 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2007 06:08:29 -0000 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))