Modify ↓
Opened 11 months ago
Last modified 11 months ago
#14273 new defect
Plugin conflicting with trac-spamfilter plugin
Reported by: | Oleksij | Owned by: | Cinc-th |
---|---|---|---|
Priority: | normal | Component: | MarkdownMacro |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 1.6 |
Description
First of all, thank you for your MarkDown macro plugin - I found it very useful. However, I found one small issue. I do have spam filter plugin installed and when i am clicking on Monitoring in admin menu (/admin/spamfilter/monitor URL) i am getting error:
Trac detected an internal error: AttributeError: 'int' object has no attribute 'name'
And python traceback points to the macro:
Python Traceback Most recent call last: File "/usr/local/lib/python3.9/site-packages/trac/web/main.py", line 609 , in dispatch_request File "/usr/local/lib/python3.9/site-packages/trac/web/main.py", line 301 , in dispatch File "/usr/local/lib/python3.9/site-packages/trac/web/main.py", line 250 , in dispatch File "/usr/local/lib/python3.9/site-packages/trac/web/main.py", line 469 , in _post_process_request File "/usr/local/lib/python3.9/site-packages/tracmarkdown/macro.py", line 153 , in post_process_request
Not sure why only that page is impacted, however, i was able to fix it with that patch:
-
tracmarkdown/macro.py
148 148 def wiki_to_html(self, context, wikidom, escape_newlines=None): 149 149 return Markup(format_to_markdown(self, context, wikidom)) 150 150 151 if template and data and 'page' in data :151 if template and data and 'page' in data and hasattr(data, 'name'): 152 152 # We only handle wiki pages 153 153 path = data['page'].name.split('/') 154 154 if path[0] in self.root_pages:
I am using Trac 1.6, trac-macro is r18423, and spamfilter is r17763
Attachments (0)
Note: See
TracTickets for help on using
tickets.
I think the patch stops markdown formatting on wiki pages (
data
variable is adict
instance and doesn't havename
attribute).Instead, try the following patch:
markdownmacro/trunk/tracmarkdown/macro.py
'page' in data: