From: Thierry Parmentelat Date: Thu, 8 Oct 2015 15:32:43 +0000 (+0200) Subject: minimal changes to have this imported by nepi in py3 X-Git-Tag: sfa-3.1-19~3 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=78cfac29ad0d139fd2a909375bb2ea7d46c305ee;hp=4ef76bd85ea24906c4ebb580c896fe1084d6ba88;p=sfa.git minimal changes to have this imported by nepi in py3 --- diff --git a/sfa/client/sfi.py b/sfa/client/sfi.py index be94f820..8964768d 100644 --- a/sfa/client/sfi.py +++ b/sfa/client/sfi.py @@ -990,7 +990,7 @@ use this if you mean an authority instead""") try: list = self.registry().List(hrn, self.my_credential_string, options) except IndexError: - raise Exception, "Not enough parameters for the 'list' command" + raise Exception("Not enough parameters for the 'list' command") # filter on person, slice, site, node, etc. # This really should be in the self.filter_records funct def comment... @@ -1104,7 +1104,7 @@ use this if you mean an authority instead""") elif record_dict['type'] in ['slice']: try: cred = self.slice_credential_string(record_dict['hrn']) - except ServerException, e: + except ServerException as e: # XXX smbaker -- once we have better error return codes, update this # to do something better than a string compare if "Permission error" in e.args[0]: diff --git a/sfa/rspecs/rspec.py b/sfa/rspecs/rspec.py index 635ea23a..372a8352 100755 --- a/sfa/rspecs/rspec.py +++ b/sfa/rspecs/rspec.py @@ -1,4 +1,7 @@ #!/usr/bin/python + +from __future__ import print_function + from datetime import datetime, timedelta from sfa.util.xml import XML, XpathFilter @@ -133,7 +136,7 @@ if __name__ == '__main__': input = sys.argv[1] with open(input) as f: rspec = RSpec(f.read()) - print rspec + print(rspec) # rspec.register_rspec_element(RSpecElements.NETWORK, 'network', '//network') # rspec.register_rspec_element(RSpecElements.NODE, 'node', '//node') # print rspec.get(RSpecElements.NODE)[0] diff --git a/sfa/util/xml.py b/sfa/util/xml.py index ba324c7b..f46443a8 100755 --- a/sfa/util/xml.py +++ b/sfa/util/xml.py @@ -153,7 +153,7 @@ class XmlElement: # are redirected on self.element def __getattr__ (self, name): if not hasattr(self.element, name): - raise AttributeError, name + raise AttributeError(name) return getattr(self.element, name) class XML: @@ -182,7 +182,7 @@ class XML: # 'rspec' file doesnt exist. 'rspec' is proably an xml string try: tree = etree.parse(StringIO(xml), parser) - except Exception, e: + except Exception as e: raise InvalidXML(str(e)) root = tree.getroot() self.namespaces = dict(root.nsmap)