예제 #1
0
 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())
예제 #2
0
 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())
예제 #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
예제 #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