(self, inner_path, *args, **kwags)
| 153 | return super(SiteStoragePlugin, self).walk(inner_path, *args, **kwags) |
| 154 | |
| 155 | def list(self, inner_path, *args, **kwags): |
| 156 | if ".zip" in inner_path or ".tar.gz" in inner_path: |
| 157 | match = re.match("^(.*\.(?:tar.gz|tar.bz2|zip))(.*)", inner_path) |
| 158 | archive_inner_path, path_within = match.groups() |
| 159 | archive = self.openArchive(archive_inner_path) |
| 160 | path_within = path_within.lstrip("/") |
| 161 | |
| 162 | if archive_inner_path.endswith(".zip"): |
| 163 | namelist = [name for name in archive.namelist()] |
| 164 | else: |
| 165 | namelist = [item.name for item in archive.getmembers()] |
| 166 | |
| 167 | namelist_relative = [] |
| 168 | for name in namelist: |
| 169 | if not name.startswith(path_within): |
| 170 | continue |
| 171 | name_relative = name.replace(path_within, "", 1).rstrip("/") |
| 172 | |
| 173 | if "/" in name_relative: # File is in sub-directory |
| 174 | continue |
| 175 | |
| 176 | namelist_relative.append(name_relative) |
| 177 | return namelist_relative |
| 178 | |
| 179 | else: |
| 180 | return super(SiteStoragePlugin, self).list(inner_path, *args, **kwags) |
| 181 | |
| 182 | def read(self, inner_path, mode="rb"): |
| 183 | if ".zip/" in inner_path or ".tar.gz/" in inner_path: |
no test coverage detected