Source
1
1
import urllib2
2
2
import re
3
+
import ssl
3
4
import webbrowser
4
5
5
6
class __doc(object):
6
7
"command-line Plone help"
7
8
8
9
def __init__( self ):
9
10
10
11
version = "%d.%d.%d" % tuple(cu.version( )[:3])
11
12
12
13
self.__task_url = "https://casa.nrao.edu/PloneResource/casa-" + version + "/taskXml/"
18
19
self.__tool_prefix = "https://casa.nrao.edu/casadocs/casa-" + version + "/global-tool-list/tool_"
19
20
20
21
self.__task_list = [ ]
21
22
self.__tool_list = [ ]
22
23
23
24
def __call__( self, topic=None ):
24
25
"open browser with documentation, try \"doc('toc')\""
25
26
26
27
if len(self.__task_list) == 0:
27
28
try:
28
-
self.__task_list = re.findall("\w+.xml", urllib2.urlopen(self.__task_url).read().decode())
29
+
### osx rejects NRAO's CERT
30
+
self.__task_list = re.findall("\w+.xml", urllib2.urlopen(self.__task_url).read().decode(),context=ssl.SSLContext())
29
31
except:
30
32
self.__task_list = [ ]
31
33
32
34
if len(self.__tool_list) == 0:
33
35
try:
34
-
self.__tool_list = re.findall("\w+.xml", urllib2.urlopen(self.__tool_url).read().decode())
36
+
### osx rejects NRAO's CERT
37
+
self.__tool_list = re.findall("\w+.xml", urllib2.urlopen(self.__tool_url).read().decode(),context=ssl.SSLContext())
35
38
except:
36
39
self.__tool_list = [ ]
37
40
38
41
if type(topic) != str or topic == "toc":
39
42
webbrowser.open_new_tab(self.__toc_url)
40
43
elif topic == "start":
41
44
webbrowser.open_new_tab(self.__start_url)
42
45
elif topic+'.xml' in self.__task_list:
43
46
webbrowser.open_new_tab(self.__task_prefix+topic+"/parameters")
44
47
elif topic+'.xml' in self.__tool_list: