def tagimage(self, imageurl, pageid, latcoord, longcoord, hood, username): imageurl = util.convertimageurl(imageurl) query = db.GqlQuery("SELECT * FROM ImageModel where imageurl = :1", imageurl) image = query.get() if image is None: image = ImageModel(usernameupdated=username, imageurl=imageurl, pageid=int(pageid), latcoord=latcoord, longcoord=longcoord, neighborhood=hood) else: image.usernameupdated = username image.imageurl = imageurl image.pageid = int(pageid) image.latcoord = latcoord image.longcoord = longcoord image.neighborhood = hood try: image.put() user = util.getuser(username) if (user is not None): user.count = user.count + 1 else: user = UserModel(username=username, count=1) user.put() return True except Exception, err: logging.error(str(err)) return False
def ignoreimage(self, imageurl, username): imageurl = util.convertimageurl(imageurl) try: user = util.getuser(username) if (user is not None): user.count = user.count + 1 else: user = UserModel(username=username, count=1) user.ignored_images.append(imageurl) user.put() return True except Exception, err: logging.error(str(err)) return False