Adding error messages to slice_model
Change-Id: I750ec67cfd704dc17a89218389bdf210aaade0e9
diff --git a/xos/core/models/attic/slice_model.py b/xos/core/models/attic/slice_model.py
index e296429..db53e11 100644
--- a/xos/core/models/attic/slice_model.py
+++ b/xos/core/models/attic/slice_model.py
@@ -8,13 +8,13 @@
site = Site.objects.get(id=self.site.id)
# allow preexisting slices to keep their original name for now
if not self.id and not self.name.startswith(site.login_base):
- raise XOSValidationError('slice name must begin with %s' % site.login_base)
+ raise XOSValidationError('slice name must begin with %s' % site.login_base, {'name' : 'slice name must begin with %s' % site.login_base})
if self.name == site.login_base+"_":
- raise XOSValidationError('slice name is too short')
+ raise XOSValidationError('slice name is too short', {'name': 'slice name is too short'})
if " " in self.name:
- raise XOSValidationError('slice name must not contain spaces')
+ raise XOSValidationError('slice name must not contain spaces', {'name': 'slice name must not contain spaces'})
# set creator on first save
if not self.creator and hasattr(self, 'caller'):
@@ -29,10 +29,11 @@
# himeself on a new slice object.
pass
else:
- raise PermissionDenied("Insufficient privileges to change slice creator")
+ raise PermissionDenied("Insufficient privileges to change slice creator",
+ {'creator': "Insufficient privileges to change slice creator"})
if not self.creator:
- raise XOSValidationError('slice has no creator')
+ raise XOSValidationError('slice has no creator', {'creator': 'slice has no creator'})
if self.network=="Private Only":
# "Private Only" was the default from the old Tenant View