mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-26 20:22:13 +01:00
Merge branch 'fix_#175' of https://github.com/lethliel/osc
Only accept valid user inputs.
This commit is contained in:
commit
9614cea39b
17
osc/core.py
17
osc/core.py
@ -4002,9 +4002,11 @@ def edit_text(data='', delim=None, suffix='.txt', template=''):
|
|||||||
(fd, filename) = tempfile.mkstemp(prefix='osc-editor', suffix=suffix)
|
(fd, filename) = tempfile.mkstemp(prefix='osc-editor', suffix=suffix)
|
||||||
os.close(fd)
|
os.close(fd)
|
||||||
mtime = os.stat(filename).st_mtime
|
mtime = os.stat(filename).st_mtime
|
||||||
|
ri_err = False
|
||||||
while True:
|
while True:
|
||||||
file_changed = _edit_message_open_editor(filename, data, mtime)
|
if not ri_err:
|
||||||
msg = open(filename).read()
|
file_changed = _edit_message_open_editor(filename, data, mtime)
|
||||||
|
msg = open(filename).read()
|
||||||
if delim:
|
if delim:
|
||||||
msg = msg.split(delim)[0].rstrip()
|
msg = msg.split(delim)[0].rstrip()
|
||||||
if msg and file_changed:
|
if msg and file_changed:
|
||||||
@ -4019,6 +4021,11 @@ def edit_text(data='', delim=None, suffix='.txt', template=''):
|
|||||||
elif ri in 'cC':
|
elif ri in 'cC':
|
||||||
break
|
break
|
||||||
elif ri in 'eE':
|
elif ri in 'eE':
|
||||||
|
ri_err = False
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
print("%s is not a valid option." % ri)
|
||||||
|
ri_err = True
|
||||||
pass
|
pass
|
||||||
finally:
|
finally:
|
||||||
os.unlink(filename)
|
os.unlink(filename)
|
||||||
@ -4419,6 +4426,9 @@ def check_existing_requests(apiurl, src_project, src_package, dst_project,
|
|||||||
print('There are already the following submit request: %s.' % \
|
print('There are already the following submit request: %s.' % \
|
||||||
', '.join([i.reqid for i in reqs]))
|
', '.join([i.reqid for i in reqs]))
|
||||||
repl = raw_input('Supersede the old requests? (y/n/c) ')
|
repl = raw_input('Supersede the old requests? (y/n/c) ')
|
||||||
|
while repl.lower() not in ['c', 'y', 'n']:
|
||||||
|
print('%s is not a valid option.' % repl)
|
||||||
|
repl = raw_input('Supersede the old requests? (y/n/c) ')
|
||||||
if repl.lower() == 'c':
|
if repl.lower() == 'c':
|
||||||
print('Aborting', file=sys.stderr)
|
print('Aborting', file=sys.stderr)
|
||||||
raise oscerr.UserAbort()
|
raise oscerr.UserAbort()
|
||||||
@ -4437,6 +4447,9 @@ def check_existing_maintenance_requests(apiurl, src_project, src_packages, dst_p
|
|||||||
print('There are already the following maintenance incident request: %s.' % \
|
print('There are already the following maintenance incident request: %s.' % \
|
||||||
', '.join([i.reqid for i in reqs]))
|
', '.join([i.reqid for i in reqs]))
|
||||||
repl = raw_input('Supersede the old requests? (y/n/c) ')
|
repl = raw_input('Supersede the old requests? (y/n/c) ')
|
||||||
|
while repl.lower() not in ['c', 'y', 'n']:
|
||||||
|
print('%s is not a valid option.' % repl)
|
||||||
|
repl = raw_input('Supersede the old requests? (y/n/c) ')
|
||||||
if repl.lower() == 'c':
|
if repl.lower() == 'c':
|
||||||
print('Aborting', file=sys.stderr)
|
print('Aborting', file=sys.stderr)
|
||||||
raise oscerr.UserAbort()
|
raise oscerr.UserAbort()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user