示例#1
0
def _create_unique_photo_path(instance, filename, path):
    if instance.photo:
        # instance.photo.delete()
        if instance.photo_s3:
            get_taskqueue().send_task(DeleteS3Task({"name":instance.photo_s3.name}),
                                      settings.QUEUENAME_SENDS3)
        instance.photo_s3 = None
        instance.photo_s3_sync = False
        get_taskqueue().send_task(SyncS3Task.from_model(instance), settings.QUEUENAME_SENDS3)
    return os.path.join(path, 
            u"%s%s" % (uuid.uuid4(), os.path.splitext(filename)[1]))
示例#2
0
 def make_icon_filepath(self, filename):
     ext = os.path.splitext(filename)[1]
     path = "users/icon/%s%s" % (self.user.id, ext)
     self.icon.storage.delete(path)
     if self.icon_s3:
         get_taskqueue().send_task(DeleteS3Task({"name":path}),
                                   settings.QUEUENAME_SENDS3)
     self.icon_s3 = None
     self.icon_s3_sync = False
     get_taskqueue().send_task(SyncS3Task.from_model(self), settings.QUEUENAME_SENDS3)
     return path
示例#3
0
 def __post_save_task__(self):
     return SyncS3Task.from_model(self), settings.QUEUENAME_SENDS3