Exemple #1
0
 def createDictEntry(self, twitter_user, message_id, word, meaning,\
      pronounce=""):
     dictEntry = Dictionary()
     dictEntry.twitter_user = twitter_user
     dictEntry.message_id = message_id
     dictEntry.word = word
     dictEntry.pronounce = pronounce
     dictEntry.meaning = meaning
     dictEntry.served = 0
     dictEntry.source_lang = ""
     dictEntry.target_lang = ""
     dictEntry.put()
     return dictEntry
Exemple #2
0
def addNewDictEntry(twitter_user, message_id,  entry, served):
    new_dict_entry = None
    # No duplicate words allowed for a single user
    c = Dictionary.all().filter("word =", entry["word"]).\
        filter("twitter_user ="******"Count for word %s is %s" % (entry["word"], c))
    if c == 0:
        new_dict_entry = Dictionary()
        new_dict_entry.pronounce = entry["pronounce"]
        new_dict_entry.twitter_user = twitter_user
        new_dict_entry.message_id = message_id
        new_dict_entry.word = entry["word"]
        new_dict_entry.meaning = entry["meaning"]
        new_dict_entry.served = served
        new_dict_entry.source_lang = entry["source_lang"]
        new_dict_entry.put()
    return new_dict_entry