Created
October 21, 2015 16:21
-
-
Save mekhami/3b9058d879218f4b71c2 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 clean(self): | |
| """ Validate site and people resource ids with Doorman """ | |
| if settings.FEATURE_DOORMAN_VALIDATION_ON: | |
| doorman = DoormanClient() | |
| if hasattr(self, 'site'): | |
| if not doorman.resource_exists(resource='sites', resource_id=self.site): | |
| raise ValidationError('Invalid site id: {0}'.format(self.site)) | |
| if hasattr(self, 'editor'): | |
| if not doorman.resource_exists(resource='people', resource_id=self.editor): | |
| raise ValidationError('Invalid editor id: {0}'.format(self.editor)) | |
| if hasattr(self, 'author'): | |
| if not doorman.resource_exists(resource='author-profiles', resource_id=self.author): | |
| raise ValidationError('Invalid author id: {0}'.format(self.author)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment