id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc,branch,changelog,apichanges,internalchanges 7706,ValueError: too many values to unpack,gwk,Remy Blank,"==== How to Reproduce ==== While doing a GET operation on `/changeset/1032:e33a4c091c1e hg-v14`, Trac issued an internal error. I think the problem is some invalid markup in the changeset comment. I tried to hyperlink to a comment within a ticket, and I used the syntax {{{ ...according to #507#comment:18 in order to... }}} While this might be invalid, I would like to get Trac to react gracefully. I would even like to patch it myself but I can't quite understand why it complains ""too many values to unpack"". If you look at the variable value for lastp below, it does have exactly 2 values, and the failing code is `for k, v in lastp`. That looks correct to me. Could someone with more Python powers please teach my why it fails and maybe give a hint how to fix? ---- Request parameters: {{{ {'new': u'1032:e33a4c091c1e', 'new_path': u'/hg-v14'} }}} User Agent was: `Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.0.3) Gecko/2008092510 Ubuntu/8.04 (hardy) Firefox/3.0.3` ==== System Information ==== || '''Trac''' || `0.12multirepos` || || '''Python''' || `2.3.4 (#1, Jan 9 2007, 16:40:09) ` [[br]] `[GCC 3.4.6 20060404 (Red Hat 3.4.6-3)]` || || '''setuptools''' || `0.6c8` || || '''SQLite''' || `3.3.6` || || '''pysqlite''' || `2.3.3` || || '''Genshi''' || `0.5` || || '''Pygments''' || `0.10` || || '''Subversion''' || `1.4.6 (r28521)` || || '''Mercurial''' || `1.0.1` || || '''jQuery:''' || `1.2.3` || ==== Python Traceback ==== {{{ Most recent call last: * File ""/usr/local/trac-multirepos/lib/python2.3/site-packages/Trac-0.12multirepos-py2.3.egg/trac/versioncontrol/templates/changeset.html"", line 1, in Code fragment: 1. 4. Local variables: Name Value __data__ [{'changeset': ,) fargs (>, ... fkwargs {'escape_newlines': True} func_ kwargs {} * File ""/usr/local/trac-multirepos/lib/python2.3/site-packages/Trac-0.12multirepos-py2.3.egg/trac/wiki/formatter.py"", line 1107, in format_to_html Code fragment: 1102. return format_to_html(env, context, wikidom, **options) 1103. 1104. def format_to_html(env, context, wikidom, escape_newlines=False): 1105. if not wikidom: 1106. return Markup() 1107. return HtmlFormatter(env, context, wikidom).generate(escape_newlines) 1108. 1109. def format_to_oneliner(env, context, wikidom, shorten=False): 1110. if not wikidom: 1111. return Markup() 1112. return InlineHtmlFormatter(env, context, wikidom).generate(shorten) Local variables: Name Value context > env escape_newlines True wikidom u'refactor to introduce portal and portal instance model\n\nrefactor the ... * File ""/usr/local/trac-multirepos/lib/python2.3/site-packages/Trac-0.12multirepos-py2.3.egg/trac/wiki/formatter.py"", line 1066, in generate Code fragment: 1061. newlines in the wikidom will be preserved if `escape_newlines` is set. 1062. """""" 1063. # FIXME: compatibility code only for now 1064. out = StringIO() 1065. Formatter(self.env, self.context).format(self.wikidom, out, 1066. escape_newlines) 1067. return Markup(out.getvalue()) 1068. 1069. 1070. class InlineHtmlFormatter(object): 1071. """"""Format parsed wiki text to inline elements HTML. Local variables: Name Value escape_newlines True out self * File ""/usr/local/trac-multirepos/lib/python2.3/site-packages/Trac-0.12multirepos-py2.3.egg/trac/wiki/formatter.py"", line 862, in format Code fragment: 857. if escape_newlines: 858. line += ' [[BR]]' 859. self.in_list_item = False 860. self.in_quote = False 861. # Throw a bunch of regexps on the problem 862. result = re.sub(self.wikiparser.rules, self.replace, line) 863. 864. if not self.in_list_item: 865. self.close_list() 866. 867. if not self.in_quote: Local variables: Name Value escape_newlines True line u'refactor the code according to #507#comment:18 in order to introduce ... out result u'refactor to introduce portal and portal instance model
' self text u'refactor to introduce portal and portal instance model\n\nrefactor the ... * File ""/usr/lib64/python2.3/sre.py"", line 143, in sub Code fragment: 138. 139. def sub(pattern, repl, string, count=0): 140. """"""Return the string obtained by replacing the leftmost 141. non-overlapping occurrences of the pattern in string by the 142. replacement repl"""""" 143. return _compile(pattern, 0).sub(repl, string, count) 144. 145. def subn(pattern, repl, string, count=0): 146. """"""Return a 2-tuple containing (new_string, number). 147. new_string is the string obtained by replacing the leftmost 148. non-overlapping occurrences of the pattern in the source Local variables: Name Value count 0 pattern <_sre.SRE_Pattern object at 0xcd8e80> repl self * File ""/usr/local/trac-multirepos/lib/python2.3/site-packages/Trac-0.12multirepos-py2.3.egg/trac/wiki/formatter.py"", line 803, in handle_match Code fragment: 798. if itype in self.wikiparser.external_handlers: 799. external_handler = self.wikiparser.external_handlers[itype] 800. return external_handler(self, match, fullmatch) 801. else: 802. internal_handler = getattr(self, '_%s_formatter' % itype) 803. return internal_handler(match, fullmatch) 804. 805. def replace(self, fullmatch): 806. """"""Replace one match with its corresponding expansion"""""" 807. replacement = self.handle_match(fullmatch) 808. if replacement: Local variables: Name Value fullmatch <_sre.SRE_Match object at 0x12d2800> internal_handler * File ""/usr/local/trac-multirepos/lib/python2.3/site-packages/Trac-0.12multirepos-py2.3.egg/trac/wiki/formatter.py"", line 344, in _shref_formatter Code fragment: 339. return text 340. 341. def _shref_formatter(self, match, fullmatch): 342. ns = fullmatch.group('sns') 343. target = self._unquote(fullmatch.group('stgt')) 344. return self._make_link(ns, target, match, match, fullmatch) 345. 346. def _lhref_formatter(self, match, fullmatch): 347. rel = fullmatch.group('rel') 348. ns = fullmatch.group('lns') 349. target = self._unquote(fullmatch.group('ltgt')) Local variables: Name Value fullmatch <_sre.SRE_Match object at 0x12d2800> match u'comment:18' ns u'comment' self target u'18' * File ""/usr/local/trac-multirepos/lib/python2.3/site-packages/Trac-0.12multirepos-py2.3.egg/trac/wiki/formatter.py"", line 381, in _make_link Code fragment: 376. def _make_link(self, ns, target, match, label, fullmatch): 377. # first check for an alias defined in trac.ini 378. ns = self.env.config['intertrac'].get(ns, ns) 379. if ns in self.wikiparser.link_resolvers: 380. return self.wikiparser.link_resolvers[ns](self, ns, target, 381. escape(label, False)) 382. elif target.startswith('//'): 383. return self._make_ext_link(ns+':'+target, label) 384. elif ns == ""mailto"": 385. from trac.web.chrome import Chrome 386. otarget = Chrome(self.env).format_emails(self.context, target) Local variables: Name Value fullmatch <_sre.SRE_Match object at 0x12d2800> label u'comment:18' match u'comment:18' ns u'comment' self target u'18' * File ""/usr/local/trac-multirepos/lib/python2.3/site-packages/Trac-0.12multirepos-py2.3.egg/trac/ticket/api.py"", line 361, in _format_comment_link Code fragment: 356. else: 357. resource = formatter.resource 358. cnum = target 359. 360. if resource: 361. href = ""%s#comment:%s"" % (formatter.href.ticket(resource.id), cnum) 362. title = _(""Comment %(cnum)s for Ticket #%(id)s"", cnum=cnum, 363. id=resource.id) 364. return tag.a(label, href=href, title=title) 365. else: 366. return label Local variables: Name Value cnum u'18' formatter label ns u'comment' resource self target u'18' * File ""/usr/local/trac-multirepos/lib/python2.3/site-packages/Trac-0.12multirepos-py2.3.egg/trac/web/href.py"", line 163, in Code fragment: 158. 159. return href 160. 161. def __getattr__(self, name): 162. if not self._derived.has_key(name): 163. self._derived[name] = lambda *args, **kw: self(name, *args, **kw) 164. return self._derived[name] 165. 166. 167. if __name__ == '__main__': 168. import doctest, sys Local variables: Name Value args (('hg-v14', '1032:e33a4c091c1e'),) kw {} name 'ticket' self * File ""/usr/local/trac-multirepos/lib/python2.3/site-packages/Trac-0.12multirepos-py2.3.egg/trac/web/href.py"", line 142, in __call__ Code fragment: 137. if lastp and type(lastp) is dict: 138. for k,v in lastp.items(): 139. add_param(k, v) 140. args = args[:-1] 141. elif lastp and type(lastp) in (list, tuple): 142. for k,v in lastp: 143. add_param(k, v) 144. args = args[:-1] 145. 146. # build the path 147. path = '/'.join([unicode_quote(unicode(arg).strip('/')) for arg in args Local variables: Name Value add_param args ('ticket', ('hg-v14', '1032:e33a4c091c1e')) href '/trac/SimManager' kw {} lastp ('hg-v14', '1032:e33a4c091c1e') params [] self File ""/usr/local/trac-multirepos/lib/python2.3/site-packages/Trac-0.12multirepos-py2.3.egg/trac/versioncontrol/templates/changeset.html"", line 1, in self._derived[name] = lambda *args, **kw: self(name, *args, **kw) File ""/usr/local/trac-multirepos/lib/python2.3/site-packages/Trac-0.12multirepos-py2.3.egg/trac/web/href.py"", line 142, in __call__ for k,v in lastp: }}}",defect,closed,high,0.12-multirepos,version control,0.12dev,normal,fixed,multirepos,gwk.rko@… androsis@…,,,,