do not fail validation on empty object_id

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
Nico Schottelius 2012-02-13 10:38:36 +01:00
parent a8e9b7feed
commit 8f75a9133f

View file

@ -166,13 +166,15 @@ class CdistObject(object):
Remove leading and trailing slash (one only)
"""
# Remove leading slash
if self.object_id[0] == '/':
self.object_id = self.object_id[1:]
# Allow empty object id for singletons
if self.object_id:
# Remove leading slash
if self.object_id[0] == '/':
self.object_id = self.object_id[1:]
# Remove trailing slash
if self.object_id[-1] == '/':
self.object_id = self.object_id[:-1]
# Remove trailing slash
if self.object_id[-1] == '/':
self.object_id = self.object_id[:-1]
# FIXME: still needed?
@property