From f866368e859744e49f33edf7210677922b6c2259 Mon Sep 17 00:00:00 2001 From: PCoder Date: Fri, 16 Mar 2018 09:35:13 +0100 Subject: [PATCH] Replace other occurrences of strip('public-') with lstrip('public-') --- opennebula_api/serializers.py | 6 +++--- opennebula_api/tests.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/opennebula_api/serializers.py b/opennebula_api/serializers.py index cc52a15e..79f37ecd 100644 --- a/opennebula_api/serializers.py +++ b/opennebula_api/serializers.py @@ -36,7 +36,7 @@ class VirtualMachineTemplateSerializer(serializers.Serializer): return int(obj.template.memory) / 1024 def get_name(self, obj): - return obj.name.strip('public-') + return obj.name.lstrip('public-') class VirtualMachineSerializer(serializers.Serializer): @@ -133,7 +133,7 @@ class VirtualMachineSerializer(serializers.Serializer): def get_configuration(self, obj): template_id = obj.template.template_id template = OpenNebulaManager().get_template(template_id) - return template.name.strip('public-') + return template.name.lstrip('public-') def get_ipv4(self, obj): """ @@ -162,7 +162,7 @@ class VirtualMachineSerializer(serializers.Serializer): return '-' def get_name(self, obj): - return obj.name.strip('public-') + return obj.name.lstrip('public-') class VMTemplateSerializer(serializers.Serializer): diff --git a/opennebula_api/tests.py b/opennebula_api/tests.py index 234e0c16..da904576 100644 --- a/opennebula_api/tests.py +++ b/opennebula_api/tests.py @@ -145,5 +145,5 @@ class VirtualMachineSerializerTestCase(TestCase): for vm in self.manager.get_vms(): serialized = VirtualMachineSerializer(vm) - self.assertEqual(serialized.data.get('name'), vm.name.strip('public-')) + self.assertEqual(serialized.data.get('name'), vm.name.lstrip('public-')) break