changeset 23:9cf78a1c7373

python3
author Jeff Hammel <k0scist@gmail.com>
date Tue, 03 Nov 2020 10:55:18 -0800
parents ee3eadc97a41
children 466443d48906
files contenttransformer/transformers.py
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/contenttransformer/transformers.py	Tue Nov 03 10:53:13 2020 -0800
+++ b/contenttransformer/transformers.py	Tue Nov 03 10:55:18 2020 -0800
@@ -1,6 +1,6 @@
 import docutils.core
 import subprocess
-from utils import import_path
+from .utils import import_path
 from webob import Request, Response
 
 import genshi
@@ -35,14 +35,15 @@
     def transform(self, request):
         return (self.to_type, self.content)
 
+
 class Graphviz(Transformer):
     content_types = { 'png': 'image/png',
                       'svg': 'image/svg+xml' }
-    
+
     def __init__(self, content, content_type, format='png'):
         self.format=format
         Transformer.__init__(self, content, content_type)
-    
+
     def transform(self, request):
         """create a Graphviz object"""
         _format = request.GET.get('format', self.format)
@@ -53,6 +54,7 @@
         image, _ = process.communicate(self.content)
         return (self.content_types[_format], image)
 
+
 class RestructuredText(Transformer):
     settings = { 'report_level': 5 }
 
@@ -76,10 +78,9 @@
             name = path.rsplit('.')[-1]
             self.variables[name] = module
         Transformer.__init__(self, content, content_type)
-        
+
     def transform(self, request):
         variables = dict(request=request)
         template = MarkupTemplate(self.content)
         stream = template.generate(**variables)
         return ('text/html', stream.render('html', doctype='html'))
-