コード例 #1
0
 def create_file(self, user, shared_file):
     ''' Saves uploaded file '''
     file_upload = FileUpload(team_id=user.team.id)
     file_upload.file_name = shared_file['filename']
     file_upload.data = shared_file['body']
     file_upload.description = self.get_argument('description', '')
     self.dbsession.add(file_upload)
     self.dbsession.commit()
     return file_upload
コード例 #2
0
 def create_file(self, user, shared_file):
     ''' Saves uploaded file '''
     try:
         file_upload = FileUpload(team_id=user.team.id)
         file_upload.file_name = shared_file['filename']
         file_upload.data = shared_file['body']
         file_upload.description = self.get_argument('description', '')
         self.dbsession.add(file_upload)
         self.dbsession.commit()
         return file_upload
     except ValidationError as error:
         self.errors.append(str(error))
コード例 #3
0
 def create_file(self, user, shared_file):
     ''' Saves uploaded file '''
     try:
         file_upload = FileUpload(team_id=user.team.id)
         file_upload.file_name = shared_file['filename']
         file_upload.data = shared_file['body']
         file_upload.description = self.get_argument('description', '')
         self.dbsession.add(file_upload)
         self.dbsession.commit()
         return file_upload
     except ValidationError as error:
         self.errors.append(str(error))
コード例 #4
0
 def create_file(self, user, shared_file):
     if options.team_sharing:
         """ Saves uploaded file """
         try:
             file_upload = FileUpload(team_id=user.team.id)
             file_upload.file_name = shared_file["filename"]
             file_upload.data = shared_file["body"]
             file_upload.description = self.get_argument("description", "")
             self.dbsession.add(file_upload)
             self.dbsession.commit()
             return file_upload
         except ValidationError as error:
             self.errors.append(str(error))
     else:
         self.redirect("/404")