|
Lines 321-337
def object_input(module, object, input, append=None, remove=None):
Link Here
|
| 321 |
object[key]=[] |
321 |
object[key]=[] |
| 322 |
|
322 |
|
| 323 |
else: |
323 |
else: |
| 324 |
if type(object[key]) is str: |
324 |
current_values = [object[key]] if isinstance(object[key], basestring) else list(object[key]) |
| 325 |
object[key] = [ object[key] ] |
325 |
if value is None: |
| 326 |
vallist = value |
326 |
current_values = [] |
| 327 |
if type(value) is str: |
327 |
else: |
| 328 |
vallist = [ value ] |
328 |
vallist = [value] if isinstance(value, basestring) else value |
| 329 |
|
329 |
|
| 330 |
for val in vallist: |
330 |
for val in vallist: |
| 331 |
if val in object[key]: |
331 |
if val in current_values: |
| 332 |
object[key].remove(val) |
332 |
current_values.remove(val) |
| 333 |
else: |
333 |
else: |
| 334 |
out.append("WARNING: cannot remove %s from %s, value does not exist"%(val,key)) |
334 |
out.append("WARNING: cannot remove %s from %s, value does not exist"%(val,key)) |
|
|
335 |
object[key] = current_values |
| 335 |
if input: |
336 |
if input: |
| 336 |
for key, value in input.items(): |
337 |
for key, value in input.items(): |
| 337 |
if module.property_descriptions[key].syntax.name == 'binaryfile': |
338 |
if module.property_descriptions[key].syntax.name == 'binaryfile': |
|
Lines 1258-1260
def _doit(arglist):
Link Here
|
| 1258 |
return out + ["OPERATION FAILED"] |
1259 |
return out + ["OPERATION FAILED"] |
| 1259 |
|
1260 |
|
| 1260 |
return out # nearly the only successfull return |
1261 |
return out # nearly the only successfull return |
|
|
1262 |
|
| 1263 |
if __name__ == '__main__': |
| 1264 |
import sys |
| 1265 |
print '\n'.join(doit(sys.argv)) |