optional_edit was a silly idea

This commit is contained in:
Stefano Rivera 2011-11-13 20:53:39 +02:00
parent 054423d016
commit 629fbd14ad
2 changed files with 9 additions and 13 deletions

View File

@ -305,10 +305,7 @@ def main():
report += changelog
editor = EditBugReport(title, report)
if need_interaction:
editor.edit()
else:
editor.optional_edit()
editor.edit(optional=not need_interaction)
title, report = editor.get_report()
if 'XXX FIXME' in report:

View File

@ -119,15 +119,14 @@ class EditFile(object):
placeholders = (re.compile(r'^<<<.*>>>$', re.UNICODE),)
self.placeholders = placeholders
def optional_edit(self):
'''Prompt the user to decide if the file needs editing'''
print "Currently the %s looks like:" % self.description
with open(self.filename, 'r') as f:
print f.read()
if YesNoQuestion().ask("Edit", "no") == "yes":
self.edit()
def edit(self, optional=False):
if optional:
print "Currently the %s looks like:" % self.description
with open(self.filename, 'r') as f:
print f.read()
if YesNoQuestion().ask("Edit", "no") == "no":
return
def edit(self):
done = False
while not done:
old_mtime = os.stat(self.filename).st_mtime
@ -146,7 +145,7 @@ class EditFile(object):
print ("Placeholders still present in the %s. "
"Please replace them with useful information."
% self.description)
confirmation_prompt('edit again')
confirmation_prompt(action='edit again')
elif not modified:
print "The %s was not modified" % self.description
if YesNoQuestion().ask("Edit again", "yes") == "no":