Juan Hernandez has uploaded a new change for review. Change subject: sdk: Don't use primitive types from the "types" module ......................................................................
sdk: Don't use primitive types from the "types" module This is one step towards adding support for Python 3. Change-Id: I95ec21418f9685f5c11e897a0840efbd4b3266a9 Related: https://bugzilla.redhat.com/1096137 Signed-off-by: Juan Hernandez <[email protected]> --- M generator/src/main/java/org/ovirt/engine/sdk/generator/python/templates/EntryPointHeadTemplate M generator/src/main/java/org/ovirt/engine/sdk/generator/python/templates/EntryPointTemplate M src/ovirtsdk/api.py M src/ovirtsdk/infrastructure/cache.py M src/ovirtsdk/infrastructure/errors.py 5 files changed, 7 insertions(+), 9 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-sdk refs/changes/25/41325/1 diff --git a/generator/src/main/java/org/ovirt/engine/sdk/generator/python/templates/EntryPointHeadTemplate b/generator/src/main/java/org/ovirt/engine/sdk/generator/python/templates/EntryPointHeadTemplate index a6430dc..e181081 100644 --- a/generator/src/main/java/org/ovirt/engine/sdk/generator/python/templates/EntryPointHeadTemplate +++ b/generator/src/main/java/org/ovirt/engine/sdk/generator/python/templates/EntryPointHeadTemplate @@ -23,7 +23,6 @@ $timestamp$ import re -import types import urlparse from ovirtsdk.infrastructure.errors import UnsecuredConnectionAttemptError diff --git a/generator/src/main/java/org/ovirt/engine/sdk/generator/python/templates/EntryPointTemplate b/generator/src/main/java/org/ovirt/engine/sdk/generator/python/templates/EntryPointTemplate index 202809c..36c6031 100644 --- a/generator/src/main/java/org/ovirt/engine/sdk/generator/python/templates/EntryPointTemplate +++ b/generator/src/main/java/org/ovirt/engine/sdk/generator/python/templates/EntryPointTemplate @@ -118,7 +118,7 @@ # If server returns no response for the root resource, this is sign # that used http protocol against SSL secured site - if type(entry_point) == types.StringType and entry_point == '': + if type(entry_point) == str and entry_point == '': raise UnsecuredConnectionAttemptError # Store entry point to the context @@ -140,5 +140,5 @@ 'persistent_auth', persistent_auth, Mode.R, - typ=types.BooleanType + typ=bool ) diff --git a/src/ovirtsdk/api.py b/src/ovirtsdk/api.py index 8fe5097..1910047 100644 --- a/src/ovirtsdk/api.py +++ b/src/ovirtsdk/api.py @@ -20,10 +20,9 @@ ############ GENERATED CODE ############ ######################################## -'''Generated at: 2015-05-22 10:36:39.000813''' +'''Generated at: 2015-05-22 11:15:37.000198''' import re -import types import urlparse from ovirtsdk.infrastructure.errors import UnsecuredConnectionAttemptError @@ -189,7 +188,7 @@ # If server returns no response for the root resource, this is sign # that used http protocol against SSL secured site - if type(entry_point) == types.StringType and entry_point == '': + if type(entry_point) == str and entry_point == '': raise UnsecuredConnectionAttemptError # Store entry point to the context @@ -211,7 +210,7 @@ 'persistent_auth', persistent_auth, Mode.R, - typ=types.BooleanType + typ=bool ) self.bookmarks = Bookmarks(self.id) self.capabilities = Capabilities(self.id) diff --git a/src/ovirtsdk/infrastructure/cache.py b/src/ovirtsdk/infrastructure/cache.py index 120c7db..7533ba4 100644 --- a/src/ovirtsdk/infrastructure/cache.py +++ b/src/ovirtsdk/infrastructure/cache.py @@ -75,7 +75,7 @@ raise ImmutableError(key) elif typ: try: - if typ == types.BooleanType and type(val) == types.StringType \ + if typ == bool and type(val) == str \ and val not in ['True', 'False']: raise ValueError(val) self.__cache[key] = Item(typ(val), mode) diff --git a/src/ovirtsdk/infrastructure/errors.py b/src/ovirtsdk/infrastructure/errors.py index f86482f..5553add 100644 --- a/src/ovirtsdk/infrastructure/errors.py +++ b/src/ovirtsdk/infrastructure/errors.py @@ -59,7 +59,7 @@ except: f_detail = '' - if types.StringType != type(f_detail): + if str != type(f_detail): if isinstance(f_detail, params.Action) and f_detail.fault is not None: detail = f_detail.fault.detail.lstrip() else: -- To view, visit https://gerrit.ovirt.org/41325 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I95ec21418f9685f5c11e897a0840efbd4b3266a9 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine-sdk Gerrit-Branch: master Gerrit-Owner: Juan Hernandez <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
