Exemplo n.º 1
0
 def post(self,title):
     content = self.request.get('content')
     if not content:
         self.render('newWikiEntry.html', error = ERROR, title = title)
     else:
         wikiEntry = WikiEntry(title = title, content = content)
         wikiEntry.put()
         getWikiEntry(title, True)
         self.redirect('/wiki%s' % title)
Exemplo n.º 2
0
 def get(self, title):
     content = ''
     wikiEntry = getWikiEntry(title)
     if wikiEntry: content = wikiEntry.content
     userIdHash = self.request.cookies.get('user_id')
     if not userIdHash:
         self.redirect('/wiki%s' % title)
     else:
         cookieHasher = CookieHash()
         userId = cookieHasher.check_secure_val(userIdHash)
         if not userId:
             self.redirect('/wiki%s' % title)
         self.render("newWikiEntry.html", title = title,
                     content = content)
Exemplo n.º 3
0
 def get(self, title):
     loggedIn = False
     userIdHash = self.request.cookies.get('user_id')
     if userIdHash:
         cookieHasher = CookieHash()
         userId = cookieHasher.check_secure_val(userIdHash)
         if userId: loggedIn = True
     wikiEntry = getWikiEntry(title)
     if None == wikiEntry:
         if not loggedIn:
             self.renderWikiEntry(wikiEntry = wikiEntry, title = title)
         else:
             self.redirect('/wiki/_edit%s' % title)
     else:
         self.renderWikiEntry(wikiEntry = wikiEntry, loggedIn = loggedIn,
                              title = title)