def get(self): usersObj = {} for bid in Bid.all(): user = bid.user userId = user.key().id_or_name() if (userId not in usersObj): userObj = {} # Extracting properties fundsAvailable = user.fundsAvailable # Passing properties to the obj userObj['userId'] = userId userObj['fundsAvailable'] = fundsAvailable # Inserting new object into the accumulation object usersObj[userId] = userObj # Dumping to JSON the accumulation object self.response.headers['Content-Type'] = 'application/json' self.response.out.write(json.dumps(usersObj))
def set_user(user): cookie = Cookie.SimpleCookie() key = str(user.key()) hash = hashlib.sha1(key+juno.site_config('session')['salt']).hexdigest() cookie[juno.site_config('session')['cookie']] = '%s:%s' % (hash, key) juno.header('Set-Cookie', cookie.output(header=''))