Exemplo n.º 1
0
 def post(self):
     
     privateKey = cgi.escape(self.request.get('privateKey'))
     profile = Profile.all().filter("privateKey =", privateKey).get()
     
     # should do nothing and tell no error, to avoid ppl searching for private keys?
     if(not profile):
         self.response.set_status(500, message="Can't find profile with key " + privateKey)
         return
     
     if (not profile.guest):
         self.response.set_status(500, message="Can't change an already registered profile when it is not guest")
         return
     
     profile.guest = False
     profile.name = cgi.escape(self.request.get('name'))
     profile.lastAccess = datetime.datetime.now()
     
     profile.put()
     
     scores = Score.all()
     scores = scores.filter("profilePublicKey =", profile.publicKey)
     
     for score in scores:
         score.name = profile.name
         score.put()
     
     profileData = {'privateKey': profile.privateKey, 'publicKey': profile.publicKey, 'name':profile.name, 'guest': profile.guest }
     
     self.response.headers['Content-Type'] = 'text/plain'
     self.response.out.write(json.dumps(profileData))
Exemplo n.º 2
0
    def get(self):

        scores = Score.all()
        
        for score in scores:
            score.year, score.month, score.week, score.day = dateutils.get_datetime_data(score.timestamp)
            score.put()
      
        self.response.headers['Content-Type'] = 'text/html'
        self.response.out.write("OK")   
Exemplo n.º 3
0
    def get(self):

        scores = Score.all()

        for score in scores:
            score.year, score.month, score.week, score.day = dateutils.get_datetime_data(
                score.timestamp)
            score.put()

        self.response.headers['Content-Type'] = 'text/html'
        self.response.out.write("OK")
Exemplo n.º 4
0
    def post(self):

        privateKey = cgi.escape(self.request.get('privateKey'))
        profile = Profile.all().filter("privateKey =", privateKey).get()

        # should do nothing and tell no error, to avoid ppl searching for private keys?
        if (not profile):
            self.response.set_status(500,
                                     message="Can't find profile with key " +
                                     privateKey)
            return

        if (not profile.guest):
            self.response.set_status(
                500,
                message=
                "Can't change an already registered profile when it is not guest"
            )
            return

        profile.guest = False
        profile.name = cgi.escape(self.request.get('name'))
        profile.lastAccess = datetime.datetime.now()

        profile.put()

        scores = Score.all()
        scores = scores.filter("profilePublicKey =", profile.publicKey)

        for score in scores:
            score.name = profile.name
            score.put()

        profileData = {
            'privateKey': profile.privateKey,
            'publicKey': profile.publicKey,
            'name': profile.name,
            'guest': profile.guest
        }

        self.response.headers['Content-Type'] = 'text/plain'
        self.response.out.write(json.dumps(profileData))