Beispiel #1
0
	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
Beispiel #2
0
    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
Beispiel #3
0
    def adduser(self, username):
        user = util.getuser(username)
        if (user is not None):
            return False

        user = UserModel(username=username, count=0)
        try:
            user.put()
            return True
        except Exception, err:
            logging.error(str(err))
Beispiel #4
0
	def adduser(self, username):
		user = util.getuser(username)
		if (user is not None):
			return False
			
		user = UserModel(username=username, count=0)
		try:
			user.put()
			return True
		except Exception, err:
			logging.error(str(err))
Beispiel #5
0
	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
Beispiel #6
0
    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