From 0082b7f07cd821b80f24fb8d23524706bba531d9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 14 Feb 2012 12:41:13 +0100 Subject: [PATCH] allow objects to start with /, but not to contain //; sanitise after validation Signed-off-by: Nico Schottelius --- lib/cdist/core/cdist_object.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/cdist/core/cdist_object.py b/lib/cdist/core/cdist_object.py index 9937c823..e12bcfbd 100644 --- a/lib/cdist/core/cdist_object.py +++ b/lib/cdist/core/cdist_object.py @@ -102,8 +102,6 @@ class CdistObject(object): """Validate the given object_id and raise IllegalObjectIdError if it's not valid. """ if self.object_id: - if self.object_id.startswith('/'): - raise IllegalObjectIdError(self.object_id, 'object_id may not start with /') if OBJECT_MARKER in self.object_id.split(os.sep): raise IllegalObjectIdError(self.object_id, 'object_id may not contain \'%s\'' % OBJECT_MARKER) if '//' in self.object_id: @@ -119,8 +117,8 @@ class CdistObject(object): self.base_path = base_path self.object_id = object_id - self.sanitise_object_id() self.validate_object_id() + self.sanitise_object_id() self.name = self.join_name(self.cdist_type.name, self.object_id) self.path = os.path.join(self.cdist_type.path, self.object_id, OBJECT_MARKER)