X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FParameter.py;h=9ae648692ef6bef6da70af201b551de0b67d34f4;hb=f5c56ffecbabdf45ba3f70433842a2c896ec7b7d;hp=5dab3639b1e65fe6dca2876b34b91eb1d611f4b2;hpb=49545a0895dd600f3323872e162d6ebbb483e3b1;p=plcapi.git diff --git a/PLC/Parameter.py b/PLC/Parameter.py index 5dab363..9ae6486 100644 --- a/PLC/Parameter.py +++ b/PLC/Parameter.py @@ -4,7 +4,7 @@ # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University # -# $Id: Parameter.py,v 1.1 2006/09/06 15:36:07 mlhuang Exp $ +# $Id: Parameter.py,v 1.3 2006/10/02 18:32:31 mlhuang Exp $ # class Parameter: @@ -14,9 +14,28 @@ class Parameter: sub-parameters (i.e., dict fields). """ - def __init__(self, type, doc = "", min = None, max = None, optional = True, default = None): - (self.type, self.doc, self.min, self.max, self.optional, self.default) = \ - (type, doc, min, max, optional, default) + def __init__(self, type, doc = "", + min = None, max = None, + optional = None, + ro = False): + # Basic type of the parameter. May be a builtin type or Mixed. + self.type = type + + # Documentation string for the parameter + self.doc = doc + + # Basic value checking. For numeric types, the minimum and + # maximum possible values, inclusive. For string types, the + # minimum and maximum possible UTF-8 encoded byte lengths. + self.min = min + self.max = max + + # Whether the sub-parameter is optional or not. If None, + # unknown whether it is optional. + self.optional = optional + + # Whether the DB field is read-only. + self.ro = ro def __repr__(self): return repr(self.type)