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,13 +565,14 @@ 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:
for i in opts.set.split(','): opts.set = opts.set.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')
values+="<value>%s</value>" % i for i in opts.set.split(','):
d="""<attributes><attribute name='%s' >%s</attribute></attributes>""" % (opts.attribute, values) values += '<value>%s</value>' % i
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:
buf = f.read(16384) buf = f.read(16384)
if not buf: break if not buf: break