Created
May 26, 2016 05:06
-
-
Save tyler274/8e2d8a774aba5d25e98aa219d989404a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ipalib.plugins import user | |
from ipalib.parameters import Int, Str | |
from ipalib import _ | |
houses = [ | |
'Dabney', | |
'Blacker', | |
'Ricketts', | |
'Fleming', | |
'Page', | |
'Lloyd', | |
'Ruddock', | |
'Avery', | |
] | |
def validate_house(ugettext, value): | |
if value not in houses: | |
return _("Please enter one of the eight houses") | |
user.user.takes_params = user.user.takes_params + ( | |
Str('house*', validate_house, | |
cli_name='house', | |
label=_('House Membership'), | |
), | |
) | |
user.user.default_attributes.append('house') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment