Mercurial > p > roundup > code
comparison roundup/cgi/actions.py @ 4304:df7a4400c2ce
Fix linking of an existing item to a newly created item...
...e.g. edit action in web template is name="issue-1@link@msg"
value="msg1" would trigger a traceback about an unbound variable. Add
new regression test for this case.
| author | Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net> |
|---|---|
| date | Mon, 14 Dec 2009 19:43:44 +0000 |
| parents | 9b9ab6109254 |
| children | 8e0d350ce644 |
comparison
equal
deleted
inserted
replaced
| 4303:7aa72c31464d | 4304:df7a4400c2ce |
|---|---|
| 476 propdef = cl.getprops()[linkprop] | 476 propdef = cl.getprops()[linkprop] |
| 477 if not props.has_key(linkprop): | 477 if not props.has_key(linkprop): |
| 478 if linkid is None or linkid.startswith('-'): | 478 if linkid is None or linkid.startswith('-'): |
| 479 # linking to a new item | 479 # linking to a new item |
| 480 if isinstance(propdef, hyperdb.Multilink): | 480 if isinstance(propdef, hyperdb.Multilink): |
| 481 props[linkprop] = [newid] | 481 props[linkprop] = [nodeid] |
| 482 else: | 482 else: |
| 483 props[linkprop] = newid | 483 props[linkprop] = nodeid |
| 484 else: | 484 else: |
| 485 # linking to an existing item | 485 # linking to an existing item |
| 486 if isinstance(propdef, hyperdb.Multilink): | 486 if isinstance(propdef, hyperdb.Multilink): |
| 487 existing = cl.get(linkid, linkprop)[:] | 487 existing = cl.get(linkid, linkprop)[:] |
| 488 existing.append(nodeid) | 488 existing.append(nodeid) |
| 489 props[linkprop] = existing | 489 props[linkprop] = existing |
| 490 else: | 490 else: |
| 491 props[linkprop] = newid | 491 props[linkprop] = nodeid |
| 492 | 492 |
| 493 return '<br>'.join(m) | 493 return '<br>'.join(m) |
| 494 | 494 |
| 495 def _changenode(self, cn, nodeid, props): | 495 def _changenode(self, cn, nodeid, props): |
| 496 """Change the node based on the contents of the form.""" | 496 """Change the node based on the contents of the form.""" |
