Ejemplo n.º 1
0
    def get_image(uid, callback=None):

        profilepic = ProfileImage.objects(owner=uid).first()
        if profilepic == None:
            profilepic = ProfileImage.objects(id=uid).first()
        if callback != None:
            return callback(profilepic)
        return profilepic
Ejemplo n.º 2
0
    def get_image(uid,callback=None):

        profilepic = ProfileImage.objects(owner=uid).first()
        if profilepic == None:
            profilepic = ProfileImage.objects(id=uid).first()
        if callback != None:
            return callback(profilepic)
        return profilepic
Ejemplo n.º 3
0
 def save_profile_image(uid, owner, image, callback=None):
     image = cStringIO.StringIO(base64.b64decode(image))
     cur_img = ProfileImage.objects(owner=uid).first()
     if cur_img != None:
         if image != None:
             cur_img.image.replace(image, filename=owner.username)
             cur_img.save()
             user = Tag.objects(id=uid).first()
             user.profile_img = cur_img
             user.save()
     else:
         if image != None:
             cur_img = ProfileImage(owner=uid)
             cur_img.image.put(image, filename=owner.username)
             cur_img.save()
             user = Tag.objects(id=uid).first()
             user.profile_img = cur_img
             user.save()
     if callback != None:
         return callback(cur_img)
     return cur_img
Ejemplo n.º 4
0
 def save_profile_image(uid,owner,image,callback=None):
         image = cStringIO.StringIO(base64.b64decode(image))
         cur_img = ProfileImage.objects(owner=uid).first()
         if cur_img != None:
             if image != None:
                 cur_img.image.replace(image,filename=owner.username)
                 cur_img.save()
                 user = Tag.objects(id=uid).first()
                 user.profile_img = cur_img
                 user.save()
         else:
             if image != None:
                 cur_img = ProfileImage(owner=uid)
                 cur_img.image.put(image,filename=owner.username)
                 cur_img.save()
                 user = Tag.objects(id=uid).first()
                 user.profile_img = cur_img
                 user.save()
         if callback != None:
             return callback(cur_img)
         return cur_img
Ejemplo n.º 5
0
 def _delete_user(user, callback=None):
     user.delete()
     ProfileImage.objects(owner=user.id).delete()
     if callback != None:
         return callback(user)
     return user