From 2d7d047cbf9375a4c75196f13ac1e0c439ae9e8b Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Tue, 27 Jul 2010 16:35:23 -0400 Subject: Add optional error message to pattern validator The pattern validator by default displays the pattern that is being matched against. This isn't helpful, particularly for very hairy patterns. This adds a new parameter, pattern_errmsg, that is displayed on errors if set. ticket #11 --- ipalib/plugins/group.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'ipalib/plugins/group.py') diff --git a/ipalib/plugins/group.py b/ipalib/plugins/group.py index 2558c38a..4fd630d4 100644 --- a/ipalib/plugins/group.py +++ b/ipalib/plugins/group.py @@ -89,6 +89,9 @@ class group(LDAPObject): takes_params = ( Str('cn', + pattern='^[a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,30}[a-zA-Z0-9_.$-]?$', + pattern_errmsg='may only include letters, numbers, _, -, . and $', + maxlength=33, cli_name='name', label=_('Group name'), primary_key=True, -- cgit