Roundup Tracker - Issues

Issue 2550673

classification
"Make a copy" fails if superseder set
Type: crash Severity: normal
Components: Web interface Versions: 1.4
process
Status: fixed fixed
:
: rouilj : ThomasAH, rouilj
Priority: normal : patch

Created on 2010-10-19 09:47 by ThomasAH, last changed 2013-10-08 13:49 by rouilj.

Messages
msg4164 Author: [hidden] (ThomasAH) Date: 2010-10-19 09:47
Noticed with Roundup 1.4.11:
"Make a copy" generally works, but if superseder is set, a traceback is
sent to the admin:

   Full traceback:
   Traceback (most recent call last):
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/client.py", line
1010, in renderContext
       result = pt.render(self, None, None, **args)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/templating.py", line
343, in render
       getEngine().getContext(c), output, tal=1, strictinsert=0)()
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 192, in __call__
       self.interpret(self.program)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 236, in interpret
       handlers[opcode](self, args)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 666, in do_useMacro
       self.interpret(macro)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 236, in interpret
       handlers[opcode](self, args)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 411, in do_optTag_tal
       self.do_optTag(stuff)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 396, in do_optTag
       return self.no_tag(start, program)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 391, in no_tag
       self.interpret(program)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 236, in interpret
       handlers[opcode](self, args)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 689, in do_defineSlot
       self.interpret(slot)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 236, in interpret
       handlers[opcode](self, args)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 632, in do_condition
       self.interpret(block)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 236, in interpret
       handlers[opcode](self, args)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 411, in do_optTag_tal
       self.do_optTag(stuff)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 396, in do_optTag
       return self.no_tag(start, program)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 391, in no_tag
       self.interpret(program)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 236, in interpret
       handlers[opcode](self, args)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 645, in do_defineMacro
       self.interpret(macro)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 236, in interpret
       handlers[opcode](self, args)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 632, in do_condition
       self.interpret(block)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 236, in interpret
       handlers[opcode](self, args)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 608, in do_loop_tal
       self.interpret(block)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 236, in interpret
       handlers[opcode](self, args)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 411, in do_optTag_tal
       self.do_optTag(stuff)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 396, in do_optTag
       return self.no_tag(start, program)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 391, in no_tag
       self.interpret(program)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 236, in interpret
       handlers[opcode](self, args)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 293, in do_startTag
       ok, name, s = attrAction(self, item)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 359, in attrAction_tal
       evalue = self.engine.evaluateText(item[3])
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/PageTemplates/TALES.py",
line 233, in evaluateText
       text = self.evaluate(expr)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/PageTemplates/TALES.py",
line 227, in evaluate
       return expression(self)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/PageTemplates/Expressions.py",
line 195, in __call__
       return self._eval(econtext)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/PageTemplates/Expressions.py",
line 183, in _eval
       ob = self._subexprs[-1](econtext)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/PageTemplates/Expressions.py",
line 139, in _eval
       ob = restrictedTraverse(ob, path, getSecurityManager())
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/PageTemplates/Expressions.py",
line 318, in restrictedTraverse
       o = guarded_getattr(object, name, M)
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/templating.py", line
873, in __getattr__
       return self[attr]
     File
"/usr/local/lib/python2.5/site-packages/roundup/cgi/templating.py", line
849, in __getitem__
       if int(self._nodeid) > 0:
   ValueError: invalid literal for int() with base 10: '(title of the
superseder issue)'
msg4165 Author: [hidden] (ThomasAH) Date: 2010-10-19 10:20
The traceback is caused by a local modification, but the original
problem is in vanilla roundup with classic template, too:

The Superseder input field contains the title of the issue instead of
the issue number, so submitting the cloned issue does not work:
Error: you may only enter ID values for property superseder
msg4928 Author: [hidden] (rouilj) Date: 2013-10-07 03:38
I think this is a problem with any multilink field.

The following patch to roundup/cgi/templating.py I think fixes it

         for name in self._props.keys():
             if name not in exclude:
-                query[name] = self[name].plain()
+                prop = self._props[name]
+                if not isinstance(prop, hyperdb.Multilink):
+                    query[name] = self[name].plain()
+                else:
+                    query[name] =
",".join(self._klass.get(self._nodeid, name))
+
         return self._classname + "?" + "&".join(

If it's not a multilink then copy the attributes across as it
does currently. If it's a multilink, get the list of multilink
values from the database and turn it into a comma separated list.

AFAIK, copy_url always works with the data from the database
and not any changes done to the form displaying the "Make a copy"
url. Can anybody confirm this assumption?

If my assumption is correct, I will check in this change for further
testing and release on the next release cycle.
msg4930 Author: [hidden] (ThomasAH) Date: 2013-10-07 06:29
The "Make a copy" link is not a button, so (without some extra magic) it
can't use the form data.
I think improving that part and making the copy function work in general
are separate things.

Regarding your patch: I think it looks good. I haven't checked, but I
assume that the multilinks always only include numbers, so no escaping
is needed, correct?
msg4931 Author: [hidden] (ThomasAH) Date: 2013-10-07 12:55
Your suggested patch works fine (tested with a modified classic
tracker), please commit/push it.
msg4932 Author: [hidden] (rouilj) Date: 2013-10-07 13:22
In message <1381127384.24.0.717452925435.issue2550673@psf.upfronthosting.co.za>
 <1381127384.24.0.717452925435.issue2550673@psf.upfronthosting.co.za>,
Thomas Arendsen Hein writes:
>Thomas Arendsen Hein added the comment:
>
>The "Make a copy" link is not a button, so (without some extra magic) it
>can't use the form data.
>I think improving that part and making the copy function work in general
>are separate things.

Ok good. That was my understanding as well.

>Regarding your patch: I think it looks good. I haven't checked, but I
>assume that the multilinks always only include numbers, so no escaping
>is needed, correct?

Yes. So far I have tested it with the nosy list (multilink to users),
dependson list (multilink to issues) and topic (multilink to
keywords). So I'm assuming it will work with other multilinks as well.

It is url encoded to:

   keyword=5%2C6%2C8&nosy=1%2C3

which is keyword=5,6,8 nosy=1,3.
msg4933 Author: [hidden] (rouilj) Date: 2013-10-07 23:33
Checked in:

changeset:   4839:c317147fd891
tag:         tip
user:        John Rouillard <rouilj@ieee.org>
date:        Mon Oct 07 19:29:33 2013 -0400
files:       CHANGES.txt roundup/cgi/templating.py
description:
Fix copy_url to properly support properties that are mutlilinks.


Should this be changed to pending or closed? I am changing to pending
now since the fix is pending new release. Feel free to fix this if
it should be closed.
msg4934 Author: [hidden] (rouilj) Date: 2013-10-07 23:40
Note that there is one issue with this fix. The newly created issue
uses a text input box for the multiselect.

If you usually use a option multiselect (e.g. with select2 to provide
a better multiselect interface) it will be overridden in the default
interface. The normal (list) javascript assistant works ok.

This is probably a feature enhancement that should be in a different
issue, but I thought I'd mention it here since it's a side effect
of the fix.
History
Date User Action Args
2013-10-08 13:49:16rouiljsetstatus: pending -> fixed
2013-10-07 23:40:03rouiljsetresolution: fixed
messages: + msg4934
2013-10-07 23:33:24rouiljsetstatus: open -> pending
messages: + msg4933
2013-10-07 13:22:48rouiljsetmessages: + msg4932
2013-10-07 12:55:33ThomasAHsetkeywords: + patch
priority: normal
status: new -> open
messages: + msg4931
2013-10-07 06:29:44ThomasAHsetmessages: + msg4930
2013-10-07 03:38:09rouiljsetassignee: rouilj
messages: + msg4928
nosy: + rouilj
2010-10-19 10:20:35ThomasAHsetmessages: + msg4165
2010-10-19 09:47:42ThomasAHcreate