Edgewall Software

Opened 9 years ago

Last modified 8 years ago

#12234 closed defect

TypeError: unsupported operand type(s) for +: 'NoneType' and 'str' — at Initial Version

Reported by: anonymous Owned by:
Priority: normal Milestone: 1.0.12
Component: wiki system Version: 0.12.3
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Internal Error occurred when I added follow strings in wiki pages.

[[//a ] ]]

Most recent call last:

File "/var/service/python-2.6.6/lib/python2.6/site-packages/trac/wiki/templates/wiki_edit.html", line 136, in <Expression u'wiki_to_html(context(page.resource), page.text)'>
  ${wiki_to_html(context(page.resource), page.text)}
File "/var/service/python-2.6.6/lib/python2.6/site-packages/trac/wiki/formatter.py", line 1501, in format_to_html
  return HtmlFormatter(env, context, wikidom).generate(escape_newlines)
File "/var/service/python-2.6.6/lib/python2.6/site-packages/trac/wiki/formatter.py", line 1456, in generate
  escape_newlines)
File "/var/service/python-2.6.6/lib/python2.6/site-packages/trac/wiki/formatter.py", line 1243, in format
  result = re.sub(self.wikiparser.rules, self.replace, line)
File "/var/service/python-2.6.6/lib/python2.6/re.py", line 151, in sub
  return _compile(pattern, 0).sub(repl, string, count)
File "/var/service/python-2.6.6/lib/python2.6/site-packages/trac/wiki/formatter.py", line 1161, in replace
  replacement = self.handle_match(fullmatch)
File "/var/service/python-2.6.6/lib/python2.6/site-packages/trac/wiki/formatter.py", line 1157, in handle_match
  return internal_handler(match, fullmatch)
File "/var/service/python-2.6.6/lib/python2.6/site-packages/trac/wiki/formatter.py", line 709, in _macrolink_formatter
  return self._lhref_formatter(match, fullmatch)
File "/var/service/python-2.6.6/lib/python2.6/site-packages/trac/wiki/formatter.py", line 540, in _lhref_formatter
  return self._make_lhref_link(match, fullmatch, rel, ns, target, label)
File "/var/service/python-2.6.6/lib/python2.6/site-packages/trac/wiki/formatter.py", line 546, in _make_lhref_link
  label = ns + ':' + target   #  use `http://target`

System Information:

  • Trac 0.12.3.ja2
  • Babel 0.9.5
  • Genshi 0.6
  • Python 2.6.6 (r266:84292, Mar 1 2011, 20:55:51) [GCC 4.1.2 20080704 (Red Hat 4.1.2-48)]

We create the following patch as a provisional, and have applied it.

  • src/trac/wiki/formatter.py

    diff --git a/src/trac/wiki/formatter.py b/src/trac/wiki/formatter.py
    index 6495550..442b35f 100644
    a b class Formatter(object):  
    542542    def _make_lhref_link(self, match, fullmatch, rel, ns, target, label):
    543543        if not label: # e.g. `[http://target]` or `[wiki:target]`
    544544            if target:
    545                 if target.startswith('//'):     # for `[http://target]`
     545                if ns and target.startswith('//'):     # for `[http://target]`
    546546                    label = ns + ':' + target   #  use `http://target`
    547547                else:                           # for `wiki:target`
    548548                    label = target.lstrip('/')  #  use only `target`

Change History (0)

Note: See TracTickets for help on using tickets.