[Reportbug-commits] [SCM] Reportbug - reports bugs in the Debian distribution branch, master, updated. 4.0-29-gb92ef3b

Sandro Tosi morph at debian.org
Sun Apr 5 19:26:23 UTC 2009


The following commit has been merged in the master branch:
commit 90b380ce51e5c7fd68bbed45a942f3a03d5247e3
Author: Luca Bruno <lethalman88 at gmail.com>
Date:   Fri Mar 27 11:12:36 2009 +0100

    specify whether the get_string result can be empty or not. Fixes #521162/5

diff --git a/bin/reportbug b/bin/reportbug
index 9b80f51..9cac29d 100755
--- a/bin/reportbug
+++ b/bin/reportbug
@@ -488,7 +488,7 @@ def offer_configuration(options):
             'If you need to use a different port than default, use the '
             '<host>:<port> alternative format. '
             'Just press ENTER if you don\'t have one or don\'t know.',
-            options=opts, force_prompt=True)
+            options=opts, empty_ok=True, force_prompt=True)
         if smtphost:
             stupidmode = False
     else:
@@ -498,7 +498,7 @@ def offer_configuration(options):
         smtpuser = ui.get_string(
             ('If you need to use a user name to send email via "%s" on your '
              'computer, please enter that user name.  Just press ENTER if you '
-             'don\'t need a user name.' % smtphost), force_prompt=True)
+             'don\'t need a user name.' % smtphost), empty_ok=True, force_prompt=True)
     else:
         smtpuser = ''
     
@@ -1276,7 +1276,7 @@ class UI(object):
             if not (isvirtual or notatty):
                 pkgversion = ui.get_string('Please enter the version of the '
                                            'package this report applies to '
-                                           '(blank OK)', force_prompt=True)
+                                           '(blank OK)', empty_ok=True, force_prompt=True)
         elif (check_available and not (self.options.kudos or notatty or self.options.offline)
               and state == 'installed' and bts == 'debian'):
             arch = utils.get_arch()
@@ -1547,7 +1547,7 @@ For more details, please see: http://www.debian.org/devel/wnpp/''')
             subject = ui.get_string(
                 'Your description is a bit long; please enter a shorter subject. '
                 '(An empty response will retain the existing subject.)',
-                force_prompt=True) or subject
+                empty_ok=True, force_prompt=True) or subject
         if package != 'wnpp' and prompted and mode < MODE_EXPERT:
             if foundfile:
                 subject = foundfile + ": " + subject
diff --git a/debian/changelog b/debian/changelog
index c014e08..44e5a54 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -18,6 +18,7 @@ reportbug (4.1) UNRELEASED; urgency=low
     - fix default when choosing for realname and email at configuration time
     - offer interface configuration on explicit configuration or when no
       interface is being specified (the used interface is set as default)
+    - specify whether the get_string result can be empty or not
   * reportbug/debianbts.py
     - use ui proper functions instead of ewrite; thanks to Jan Hauke Rahm for
       the report; Closes: #521113
diff --git a/reportbug/ui/gtk2_ui.py b/reportbug/ui/gtk2_ui.py
index 6570f7c..77eca3a 100644
--- a/reportbug/ui/gtk2_ui.py
+++ b/reportbug/ui/gtk2_ui.py
@@ -575,11 +575,8 @@ class GetStringPage (Page):
     def get_value (self):
         return self.entry.get_text ()
 
-    def execute (self, prompt, options=None, force_prompt=False, default=''):
-        if 'blank OK' in prompt:
-            self.empty_ok = True
-        else:
-            self.empty_ok = False
+    def execute (self, prompt, options=None, empty_ok=False, force_prompt=False, default=''):
+        self.empty_ok = empty_ok
         self.label.set_text (prompt)
         self.entry.set_text (default)
 
diff --git a/reportbug/ui/text_ui.py b/reportbug/ui/text_ui.py
index dd3670a..269749b 100644
--- a/reportbug/ui/text_ui.py
+++ b/reportbug/ui/text_ui.py
@@ -224,7 +224,7 @@ def long_message(text, *args):
 
 final_message = long_message
 
-def get_string(prompt, options=None, title=None, force_prompt=False,
+def get_string(prompt, options=None, title=None, empty_ok=False, force_prompt=False,
                default='', completer=None):
     if prompt and (len(prompt) < 2*columns/3) and not force_prompt:
         if default:
diff --git a/reportbug/ui/urwid_ui.py b/reportbug/ui/urwid_ui.py
index cbd47d2..e0b000c 100644
--- a/reportbug/ui/urwid_ui.py
+++ b/reportbug/ui/urwid_ui.py
@@ -349,7 +349,7 @@ def yes_no(msg, yeshelp, nohelp, default=True, nowrap=False, ui=None):
     result = box.main(ui)
     return result
 
-def get_string(prompt, options=None, title=None, force_prompt=False,
+def get_string(prompt, options=None, title=None, empty_ok=False, force_prompt=False,
                default='', ui=None):
     if title:
         title = '%s: %s' % (VERSION, title)

-- 
Reportbug - reports bugs in the Debian distribution



More information about the Reportbug-commits mailing list