def delete_preview_files(id, **kw): log.info('[1@None] Removing preview with id of %s.' % id) p = Preview(id=id) for f in (p.thumbnail_path, p.image_path): try: storage.delete(f) except Exception, e: log.error('Error deleting preview file (%s): %s' % (f, e))
def fake_object(self, data): """Create a fake instance of Preview from ES data.""" obj = Preview(id=data['id']) # Attach base attributes that have the same name/format in ES and in # the model. self._attach_fields(obj, data, ('modified', )) # Attach translations. self._attach_translations(obj, data, self.translated_fields) return obj
def delete_preview_files(id, **kw): Preview.delete_preview_files(sender=None, instance=Preview(id=id))
def delete_preview_files(id, **kw): Preview.delete_preview_files(sender=None, instance=Preview(id=id))