def post(self): self.response.headers['Content-Type'] = 'text/html' user = users.get_current_user() newword = self.request.get('addword') lexico_order=''.join(sorted(set(newword))) userid=users.get_current_user().email() userid = hashlib.sha1('%s' % (userid)).hexdigest() key = ndb.Key('MyList', lexico_order+userid) my_list = key.get() if my_list==None: my_list=MyList(id=lexico_order+userid) my_list.put() key = ndb.Key('MyList', lexico_order+userid) my_list = key.get() action=self.request.get('button') if action == 'Submit': string = self.request.get('addword') if string == None or string == '': self.redirect('/') return my_list.list_of_words.append(newword) my_list.lexicographical=lexico_order my_list.word_count=len(my_list.list_of_words) my_list.letter_count=len(my_list.lexicographical) my_list.user_id=userid my_list.put() self.redirect('/add')
def post(self): self.response.headers['Content-Type'] = 'text/html' user = users.get_current_user() string = self.request.get('input') string7 = ''.join(k for k, g in groupby(sorted(string))) emailsample = users.get_current_user().email() key = ndb.Key('MyList', string7 + emailsample) my_list = key.get() if my_list == None: my_list = MyList(id=string7 + emailsample) my_list.put() key = ndb.Key('MyList', string7 + emailsample) my_list = key.get() action = self.request.get('button') if action == 'add': string = self.request.get('input') if string == None or string == '': self.redirect('/') return my_list.strings.append(string) my_list.lexographical = string7 my_list.wordcount = len(my_list.strings) my_list.lettercount = len(my_list.lexographical) my_list.email = emailsample my_list.put() self.redirect('/add')
def post(self): self.response.headers['Content-Type'] = 'text/html' user = users.get_current_user().email() textfile = self.request.get("myFile") textfile = textfile.split() for x in textfile: line = ''.join(k for k, g in groupby(sorted(x))) key = ndb.Key('MyList', line + user) my_list = key.get() if my_list == None: my_list = MyList(id=line + user) my_list.put() key = ndb.Key('MyList', line + user) my_list = key.get() my_list.strings.append(x) my_list.lexographical = line my_list.wordcount = len(my_list.strings) my_list.lettercount = len(my_list.lexographical) my_list.email = user my_list.put() self.redirect('/')
def post(self): self.response.headers['Content-Type'] = 'text/html' userid = users.get_current_user().email() userid = hashlib.sha1('%s' % (userid)).hexdigest() textfile = self.request.get("myFile") textfile = textfile.split() for x in textfile: line=''.join(sorted(set(x))) key = ndb.Key('MyList', line+userid) my_list = key.get() if my_list==None: my_list=MyList(id=line+userid) my_list.put() key = ndb.Key('MyList', line+userid) my_list = key.get() my_list.list_of_words.append(x) my_list.lexicographical=line my_list.word_count=len(my_list.list_of_words) my_list.letter_count=len(my_list.lexicographical) my_list.user_id=userid my_list.put() self.redirect('/')