Modify ↓
#12825 closed defect (fixed)
`Graphviz.render()` does not work with the default value for `filename`
Reported by: | Owned by: | Jun Omae | |
---|---|---|---|
Priority: | normal | Component: | GraphvizPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: |
Description
Traceback (most recent call last): File "/somepath/trac/trac/mimeview/api.py", line 795, in render rendered_content, filename, url) File "/somepath/trac-plugins/graphviz-plugin/graphviz/graphviz.py", line 200, in render ext = filename.split('.')[1] AttributeError: 'NoneType' object has no attribute 'split'
The default value for filename
is None
:
graphvizplugin/trunk/graphviz/graphviz.py#L199
Trac version is 1.1.3
Attachments (0)
Change History (7)
comment:1 Changed 6 years ago by
comment:2 Changed 6 years ago by
Could you try the following patch?
-
graphvizplugin/trunk/graphviz/graphviz.py
diff --git a/graphvizplugin/trunk/graphviz/graphviz.py b/graphvizplugin/trunk/graphviz/graphviz.py index b2e8385e0..6a3d6bca5 100644
a b class Graphviz(Component): 198 198 return 0 199 199 200 200 def render(self, context, mimetype, content, filename=None, url=None): 201 ext = filename.split('.')[1] 202 name = 'graphviz' if ext == 'graphviz' else 'graphviz.%s' % ext 201 ext = filename.split('.')[1] if filename else None 202 name = 'graphviz' if not ext or ext == 'graphviz' \ 203 else 'graphviz.%s' % ext 203 204 text = content.read() if hasattr(content, 'read') else content 204 205 return self.expand_macro(context, name, text) 205 206
comment:3 Changed 6 years ago by
Seems to work. (But I don't know the exact scenario where filename is None. I just found the error in the logfile without much context.)
comment:7 Changed 6 years ago by
Owner: | changed from Christian Boos to Jun Omae |
---|
Note: See
TracTickets for help on using
tickets.
Still a problem with Trac 1.3.3dev, graphviz plugin 1.3.0.1dev