~abompard/mailman/subpolicy

« back to all changes in this revision

Viewing changes to src/mailman/rest/validator.py

  • Committer: Barry Warsaw
  • Date: 2015-04-07 02:06:28 UTC
  • mfrom: (7313.2.6 lp1423756)
  • mto: This revision was merged to the branch mainline in revision 7323.
  • Revision ID: barry@list.org-20150407020628-fkwphij7to9lc8gy
 * Domains now have a list of owners, which are ``IUser`` objects, instead of
   the single ``contact_address`` they used to have.  ``IUser`` objects now
   also have a ``is_server_owner`` flag (defaulting to False) to indicate
   whether they have superuser privileges.  Give by Abhliash Raj, with fixes
   and refinements by Barry Warsaw.  (LP: #1423756)

 * Domains can now optionally be created with owners; domain owners can be
   added after the fact; domain owners can be deleted.  Also, users now have
   an ``is_server_owner`` flag as part of their representation, which defaults
   to False, and can be PUT and PATCH'd.  Given by Abhilash Raj, with fixes
   and refinements by Barry Warsaw.  (LP: #1423756)

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
    'Validator',
23
23
    'enum_validator',
24
24
    'language_validator',
 
25
    'list_of_strings_validator',
25
26
    'subscriber_validator',
26
27
    ]
27
28
 
66
67
    return getUtility(ILanguageManager)[code]
67
68
 
68
69
 
 
70
def list_of_strings_validator(values):
 
71
    """Turn a list of things into a list of unicodes."""
 
72
    for value in values:
 
73
        if not isinstance(value, str):
 
74
            raise ValueError('Expected str, got {!r}'.format(value))
 
75
    return values
 
76
 
 
77
 
69
78
 
70
79
class Validator:
71
80
    """A validator of parameter input."""