Modify ↓
#12748 closed defect (fixed)
ERROR: Macro Image(,) failed: IndexError: pop from empty list
| Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.2.1 |
| Component: | wiki system | Version: | |
| Severity: | normal | Keywords: | imagemacro |
| Cc: | Branch: | ||
| Release Notes: |
Fixed error when calling |
||
| API Changes: | |||
| Internal Changes: | |||
Description
2017-03-26 19:02:18,394 Trac[formatter] ERROR: Macro Image(,) failed:
Traceback (most recent call last):
File "build/bdist.linux-x86_64/egg/trac/wiki/formatter.py", line 793, in _macro_formatter
return macro.ensure_inline(macro.process(args))
File "build/bdist.linux-x86_64/egg/trac/wiki/formatter.py", line 362, in process
text = self.processor(text)
File "build/bdist.linux-x86_64/egg/trac/wiki/formatter.py", line 349, in _macro_processor
text)
File "build/bdist.linux-x86_64/egg/trac/wiki/macros.py", line 539, in expand_macro
filespec = args.pop(0)
IndexError: pop from empty list
Proposed fix:
-
trac/wiki/macros.py
diff --git a/trac/wiki/macros.py b/trac/wiki/macros.py index ff502b567..71ec10467 100644
a b class ImageMacro(WikiMacroBase): 538 538 _quoted_re = re.compile("(?:[\"'])(.*)(?:[\"'])$") 539 539 540 540 def expand_macro(self, formatter, name, content): 541 args = None 541 542 if content: 542 543 content = stripws(content) 543 if not content: 544 # parse arguments 545 # we expect the 1st argument to be a filename (filespec) 546 args = [stripws(arg) for arg 547 in self._split_args_re.split(content)[1::2]] 548 if not args: 544 549 return '' 545 # parse arguments546 # we expect the 1st argument to be a filename (filespec)547 args = [stripws(arg) for arg548 in self._split_args_re.split(content)[1::2]]549 550 # strip unicode white-spaces and ZWSPs are copied from attachments 550 551 # section (#10668) 551 552 filespec = args.pop(0)
Attachments (0)
Change History (4)
comment:1 by , 9 years ago
| Owner: | set to |
|---|---|
| Release Notes: | modified (diff) |
| Status: | new → assigned |
comment:2 by , 9 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
follow-up: 4 comment:3 by , 8 years ago
Hi, the problem seems to persist in Version 1.2.2. This is the traceback I get when I try to upload an image:
... for event in msgbuf.translate(gettext(msgbuf.format())): Datei "/home/markusbarth/webapps/acco3/lib/python2.7/Genshi-0.7-py2.7-linux-x86_64.egg/genshi/filters/i18n.py", Zeile 1051, in translate events = self.events[order].pop(0)
comment:4 by , 8 years ago
Replying to markus@…:
Hi, the problem seems to persist in Version 1.2.2. This is the traceback I get when I try to upload an image:
No. Your problem is a duplicate of #11184. See TracFaq#Q:WhydoIseeIndexError:popfromemptylistwhentryingtoaddanattachment.
Note:
See TracTickets
for help on using tickets.



Committed to 1.2-stable in r15711, merged to trunk in r15712.