1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-27 02:16:12 +01:00

- api now sends HTTP/1.1 400 Bad Request for invalid xml. Thus, show the reply

body because it contains helpful info.
- repair linkpac for the new metadata editing facilities. copypac still seems
  to work.
This commit is contained in:
Dr. Peter Poeml 2007-07-16 17:06:06 +00:00
parent 5284a9b783
commit b5e1dec8ad
2 changed files with 16 additions and 7 deletions

View File

@ -815,6 +815,12 @@ class Osc(cmdln.Cmdln):
args = parseargs(args)
pacs = findpacs(args)
# this is experimental in that it enables a different way of uploading files
# see osc.core.Package.put_source_file()
# I assume that if -m is used, we want to commit this way.
if opts.message:
conf.config['do_commits'] = True
for p in pacs:
if conf.config['do_commits']:

View File

@ -933,8 +933,13 @@ class metafile:
return True
except urllib2.HTTPError, e:
# internal server error (probably the xml file is incorrect)
if e.code == 400:
print >>sys.stderr, 'Cannot save meta data.'
print >>sys.stderr, e
print >>sys.stderr, e.read()
return False
if e.code == 500:
print >>sys.stderr, 'cannot save meta data - probably your xml file is incorrect'
print >>sys.stderr, 'Cannot save meta data. Unknown error.'
print >>sys.stderr, e
# this may be unhelpful... because it may just print a big blob of uninteresting
# ichain html and javascript... however it could potentially be useful if the orign
@ -1222,18 +1227,16 @@ def link_pac(src_project, src_package, dst_project, dst_package):
# and create the package
tree = ET.parse(StringIO(''.join(src_meta)))
root = tree.getroot()
root.set('name', '%s')
root.set('name', dst_package)
root.set('project', dst_project)
tree.find('person').set('userid', '%s')
tree.find('person').set('userid', conf.config['user'])
buf = StringIO()
tree.write(buf)
src_meta = buf.getvalue()
#edit_meta(dst_project, dst_package, template=src_meta)
edit_meta('pkg',
input=src_meta,
edit_meta('pkg',
path_args=(dst_project, dst_package),
template_args=(dst_package, conf.config['user']))
data=src_meta)
# create the _link file
# but first, make sure not to overwrite an existing one