瀏覽代碼

Union of different proxy parameters in one using the following syntax: proxy=http=<value>,ftp=<value>

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@56487 15284696-431f-4ddb-bdfa-cd5b030d7da7
Pietro Zambelli 12 年之前
父節點
當前提交
d6e663e2bf
共有 1 個文件被更改,包括 8 次插入27 次删除
  1. 8 27
      scripts/g.extension/g.extension.py

+ 8 - 27
scripts/g.extension/g.extension.py

@@ -56,25 +56,12 @@
 #% required: no
 #%end
 #%option
-#% key: http_proxy
+#% key: proxy
 #% type: string
-#% key_desc: http proxy
-#% description: Set the http proxy
-#% required: no
-#%end
-#%option
-#% key: https_proxy
-#% type: string
-#% key_desc: https proxy
-#% description: Set the https proxy
-#% required: no
-#%end
-#%option
-#% key: ftp_proxy
-#% type: string
-#% key_desc: ftp proxy
-#% description: Set the ftp proxy
+#% key_desc: proxy
+#% description: Set the proxy with: "http=<value>,ftp=<value>"
 #% required: no
+#% multiple: yes
 #%end
 
 #%flag
@@ -1014,6 +1001,7 @@ def update_manual_page(module):
     else:
         f.close()
 
+
 def main():
     # check dependecies
     if sys.platform != "win32":
@@ -1021,17 +1009,10 @@ def main():
 
     # manage proxies
     global PROXIES
-    proxy_opts = [options['http_proxy'],
-                  options['https_proxy'],
-                  options['ftp_proxy']]
-    if any(proxy_opts):
+    if options['proxy']:
         PROXIES = {}
-    if options['http_proxy']:
-        PROXIES['http'] = options['http_proxy']
-    if options['https_proxy']:
-        PROXIES['https'] = options['https_proxy']
-    if options['ftp_proxy']:
-        PROXIES['ftp'] = options['ftp_proxy']
+        for ptype, purl in (p.split('=') for p in options['proxy'].split(',')):
+            PROXIES[ptype] = purl
 
     # define path
     if flags['s']: