예제 #1
0
 def apply(self):
     # also set changes to the global value
     (h, p) = self._getHostPortFromUI()
     proxy = ZHttpProxyConfiguration()
     proxy.setEnable( self.enableCB.GetValue() )
     proxy.setHost( h )
     port = 8080
     try:
         port  = int( p )
     except:
         pass
     proxy.setPort( port )
     proxy.setProxyAuthorization( getSafeString(self.usernameTxt.GetValue()), getSafeString(self.passwordTxt.GetValue()) )
     return ZApplicationPreferencesPrefPage.apply(self)
예제 #2
0
 def _initProxyConfiguration(self):
     # Get proxy settings from user prefs.        
     userProfile = self.applicationModel.getUserProfile()
     prefs = userProfile.getPreferences()
     enabled = prefs.getUserPreferenceBool(IZAppUserPrefsKeys.PROXY_ENABLE, False)
     host = prefs.getUserPreference(IZAppUserPrefsKeys.PROXY_HOST, u"") #$NON-NLS-1$
     port = prefs.getUserPreferenceInt(IZAppUserPrefsKeys.PROXY_PORT, u"") #$NON-NLS-1$
     username = prefs.getUserPreference(IZAppUserPrefsKeys.PROXY_USERNAME, u"") #$NON-NLS-1$
     password = prefs.getUserPreference(IZAppUserPrefsKeys.PROXY_PASSWORD, u"") #$NON-NLS-1$
     if password:
         password = crypt.decryptCipherText(password, PASSWORD_ENCRYPTION_KEY)
     proxy = ZHttpProxyConfiguration()
     proxy.setEnable(enabled)
     proxy.setHost(host)
     if port > 0:
         proxy.setPort(port)
     proxy.setProxyAuthorization(username, password)
예제 #3
0
파일: raven.py 프로젝트: mpm2050/Raven
 def _initProxyConfiguration(self):
     # Get proxy settings from user prefs.
     userProfile = self.applicationModel.getUserProfile()
     prefs = userProfile.getPreferences()
     enabled = prefs.getUserPreferenceBool(IZAppUserPrefsKeys.PROXY_ENABLE,
                                           False)
     host = prefs.getUserPreference(IZAppUserPrefsKeys.PROXY_HOST,
                                    u"")  #$NON-NLS-1$
     port = prefs.getUserPreferenceInt(IZAppUserPrefsKeys.PROXY_PORT,
                                       u"")  #$NON-NLS-1$
     username = prefs.getUserPreference(IZAppUserPrefsKeys.PROXY_USERNAME,
                                        u"")  #$NON-NLS-1$
     password = prefs.getUserPreference(IZAppUserPrefsKeys.PROXY_PASSWORD,
                                        u"")  #$NON-NLS-1$
     if password:
         password = crypt.decryptCipherText(password,
                                            PASSWORD_ENCRYPTION_KEY)
     proxy = ZHttpProxyConfiguration()
     proxy.setEnable(enabled)
     proxy.setHost(host)
     if port > 0:
         proxy.setPort(port)
     proxy.setProxyAuthorization(username, password)