~roadmr/ubuntu/precise/checkbox/0.13.1

« back to all changes in this revision

Viewing changes to plugins/proxy_info.py

  • Committer: Bazaar Package Importer
  • Author(s): Marc Tardif, Gabor Keleman
  • Date: 2009-08-19 15:36:05 UTC
  • Revision ID: james.westby@ubuntu.com-20090819153605-weo6htup3yi6zn0t
Tags: 0.8~alpha4
* New upstream version:
  * Changed icon.
  * Added timeout property to lock_prompt plugin.
  * Added concept of attachments to tests.
  * Added support for backslahes in templates to wrap lines.
  * Added support blacklisting and whitelisting both tests and suites.
  * Introduced the concept of jobs for suites, tests and attachments.
  * Removed upstart event which is no longer needed.
  * Replaced architecture and category with requires in test definitions.
* Fixed pygst dependency (LP: #334442)
* Fixed configuration file updates during install (LP: #330596)
* Fixed and expanded translations (LP: #347038)
* Fixed ignored system proxy settings (LP: #345548)
* Fixed parsing blank lines in templates (LP: #393907)
* Fixed escaping of lists (LP: #394001)
* Fixed timeout in manual tests (LP: #377986)
* Fixed CLI interface dialog.
* Fixed support for FreeDesktop XDG base directory specification (LP: #363549)
* Added general and package specific apport hooks

[ Gabor Keleman ]
* Fixed untranslated strings in tests (LP: #374666)
* Fixed untranslated last screen (LP: #374646)

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
# You should have received a copy of the GNU General Public License
17
17
# along with Checkbox.  If not, see <http://www.gnu.org/licenses/>.
18
18
#
19
 
from checkbox.lib.environ import add_variable
 
19
from checkbox.lib.environ import add_variable, get_variable
20
20
 
21
21
from checkbox.properties import String
22
22
from checkbox.plugin import Plugin
35
35
        self._manager.reactor.call_on("gather", self.gather, -1000)
36
36
 
37
37
    def gather(self):
38
 
        if self.http_proxy:
39
 
            add_variable("http_proxy", self.http_proxy)
40
 
 
41
 
        if self.https_proxy:
42
 
            add_variable("https_proxy", self.https_proxy)
 
38
        # Config has lowest precedence
 
39
        http_proxy = self.http_proxy
 
40
        https_proxy = self.https_proxy
 
41
 
 
42
        # Gconf has higher precedence
 
43
        gconf = self._manager.registry.gconf
 
44
        if gconf.system.http_proxy.use_http_proxy:
 
45
            if gconf.system.http_proxy.use_authentication:
 
46
                http_proxy = "http://%s:%s@%s:%s" % (
 
47
                    gconf.system.http_proxy.authentication_user,
 
48
                    gconf.system.http_proxy.authentication_password,
 
49
                    gconf.system.http_proxy.host,
 
50
                    gconf.system.http_proxy.port)
 
51
            elif gconf.system.http_proxy.host:
 
52
                http_proxy = "http://%s:%s" % (
 
53
                    gconf.system.http_proxy.host,
 
54
                    gconf.system.http_proxy.port)
 
55
 
 
56
            if gconf.system.http_proxy.use_same_proxy:
 
57
                https_proxy = http_proxy
 
58
            elif gconf.system.proxy.secure_host:
 
59
                https_proxy = "https://%s:%s" % (
 
60
                    gconf.system.proxy.secure_host,
 
61
                    gconf.system.proxy.secure_port)
 
62
 
 
63
        # Environment has highest precedence
 
64
        http_proxy = get_variable("http_proxy", http_proxy)
 
65
        https_proxy = get_variable("https_proxy", https_proxy)
 
66
 
 
67
        add_variable("http_proxy", http_proxy)
 
68
        add_variable("https_proxy", https_proxy)
43
69
 
44
70
 
45
71
factory = ProxyInfo