Extract the given file to a temporary directory and return the path of the directory with the extracted content.
(self, filename)
| 363 | return base, ext |
| 364 | |
| 365 | def extract(self, filename): |
| 366 | """ |
| 367 | Extract the given file to a temporary directory and return |
| 368 | the path of the directory with the extracted content. |
| 369 | """ |
| 370 | prefix = "django_%s_template_" % self.app_or_project |
| 371 | tempdir = tempfile.mkdtemp(prefix=prefix, suffix="_extract") |
| 372 | self.paths_to_remove.append(tempdir) |
| 373 | if self.verbosity >= 2: |
| 374 | self.stdout.write("Extracting %s" % filename) |
| 375 | try: |
| 376 | archive.extract(filename, tempdir) |
| 377 | return tempdir |
| 378 | except (archive.ArchiveException, OSError) as e: |
| 379 | raise CommandError( |
| 380 | "couldn't extract file %s to %s: %s" % (filename, tempdir, e) |
| 381 | ) |
| 382 | |
| 383 | def is_url(self, template): |
| 384 | """Return True if the name looks like a URL.""" |
no test coverage detected