Ejemplo n.º 1
0
 def post(self):
     text = self.request.get('text')
     if text:
         conver_url = utils.unescape(self.request.get('url'))
         conver = Conver.get_for_url(conver_url)
         message = Message(author=PermaUser.get_current_permauser(), text=text, conver=conver)
         message.put()
         self.distribute_message(message)
         
     else:
         logging.error("No message '%S'saved for %s", text, conver_url)
Ejemplo n.º 2
0
 def get(self):
     permauser = PermaUser.get_current_permauser()
     conver_url = utils.unescape(self.request.get('url'))
     conver = Conver.get_for_url(conver_url)
     messages = Message.all().filter('conver =', conver).order('created').fetch(1000)
     self.response.out.write(template.render(
         os.path.join(os.path.dirname(__file__),
         'templates/conver.html'), 
         {
             'token': channel.create_channel(permauser.user_id() + str(conver.key().id_or_name())),
             'conver_url': conver_url,
             'messages': [ {'author': message.author.display_name(), 'text': message.text} for message in messages],
             'loginorout_text': 'Log out',
             'loginorout_url': users.create_logout_url(self.request.uri)
         }
     ))
Ejemplo n.º 3
0
 def get(self):
     permauser = PermaUser.get_current_permauser()
     other_conver_urls = [str(conver.url) for conver in Conver.all().fetch(1000)]
     user_conver_urls  = []
     message_urls = [str(message.conver.url) for message in Message.all().filter('author =', permauser).fetch(1000)]
     message_urls = list(set(message_urls)) # we only want to go through each url once
     for message_url in message_urls:
         other_conver_urls.remove(message_url)
         user_conver_urls.append( message_url)
     self.response.out.write(template.render(
         os.path.join(os.path.dirname(__file__),
         'templates/home.html'), 
         {
             'other_conver_urls': other_conver_urls,
             'user_conver_urls': user_conver_urls,
             'loginorout_text': 'Log out',
             'loginorout_url': users.create_logout_url(self.request.uri)
         }
     ))
Ejemplo n.º 4
0
 def post(self):
     conver_url = utils.unescape(self.request.get('url'))
     conver = Conver.get_for_url(conver_url)
     permauser = PermaUser.get_current_permauser()
     conver.remove_watcher(permauser)
     conver.put() # or maybe we want to keep all watchers forever, so people get notified about what they looked at
Ejemplo n.º 5
0
 def post(self):
     conver_url = utils.unescape(self.request.get('url'))
     conver = Conver.get_for_url(conver_url)
     permauser = PermaUser.get_current_permauser()
     conver.add_watcher(permauser)
     conver.put()