Created
January 17, 2012 19:45
-
-
Save fish2000/1628428 to your computer and use it in GitHub Desktop.
This ended up being some boilerplate I had to put into all my django-imagekit forks' model fields' functions that got called on pre_save/post_save signals.
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 clear_exif_data(self, **kwargs): # signal, sender, instance | |
| """ | |
| Stores ICC profile data in the field before saving, and refreshes | |
| the profile hash if an ICCHashField has been specified. | |
| """ | |
| instance = kwargs.get('instance') | |
| logg.info("--- Clearing exif metadata from %s.%s %s" % ( | |
| instance.__class__.__name__, self.name, instance.id)) | |
| setattr(instance, self.name, None) | |
| # save if sent asynchronously | |
| dequeue_runmode = kwargs.get('dequeue_runmode', None) | |
| enqueue_runmode = kwargs.get('enqueue_runmode', None) | |
| if dequeue_runmode is not None: | |
| if not dequeue_runmode == enqueue_runmode: | |
| if dequeue_runmode == signalqueue.SQ_RUNMODES['SQ_ASYNC_DAEMON']: | |
| instance.save_base() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment