Mercurial > p > roundup > code
comparison roundup/cgi/client.py @ 1328:b4d4770658c1
allow multiple :remove and :add elements per property being edited
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 11 Dec 2002 01:46:46 +0000 |
| parents | 43e5262dd90c |
| children | 6a54b51b1784 |
comparison
equal
deleted
inserted
replaced
| 1327:7af3f0df307b | 1328:b4d4770658c1 |
|---|---|
| 1 # $Id: client.py,v 1.61 2002-12-10 23:39:40 richard Exp $ | 1 # $Id: client.py,v 1.62 2002-12-11 01:46:46 richard Exp $ |
| 2 | 2 |
| 3 __doc__ = """ | 3 __doc__ = """ |
| 4 WWW request handler (also used in the stand-alone server). | 4 WWW request handler (also used in the stand-alone server). |
| 5 """ | 5 """ |
| 6 | 6 |
| 1171 required = [i.strip() for i in value.value.split(',')] | 1171 required = [i.strip() for i in value.value.split(',')] |
| 1172 | 1172 |
| 1173 props = {} | 1173 props = {} |
| 1174 keys = form.keys() | 1174 keys = form.keys() |
| 1175 properties = cl.getprops() | 1175 properties = cl.getprops() |
| 1176 existing_cache = {} | |
| 1176 for key in keys: | 1177 for key in keys: |
| 1177 # see if we're performing a special multilink action | 1178 # see if we're performing a special multilink action |
| 1178 mlaction = 'set' | 1179 mlaction = 'set' |
| 1179 if key.startswith(':remove:'): | 1180 if key.startswith(':remove:'): |
| 1180 propname = key[8:] | 1181 propname = key[8:] |
| 1287 # now use that list of ids to modify the multilink | 1288 # now use that list of ids to modify the multilink |
| 1288 if mlaction == 'set': | 1289 if mlaction == 'set': |
| 1289 value = l | 1290 value = l |
| 1290 else: | 1291 else: |
| 1291 # we're modifying the list - get the current list of ids | 1292 # we're modifying the list - get the current list of ids |
| 1292 try: | 1293 if props.has_key(propname): |
| 1293 existing = cl.get(nodeid, propname) | 1294 existing = props[propname] |
| 1294 except KeyError: | 1295 else: |
| 1295 existing = [] | 1296 existing = cl.get(nodeid, propname, []) |
| 1297 | |
| 1298 # now either remove or add | |
| 1296 if mlaction == 'remove': | 1299 if mlaction == 'remove': |
| 1297 # remove - handle situation where the id isn't in the list | 1300 # remove - handle situation where the id isn't in the list |
| 1298 for entry in l: | 1301 for entry in l: |
| 1299 try: | 1302 try: |
| 1300 existing.remove(entry) | 1303 existing.remove(entry) |
