[Reportbug-commits] [SCM] Reportbug - reports bugs in the Debian distribution branch, master, updated. 4.8-22-gac12227

Luca Bruno lethalman88 at gmail.com
Thu Nov 26 21:19:14 UTC 2009


The following commit has been merged in the master branch:
commit 0826da272cd9369170d2891c198470b9b41ed862
Author: Luca Bruno <lethalman88 at gmail.com>
Date:   Sun Nov 22 12:07:55 2009 +0100

    ask ui.can_input() to know whether the ui is able to receive input or not; thanks to Sebastian Dalfuß; Closes: #531803

diff --git a/bin/reportbug b/bin/reportbug
index ba3fe78..2c323cc 100755
--- a/bin/reportbug
+++ b/bin/reportbug
@@ -708,10 +708,6 @@ def main():
                     bodyfile=None, smtptls=False, smtpuser='', smtppasswd='',
                     paranoid=False)
 
-    if not sys.stdin.isatty():
-        defaults.update({ 'dontquery' : True, 'notatty' : True,
-                          'printonly' : True })
-
     # Convention: consider `option.foo' names read-only; they always contain
     # the original value as determined by the cascade of command-line options
     # and configuration files.  When we need to adjust a value, we first say
@@ -953,6 +949,10 @@ def main():
         # a new bug should be filed against it.
         os.environ['INTERFACE'] = interface
 
+    if not ui.can_input():
+        defaults.update({ 'dontquery' : True, 'notatty' : True,
+                          'printonly' : True })
+
     iface = UI(options, args)
     if not hasattr(ui, 'run_interface'):
         return iface.user_interface()
diff --git a/debian/changelog b/debian/changelog
index 580cec1..431c6ee 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -50,8 +50,11 @@ reportbug (4.8+WIP) UNRELEASED; urgency=low
     - open a terminal when fallbacking to text mode if stdout is not available
     - don't show back button as it's not possible to go back;
       thanks to all the people reporting the bug; Closes: #532467
+  * bin/reportbug:
+    - ask ui.can_input() to know whether the ui is able to receive input
+      or not; thanks to Sebastian Dalfuß; Closes: #531803
 
- -- Luca Bruno <lethalman88 at gmail.com>  Sun, 22 Nov 2009 11:51:10 +0100
+ -- Luca Bruno <lethalman88 at gmail.com>  Sun, 22 Nov 2009 12:02:26 +0100
 
 reportbug (4.8) unstable; urgency=low
 
diff --git a/reportbug/ui/gtk2_ui.py b/reportbug/ui/gtk2_ui.py
index 32f1c22..3caff9f 100644
--- a/reportbug/ui/gtk2_ui.py
+++ b/reportbug/ui/gtk2_ui.py
@@ -1488,6 +1488,9 @@ Falling back to 'text' interface."""
     application.start ()
     return True
 
+def can_input ():
+    return True
+
 def test ():
     # Write some tests here
     print get_password ("test")
diff --git a/reportbug/ui/text_ui.py b/reportbug/ui/text_ui.py
index 87afd78..cf3fad1 100644
--- a/reportbug/ui/text_ui.py
+++ b/reportbug/ui/text_ui.py
@@ -1018,3 +1018,6 @@ def spawn_editor(message, filename, editor, charset='utf-8'):
 
 def initialize ():
     return True
+
+def can_input():
+    return sys.stdin.isatty()
diff --git a/reportbug/ui/urwid_ui.py b/reportbug/ui/urwid_ui.py
index d5cf04d..22711e8 100644
--- a/reportbug/ui/urwid_ui.py
+++ b/reportbug/ui/urwid_ui.py
@@ -651,6 +651,9 @@ palette = [
 def initialize ():
     return True
 
+def can_input():
+    return sys.stdin.isatty()
+
 def test():
     import time
 

-- 
Reportbug - reports bugs in the Debian distribution



More information about the Reportbug-commits mailing list