示例#1
0
 def post(self, *args, **kwargs):
     ''' Creates a new text share '''
     form = Form(
         name="Please enter a name",
         content="Please provide some content",
     )
     if form.validate(self.request.arguments):
         user = self.get_current_user()
         paste = PasteBin(name=unicode(self.get_argument("name")),
                          contents=unicode(self.get_argument("content")),
                          team_id=user.team.id)
         dbsession.add(paste)
         dbsession.flush()
         self.event_manager.paste_bin(user, paste)
     self.redirect('/user/share/pastebin')
示例#2
0
 def post(self, *args, **kwargs):
     ''' Creates a new text share '''
     name = self.get_argument("name", "")
     content = self.get_argument("content", "")
     if 0 < len(name) and 0 < len(content):
         user = self.get_current_user()
         paste = PasteBin(
             name=unicode(name),
             contents=unicode(content),
             team_id=user.team.id
         )
         dbsession.add(paste)
         dbsession.flush()
         event = self.event_manager.create_paste_bin_event(user, paste)
         self.new_events.append(event)
     self.redirect('/user/share/pastebin')