- Timestamp:
- May 26, 2010 3:35:49 AM (15 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
- Children:
- 4e00f7c
- Parents:
- cf00ddd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/topdl.py
rcf00ddd r21b5434 26 26 else: return [ a ] 27 27 28 @staticmethod 29 def init_string(s): 30 """ 31 Force a string coercion for everything but a None. 32 """ 33 if s is not None: return "%s" % s 34 else: return None 35 28 36 def remove_attribute(self, key): 29 37 to_del = None … … 62 70 class Attribute(base): 63 71 def __init__(self, attribute, value): 64 self.attribute = "%s" % attribute65 self.value = "%s" % value72 self.attribute = self.init_string(attribute) 73 self.value = self.init_string(value) 66 74 67 75 def clone(self): … … 74 82 def __init__(self, rate, kind): 75 83 self.rate = float(rate) 76 self.kind = "%s" % kind84 self.kind = self.init_string(kind) 77 85 78 86 def clone(self): … … 85 93 def __init__(self, time, kind): 86 94 self.time = float(time) 87 self.kind = "%s" % kind95 self.kind = self.init_string(kind) 88 96 89 97 def clone(self): … … 95 103 class Substrate(base): 96 104 def __init__(self, name, capacity=None, latency=None, attribute=[]): 97 self.name = "%s" % name105 self.name = self.init_string(name) 98 106 self.capacity = self.init_class(Capacity, capacity) 99 107 self.latency = self.init_class(Latency, latency) … … 126 134 class CPU(base): 127 135 def __init__(self, type, attribute=[]): 128 self.type = "%s" % type136 self.type = self.init_string(type) 129 137 self.attribute = [ self.init_class(Attribute, a) for a in \ 130 138 self.make_list(attribute) ] … … 143 151 def __init__(self, amount, persistence, attribute=[]): 144 152 self.amount = float(amount) 145 self.presistence = "%s" % persistence153 self.presistence = self.init_string(persistence) 146 154 self.attribute = [ self.init_class(Attribute, a) \ 147 155 for a in self.make_list(attribute) ] … … 160 168 def __init__(self, name=None, version=None, distribution=None, 161 169 distributionversion=None, attribute=[]): 162 self.name = "%s" % name163 self.version = "%s" % version164 self.distribution = "%s" % distribution165 self.distributionversion = "%s" % distributionversion170 self.name = self.init_string(name) 171 self.version = self.init_string(version) 172 self.distribution = self.init_string(distribution) 173 self.distributionversion = self.init_string(distributionversion) 166 174 self.attribute = [ self.init_class(Attribute, a) \ 167 175 for a in self.make_list(attribute) ] … … 186 194 class Software(base): 187 195 def __init__(self, location, install=None, attribute=[]): 188 self.location = "%s" % location189 self.install = "%s" % install196 self.location = self.init_string(location) 197 self.install = self.init_string(install) 190 198 self.attribute = [ self.init_class(Attribute, a)\ 191 199 for a in self.make_list(attribute) ] … … 205 213 def __init__(self, substrate, name=None, capacity=None, latency=None, 206 214 attribute=[], element=None): 207 self.name = "%s" % name 215 self.name = self.init_string(name) 216 208 217 self.substrate = self.make_list(substrate) 209 218 self.capacity = self.init_class(Capacity, capacity) … … 239 248 kerberosUsername=None): 240 249 self.fedid=fedid_class(hexstr="%s" % fedid) 241 self.uuid = "%s" % uuid242 self.uri = "%s" % uri243 self.localname = "%s" % localname244 self.kerberosUsername = "%s" % kerberosUsername250 self.uuid = self.init_string(uuid) 251 self.uri = self.init_string(uri) 252 self.localname =self.init_string( localname) 253 self.kerberosUsername = self.init_string(kerberosUsername) 245 254 246 255 def clone(self): … … 263 272 i.element = self 264 273 265 self.name = "%s" % name274 self.name = self.init_string(name) 266 275 self.cpu = [ self.init_class(CPU, c) for c in self.make_list(cpu) ] 267 276 self.os = [ self.init_class(OperatingSystem, c) \ … … 308 317 class Testbed(base): 309 318 def __init__(self, uri, type, interface=[], attribute=[]): 310 self.uri = "%s" % uri311 self.type = "%s" % type319 self.uri = self.init_string(uri) 320 self.type = self.init_string(type) 312 321 self.interface = [ self.init_class(Interface, c) \ 313 322 for c in self.make_list(interface) ] … … 333 342 def __init__(self, id, type, uri, interface=[], attribute=[]): 334 343 self.id = self.init_class(ID, id) 335 self.type = "%s" % type336 self.uri = "%s" % uri344 self.type = self.init_string(type) 345 self.uri = self.init_string(uri) 337 346 self.interface = [ self.init_class(Interface, c) \ 338 347 for c in self.make_list(interface) ]
Note: See TracChangeset
for help on using the changeset viewer.