Exemplo n.º 1
0
def deleteDictEntry(user, word):
    word, _ = parseOpt(word)
    dict_entry = Dictionary.all().\
        filter("twitter_user ="******"word =", word.strip()).get()
    if dict_entry:
        lli = LearnList.all().\
            filter("dict_entry =", dict_entry.key()).get()
        for q in Question.all().filter("lli_ref =", lli.key()).run():
            q.delete()
        lli.delete()
        dict_entry.delete()
    return json.dumps({})
Exemplo n.º 2
0
def editDictEntry(user, original_word, new_string):
    original_word, _ = parseOpt(original_word)
    dict_entry = Dictionary.all().\
        filter("twitter_user ="******"word =", original_word.strip()).get()
    if dict_entry:
        parsed_dict = parseMessage(new_string, '')
        if parsed_dict != {}:
            dict_entry.word = parsed_dict["word"]
            dict_entry.meaning = parsed_dict["meaning"]
            dict_entry.pronounce = parsed_dict["pronounce"]
            dict_entry.put()
    return json.dumps({})