예제 #1
0
    def post(self):
        user = users.get_current_user()
        result = {}
        result['status'] = True

        if user == None:
            result['status'] = False
            result['message'] = 'User is not logged in'
            self.response.out.write(json.dumps(result))
            return
        else:
            key = self.request.get('key')
            password = None

            if key != None and key != "":
                password = StoredKey.get(key)

            if password == None:
                password = StoredKey(username='******', password='******', title=' ')

            password.from_request(self.request)
            password.save()
            memcache.delete(str(user))

        self.response.out.write(json.dumps(result))
예제 #2
0
    def post(self):
        user = users.get_current_user()
        result = {}
        result["status"] = True

        if user == None:
            result["status"] = False
            result["message"] = "User is not logged in"
            self.response.out.write(json.dumps(result))
            return
        else:
            key = self.request.get("key")
            password = None

            if key != None and key != "":
                password = StoredKey.get(key)

            if password == None:
                password = StoredKey(username="******", password="******", title=" ")

            password.from_request(self.request)
            password.save()
            memcache.delete(str(user))

        self.response.out.write(json.dumps(result))
예제 #3
0
 def get(self):
   user = users.get_current_user()
   result = {}
   
   if user == None:
     result['status'] = False
     result['message'] = 'User is not logged in'
   else:
     key = self.request.get('key')
     if key != "" and key != None:
       password = StoredKey.get(key)
       if password == None:
         result['status'] = False
         result['message'] = 'Key could not retrieved from database'
       else:
         password.delete()
         result['status'] = True
     else:
       result['status'] = False
       result['message'] = 'Key was empty or not set'
     memcache.delete(str(user))
 
   self.response.out.write(json.dumps(result))
예제 #4
0
    def get(self):
        user = users.get_current_user()
        result = {}

        if user == None:
            result['status'] = False
            result['message'] = 'User is not logged in'
        else:
            key = self.request.get('key')
            if key != "" and key != None:
                password = StoredKey.get(key)
                if password == None:
                    result['status'] = False
                    result['message'] = 'Key could not retrieved from database'
                else:
                    password.delete()
                    result['status'] = True
            else:
                result['status'] = False
                result['message'] = 'Key was empty or not set'
            memcache.delete(str(user))

        self.response.out.write(json.dumps(result))