From fb705adc5d8af9d708dcfd11f7ac37c2ca803342 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 14:04:56 +0200 Subject: [PATCH] simplify object_id error handling Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 339591ad..eeb5799b 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -34,13 +34,12 @@ DOT_CDIST = '.cdist' class IllegalObjectIdError(cdist.Error): - def __init__(self, object_id, type_name, message=None): + def __init__(self, object_id, message=None): self.object_id = object_id - self.type_name = type_name self.message = message or 'Illegal object id' def __str__(self): - return '%s: type: %s, object_id: %s' % (self.message, self.type_name, self.object_id) + return '%s: %s' % (self.message, self.object_id) class Object(object): @@ -90,7 +89,7 @@ class Object(object): def __init__(self, cdist_type, base_path, object_id=None): if object_id and object_id.startswith('/'): - raise IllegalObjectIdError(object_id, cdist_type.name, 'object_id may not start with /') + raise IllegalObjectIdError(object_id, 'object_id may not start with /') self.type = cdist_type # instance of Type self.base_path = base_path self.object_id = object_id