def test_is_text_file(self):
     here_dir = path.dirname(__file__)
     assert utils.is_text_file(open(path.join(
         here_dir,
         'data/test_mime/text_file.txt')).read())
     assert not utils.is_text_file(open(path.join(
         here_dir,
         'data/test_mime/bin_file')).read())
 def test_is_text_file(self):
     here_dir = path.dirname(__file__)
     assert utils.is_text_file(open(path.join(
         here_dir,
         'data/test_mime/text_file.txt')).read())
     assert not utils.is_text_file(open(path.join(
         here_dir,
         'data/test_mime/bin_file')).read())
Beispiel #3
0
 def has_html_view(self):
     if (self.content_type.startswith('text/')
             or self.extension in VIEWABLE_EXTENSIONS
             or self.extension in self.repo._additional_viewable_extensions
             or utils.is_text_file(self.text)):
         return True
     return False
Beispiel #4
0
 def has_html_view(self):
     if (self.content_type.startswith('text/') or
         self.extension in VIEWABLE_EXTENSIONS or
         self.extension in self.repo._additional_viewable_extensions or
         utils.is_text_file(self.text)):
         return True
     return False