(self, filename=None, is_dir=False)
| 707 | return content_type |
| 708 | |
| 709 | def content_type(self, filename=None, is_dir=False): |
| 710 | # explicit command line argument always wins |
| 711 | content_type = self.config.mime_type |
| 712 | content_charset = None |
| 713 | |
| 714 | if filename == u'-': |
| 715 | return self.stdin_content_type() |
| 716 | |
| 717 | if is_dir: |
| 718 | content_type = 'application/x-directory' |
| 719 | elif not content_type: |
| 720 | (content_type, content_charset) = self._guess_content_type(filename) |
| 721 | |
| 722 | ## add charset to content type |
| 723 | if not content_charset: |
| 724 | content_charset = self.config.encoding.upper() |
| 725 | if self.add_encoding(filename, content_type) and content_charset is not None: |
| 726 | content_type = content_type + "; charset=" + content_charset |
| 727 | |
| 728 | return content_type |
| 729 | |
| 730 | def add_encoding(self, filename, content_type): |
| 731 | if 'charset=' in content_type: |
no test coverage detected