Added check for objects without OID
authorThierry Florac <thierry.florac@onf.fr>
Tue, 28 Nov 2017 12:06:24 +0100
changeset 23 73120848db81
parent 22 fe6d6f66a0d2
child 24 e0f654cbdb35
Added check for objects without OID
src/pyams_sequence/utility.py
--- a/src/pyams_sequence/utility.py	Fri Nov 10 13:31:56 2017 +0100
+++ b/src/pyams_sequence/utility.py	Tue Nov 28 12:06:24 2017 +0100
@@ -150,16 +150,16 @@
         return '{prefix}{obj_prefix}{zeros}{hex_id}'.format(prefix=self.prefix or '',
                                                             obj_prefix=obj_prefix or '',
                                                             zeros='0' * (self.hex_oid_length - len(oid)),
-                                                            hex_id=oid)
+                                                            hex_id=oid or 0)
 
     def get_short_oid(self, oid, obj_prefix=None):
         return '{prefix}{obj_prefix} {hex_id:x}'.format(prefix=self.prefix or '',
                                                         obj_prefix=obj_prefix or '',
-                                                        hex_id=oid)
+                                                        hex_id=oid or 0)
 
     def get_base_oid(self, oid, obj_prefix=None):
         return '{obj_prefix} {hex_id:x}'.format(obj_prefix=obj_prefix or '',
-                                                hex_id=oid)
+                                                hex_id=oid or 0)
 
     def get_internal_id(self, oid):
         if oid.startswith('+'):