Created
December 5, 2011 19:43
-
-
Save reedobrien/1434982 to your computer and use it in GitHub Desktop.
This file contains 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 is_really_image(node, value): | |
request = get_current_request() | |
tmpstore = MongoTmpStore(request) | |
image_uid = value['uid'] | |
fp = tmpstore[image_uid]['fp'] | |
fp.seek(0) | |
try: | |
Image.open(fp) | |
except IOError: | |
raise colander.Invalid( | |
node, | |
'"%s" is not an image file' % value['filename']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment