Opened 5 years ago
Closed 5 years ago
#13730 closed defect (fixed)
Error with Trac 1.4
Reported by: | Owned by: | ttressieres | |
---|---|---|---|
Priority: | normal | Component: | IncludeSourcePartialPlugin |
Severity: | major | Keywords: | |
Cc: | Trac Release: | 1.4 |
Description
On web page:
Error: Macro IncludeSource(...) failed 'Environment' object has no attribute 'get_repository' and/or 'Stream' object has no attribute 'generate'
In log:
2020-01-10 11:17:56,858 Trac[formatter] ERROR: Macro IncludeSource(trunk/externals.txt, mimetype=application/x-shellscript) failed for <Resource u'wiki:WikiStart'>: Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/trac/wiki/formatter.py", line 818, in _macro_formatter return macro.ensure_inline(macro.process(args), in_paragraph) File "/usr/local/lib/python2.7/site-packages/trac/wiki/formatter.py", line 389, in process text = self.processor(text) File "/usr/local/lib/python2.7/site-packages/trac/wiki/formatter.py", line 361, in _macro_processor text) File "build/bdist.freebsd-12.1-RELEASE-p1-amd64/egg/includesource/IncludeSource.py", line 110, in expand_macro repos = self.env.get_repository(reponame) AttributeError: 'Environment' object has no attribute 'get_repository'
PS: May be used deprecated interface?
Attachments (2)
Change History (15)
comment:1 Changed 5 years ago by
Owner: | changed from Chris Heller to Ryan J Ollos |
---|---|
Status: | new → accepted |
Changed 5 years ago by
Attachment: | includesource.patch added |
---|
comment:2 Changed 5 years ago by
With the patch in attachment I'm able to use this macro on Trac 1.4.1
comment:3 Changed 5 years ago by
Owner: | changed from Ryan J Ollos to ttressieres |
---|
comment:4 Changed 5 years ago by
I tried this patch, but anyway the error:
'Stream' object has no attribute 'generate'
comment:5 Changed 5 years ago by
2020-02-28 07:58:49,551 Trac[formatter] ERROR: Macro IncludeSource(trunk/externals.txt, mimetype=application/x-shellscript) failed for <Resource u'wiki:WikiStart'>: Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/trac/wiki/formatter.py", line 818, in _macro_formatter return macro.ensure_inline(macro.process(args), in_paragraph) File "/usr/local/lib/python2.7/site-packages/trac/wiki/formatter.py", line 389, in process text = self.processor(text) File "/usr/local/lib/python2.7/site-packages/trac/wiki/formatter.py", line 361, in _macro_processor text) File "build/bdist.freebsd-12.1-RELEASE-p1-amd64/egg/includesource/IncludeSource.py", line 204, in expand_macro | Transformer(xpath3).replace(header) AttributeError: 'Stream' object has no attribute 'generate'
comment:6 follow-up: 7 Changed 5 years ago by
Are you sure the patch was applied correctly ? There is no more call to generate() function in the code
comment:7 Changed 5 years ago by
Replying to ttressieres:
Are you sure the patch was applied correctly ?
I apologize! Did not remove the previous * .egg
There is no more call to generate() function in the code
But still get error:
Error: Macro IncludeSource(trunk/externals.txt, mimetype=application/x-shellscript) failed unsupported operand type(s) for -: 'NoneType' and 'int'
2020-03-04 15:35:41,897 Trac[formatter] ERROR: Macro IncludeSource(trunk/externals.txt, mimetype=application/x-shellscript) failed for <Resource u'wiki:WikiStart'>: Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/trac/wiki/formatter.py", line 818, in _macro_formatter return macro.ensure_inline(macro.process(args), in_paragraph) File "/usr/local/lib/python2.7/site-packages/trac/wiki/formatter.py", line 389, in process text = self.processor(text) File "/usr/local/lib/python2.7/site-packages/trac/wiki/formatter.py", line 361, in _macro_processor text) File "build/bdist.freebsd-12.1-RELEASE-p2-amd64/egg/includesource/IncludeSource.py", line 184, in expand_macro src = mv.render(formatter.context, mimetype, src, file_name, url, annotations) File "/usr/local/lib/python2.7/site-packages/trac/mimeview/api.py", line 821, in render return self._render_source(context, result, annotations) File "/usr/local/lib/python2.7/site-packages/trac/mimeview/api.py", line 847, in _render_source data = (annotator, annotator.get_annotation_data(context)) File "/usr/local/lib/python2.7/site-packages/trac/mimeview/api.py", line 1064, in get_annotation_data 'offset': context.get_hint('lineno', 1) - 1 TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
comment:8 Changed 5 years ago by
This error occurs only if there are no parameters for linenum.
Error:
[[IncludeSource(trunk/externals.txt, mimetype=application/x-shellscript)]]
Success if set start=1
:
[[IncludeSource(trunk/externals.txt, start=1, mimetype=application/x-shellscript)]]
Changed 5 years ago by
Attachment: | support_trac_1.4.patch added |
---|
new patch for 1.4.x without error when start or end parameter are not present
comment:10 Changed 5 years ago by
Replying to ttressieres:
OK I reproduced this error, see the new patch file
Thanks a lot! Everything works great.
comment:11 Changed 5 years ago by
Owner: | changed from ttressieres to Ryan J Ollos |
---|
Will review and commit patch.
comment:12 Changed 5 years ago by
Owner: | changed from Ryan J Ollos to ttressieres |
---|---|
Status: | accepted → assigned |
patch to port this macro to Trac 1.4