Opened 8 years ago
Closed 8 years ago
#13305 closed defect (fixed)
Add support on ticket description
| Reported by: | anonymous | Owned by: | Ryan J Ollos |
|---|---|---|---|
| Priority: | normal | Component: | MermaidMacro |
| Severity: | normal | Keywords: | patch |
| Cc: | mephistopeles84@… | Trac Release: |
Description
macros on wiki pages seems works well. But not working properly on ticket description.
it could be from conflict with other plugins?
Error message
Error: Processor Mermaid failed'int' object has no attribute 'replace'
mermaid contents
{{{#!Mermaid
sequenceDiagram
A->> B: Query
B->> C: Forward query
Note right of C: Thinking...
C->> B: Response
B->> A: Forward response
}}}
Environment
trac 1.0.16.dev0 tracmermaid 0.4.1 [components] mastertickets.api.masterticketssystem = enabled mastertickets.web_ui.masterticketsmodule = enabled timingandestimationplugin.* = enabled tracjsgantt.* = enabled tracmermaid.mermaid.mermaidmacro = enabled tracopt.versioncontrol.svn.svn_fs.subversionconnector = enabled tracopt.versioncontrol.svn.svn_prop.subversionmergepropertydiffrenderer = enabled tracopt.versioncontrol.svn.svn_prop.subversionmergepropertyrenderer = enabled tracopt.versioncontrol.svn.svn_prop.subversionpropertyrenderer = enabled tracpygments.* = enabled tracsubtickets.api.* = enabled tracsubtickets.web_ui.* = enabled tracwysiwyg.wysiwygmodule = enabled
Attachments (1)
Change History (14)
comment:1 Changed 8 years ago by
comment:3 Changed 8 years ago by
I noticed an undefined variable description and an unused variable title. I'm not sure it's the proper fix, but based on those two findings the following patch might be needed:
-
tracmermaid/mermaid.py
93 93 name = c 94 94 break 95 95 else: 96 name = description96 name = title 97 97 line = line[0:m.start(1)] + '"%s" "%s"' % ( 98 98 href.replace('"', ''), name.replace('"', '')) 99 99 lines.append(line)
comment:4 Changed 8 years ago by
| Keywords: | patch added |
|---|
comment:5 Changed 8 years ago by
Replying to Ryan J Ollos:
Is there a traceback in the logs?
Hi, this is who made this ticket. thank you for giving attention to this issue.
btw, traceback below is made after applying patch you mentioned.(name = descriptiontitle)
and tracpygments.* = enable in trac.ini also commented.
I'm going to look for which plugin in my environment making conflict with mermaidmacro.
2017-10-17 09:23:11,970 Trac[mermaid] DEBUG: content sequenceDiagram
A->> B: Query
B->> C: Forward query
Note right of C: Thinking...
C->> B: Response
B->> A: Forward response
2017-10-17 09:23:11,971 Trac[formatter] ERROR: Processor Mermaid failed for <Resource u'ticket:418'>:
Traceback (most recent call last):
File "build\bdist.win32\egg\trac\wiki\formatter.py", line 1191, in _exec_processor
return processor.process(text)
File "build\bdist.win32\egg\trac\wiki\formatter.py", line 364, in process
text = self.processor(text)
File "build\bdist.win32\egg\trac\wiki\formatter.py", line 348, in _macro_processor
text, self.args)
File "build\bdist.win32\egg\tracmermaid\mermaid.py", line 68, in expand_macro
escape(context.resource.id),
File "c:\users\mcsrem~1\appdata\local\temp\easy_install-gq73fi\Genshi-0.7-py2.7-win32.egg.tmp\genshi\core.py", line 519, in escape
text = text.replace('&', '&') \
AttributeError: 'int' object has no attribute 'replace'
comment:6 Changed 8 years ago by
Ah, this is looking familiar. Which version of Genshi and is it compiled with speedups or not? You can find the information on the /about page.
comment:7 Changed 8 years ago by
Hi, this is also who made this ticket.
I made very ugly patch in code and it works. Thank you for assistance.
</script>""" % (
id_attr,
escape(context.resource.realm),
--- escape(context.resource.id),
+++ escape(str(context.resource.id) if isinstance(context.resource.id, int) else context.resource.id),
escape(context.resource.version or ''),
escape(unicode_quote(content)),
escape(content))
it seems be escape method from genshi only works properly with string type argument.
and context.resource.id is supposed to be string type but some of old plugin in my environment changed to int type.
If there are some kind of agreement about type of property from resource object, I should blame some of old plugins which still don't know which one. Or blame myself because I didn't check upward compatibility of every plugins from 0.12 to 1.0.
comment:8 follow-up: 9 Changed 8 years ago by
IIRC, issue is only seen with certain Genshi versions/configurations. Could you please let me know your Genshi version and with or without speedups so that I can reproduce?
comment:9 Changed 8 years ago by
Replying to Ryan J Ollos:
IIRC, issue is only seen with certain Genshi versions/configurations. Could you please let me know your Genshi version and with or without speedups so that I can reproduce?
it's Genshi-0.7-py2.7-win32.
Changed 8 years ago by
| Attachment: | Screen Shot 2017-10-19 at 20.13.16.png added |
|---|
comment:12 Changed 8 years ago by
| Owner: | changed from tkob-trac to Ryan J Ollos |
|---|---|
| Status: | new → accepted |




I can't reproduce in an environment with just TracMermaid installed, so possibly this is a plugin conflict.
Side note: you can remove
tracpygments.* = enabledand the associated plugin. Trac supports Pygments highlighting since Trac 0.11.