コード例 #1
0
 def _directory(self, name):
     """Return SFTPAttributes for a directory with given name"""
     result = SFTPAttributes()
     result.filename = name
     result.st_uid = 0
     result.st_group = 0
     result.st_size = 0
     result.st_mode = stat.S_IFDIR | stat.S_IRUSR | stat.S_IXUSR
     return result
コード例 #2
0
 def _file(self, attachment):
     """Return SFTPAttributes for a given attachment"""
     if not hasattr(attachment, '_ids'):
         attachment = self.env['ir.attachment'].browse(attachment)
     result = SFTPAttributes()
     result.filename = attachment.datas_fname or attachment.name
     result.st_uid = 0
     result.st_group = 0
     result.st_size = attachment.file_size
     result.st_mode = stat.S_IFREG | stat.S_IRUSR
     return result