1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-10-07 01:30:03 +02:00

- escape attributes

This commit is contained in:
Marcus Huewe
2009-12-29 20:33:16 +01:00
parent d75888fbd4
commit f109054898

View File

@@ -565,11 +565,12 @@ class Osc(cmdln.Cmdln):
if cmd == 'attribute': if cmd == 'attribute':
if not opts.attribute: if not opts.attribute:
sys.exit('no attribute given to create') sys.exit('no attribute given to create')
values="" values= ''
if opts.set: if opts.set:
opts.set = opts.set.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')
for i in opts.set.split(','): for i in opts.set.split(','):
values+="<value>%s</value>" % i values += '<value>%s</value>' % i
d="""<attributes><attribute name='%s' >%s</attribute></attributes>""" % (opts.attribute, values) d = '<attributes><attribute name=\'%s\' >%s</attribute></attributes>' % (opts.attribute, values)
url = makeurl(conf.config['apiurl'], attributepath) url = makeurl(conf.config['apiurl'], attributepath)
f = http_POST(url, data=d) f = http_POST(url, data=d)
while 1: while 1: