Commits

Olemis Lang committed 9411fc5

TracGViz : GViz content providers emit error message if MIME type cannot be guessed

  • Participants
  • Parent commits af4fb42
  • Branches providers

Comments (0)

Files changed (2)

File trac-dev/gviz/TODO

 
 X Remove relative import statements
 
-- Error message for GViz content providers when guessed mimetype is still `None`
+X Error message for GViz content providers when guessed mimetype is still `None`
 
 ~ Write tests for data sources included in TracGViz 1.3.4 that are 
   not about version control.
 
 ~ Upgrade GViz providers for Trac=1.0 and Apache(TM) Bloodhound.
 
+- Test error message for GViz content providers when guessed mimetype is 
+  still `None`
+
 - Move `dutest` to `tests_require` rather than `install_requires`.
 
 - Typecasts in CSV to GViz MIME converter.

File trac-dev/gviz/tracgviz/util/__init__.py

 import types
 from xmlrpclib import DateTime
 
-from tracgviz.api import IGVizProtocolHandler, IGVizTableEncoder, \
-                IGVizDataProvider, IHashLibrary, GVizBadRequestError, \
-                GVizInvalidConfigError
+from tracgviz.api import GVizBadRequestError, GVizInvalidConfigError, \
+                         GVizNotSupportedError, IGVizProtocolHandler, \
+                         IGVizTableEncoder, IGVizDataProvider, IHashLibrary
 from tracgviz.testing.util import dummy_request
 
 __metaclass__ = type
         and used to feed the data table.
         """
         content, mimetype = self.get_input_contents(req)
-        self.log.debug("IG: Detected %s, processing %s", mimetype, content.__class__)
+        self.log.debug("IG: Detected %s, processing %s", 
+                       mimetype, content.__class__)
+        if mimetype is None:
+            GVizNotSupportedError('Unable to guess MIME type')
         try :
           mimesys = Mimeview(self.env)
           (cols, data), mimetype, ext = mimesys.convert_content(