Created
January 12, 2015 19:24
-
-
Save dstanek/63b5d217828a9a765a52 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
def _require_single_keyword_arg(self, **kwargs): | |
provided_params = [name for name, value in kwargs.iteritems() if value] | |
if not provided_params: raise VE('Something must be passed in') | |
if len(provided_params) != 1: | |
msg = _('Only a single keyword arg allowed: received %s') % ', '.join(provided_params) | |
raise exception.ValidationError(msg) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment