Changeset da2208a


Ignore:
Timestamp:
May 25, 2010 11:05:21 AM (15 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
Children:
d3c8759
Parents:
b53e1fc
Message:

Coerce all attributes that we think are strings into being strings in the
constructors. We've seen cases, especically when constructing topologies from
ZSI calls (SOAP) where things that look like strings but are unpicklable show
up.

Bottom line - if we expect 'em to be strings we should force 'em to be to the
extent we can.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/topdl.py

    rb53e1fc rda2208a  
    33import re
    44import xml.parsers.expat
     5
     6from fedid import fedid as fedid_class
    57
    68class base:
     
    6062class Attribute(base):
    6163    def __init__(self, attribute, value):
    62         self.attribute = attribute
    63         self.value = value
     64        self.attribute = "%s" % attribute
     65        self.value = "%s" % value
    6466
    6567    def clone(self):
     
    7274    def __init__(self, rate, kind):
    7375        self.rate = float(rate)
    74         self.kind = kind
     76        self.kind = "%s" % kind
    7577
    7678    def clone(self):
     
    8385    def __init__(self, time, kind):
    8486        self.time = float(time)
    85         self.kind = kind
     87        self.kind = "%s" % kind
    8688
    8789    def clone(self):
     
    9395class Substrate(base):
    9496    def __init__(self, name, capacity=None, latency=None, attribute=[]):
    95         self.name = name
     97        self.name = "%s" % name
    9698        self.capacity = self.init_class(Capacity, capacity)
    9799        self.latency = self.init_class(Latency, latency)
     
    124126class CPU(base):
    125127    def __init__(self, type, attribute=[]):
    126         self.type = type
     128        self.type = "%s" % type
    127129        self.attribute = [ self.init_class(Attribute, a) for a in \
    128130                self.make_list(attribute) ]
     
    141143    def __init__(self, amount, persistence, attribute=[]):
    142144        self.amount = float(amount)
    143         self.presistence = persistence
     145        self.presistence = "%s" % persistence
    144146        self.attribute = [ self.init_class(Attribute, a) \
    145147                for a in self.make_list(attribute) ]
     
    158160    def __init__(self, name=None, version=None, distribution=None,
    159161            distributionversion=None, attribute=[]):
    160         self.name = name
    161         self.version = version
    162         self.distribution = distribution
    163         self.distributionversion = distributionversion
     162        self.name = "%s" % name
     163        self.version = "%s" % version
     164        self.distribution = "%s" % distribution
     165        self.distributionversion = "%s" % distributionversion
    164166        self.attribute = [ self.init_class(Attribute, a) \
    165167                for a in self.make_list(attribute) ]
     
    184186class Software(base):
    185187    def __init__(self, location, install=None, attribute=[]):
    186         self.location = location
    187         self.install = install
     188        self.location = "%s" % location
     189        self.install = "%s" % install
    188190        self.attribute = [ self.init_class(Attribute, a)\
    189191                for a in self.make_list(attribute) ]
     
    203205    def __init__(self, substrate, name=None, capacity=None, latency=None,
    204206            attribute=[], element=None):
    205         self.name = name
     207        self.name = "%s" % name
    206208        self.substrate = self.make_list(substrate)
    207209        self.capacity = self.init_class(Capacity, capacity)
     
    236238    def __init__(self, fedid=None, uuid=None, uri=None, localname=None,
    237239            kerberosUsername=None):
    238         self.fedid=fedid
    239         self.uuid = uuid
    240         self.uri = uri
    241         self.localname = localname
    242         self.kerberosUsername = kerberosUsername
     240        self.fedid=fedid_class(hexstr="%s" % fedid)
     241        self.uuid = "%s" % uuid
     242        self.uri = "%s" % uri
     243        self.localname ="%s" % localname
     244        self.kerberosUsername = "%s" % kerberosUsername
    243245
    244246    def clone(self):
     
    261263            i.element = self
    262264
    263         self.name = name
     265        self.name = "%s" % name
    264266        self.cpu = [ self.init_class(CPU, c)  for c in self.make_list(cpu) ]
    265267        self.os = [ self.init_class(OperatingSystem, c) \
     
    306308class Testbed(base):
    307309    def __init__(self, uri, type, interface=[], attribute=[]):
    308         self.uri = uri
    309         self.type = type
     310        self.uri = "%s" % uri
     311        self.type = "%s" % type
    310312        self.interface = [ self.init_class(Interface, c) \
    311313                for c in self.make_list(interface) ]
     
    331333    def __init__(self, id, type, uri, interface=[], attribute=[]):
    332334        self.id = self.init_class(ID, id)
    333         self.type = type
    334         self.uri = uri
     335        self.type = "%s" % type
     336        self.uri = "%s" % uri
    335337        self.interface = [ self.init_class(Interface, c) \
    336338                for c in self.make_list(interface) ]
Note: See TracChangeset for help on using the changeset viewer.