[Zope-CVS] CVS: Products/ExternalEditor - zopeedit.py:1.38
Casey Duncan
casey@zope.com
Sat, 7 Sep 2002 01:03:14 -0400
Update of /cvs-repository/Products/ExternalEditor
In directory cvs.zope.org:/tmp/cvs-serv15778
Modified Files:
zopeedit.py
Log Message:
Refactored ssl check
Took out stderr writes because they break in the windows binary
=== Products/ExternalEditor/zopeedit.py 1.37 => 1.38 ===
--- Products/ExternalEditor/zopeedit.py:1.37 Sun Sep 1 01:03:42 2002
+++ Products/ExternalEditor/zopeedit.py Sat Sep 7 01:03:13 2002
@@ -17,7 +17,7 @@
# Zope External Editor Helper Application by Casey Duncan
-__version__ = '0.5'
+__version__ = '0.6'
import sys, os, re
import traceback
@@ -27,15 +27,6 @@
from urlparse import urlparse
import urllib
-try:
- # See if ssl is available on this system
- from socket import ssl
-except ImportError:
- ssl_available = 0
-else:
- ssl_available = 1
- del ssl
-
win32 = sys.platform == 'win32'
class Configuration:
@@ -163,10 +154,14 @@
except OSError:
pass # Sometimes we aren't allowed to delete it
- if self.ssl and not ssl_available:
- fatalError('SSL support is not available on this system. '
- 'Make sure openssl is installed '
- 'and reinstall Python.')
+ if self.ssl:
+ # See if ssl is available
+ try:
+ from socket import ssl
+ except ImportError:
+ fatalError('SSL support is not available on this system. '
+ 'Make sure openssl is installed '
+ 'and reinstall Python.')
self.lock_token = None
self.did_lock = 0
except:
@@ -515,8 +510,6 @@
response = NullResponse()
response.reason = sys.exc_info()[1]
- sys.stderr.write('\n-- Zope Request Traceback --\n')
- traceback.print_exc(file=sys.stderr)
try:
response.status, response.reason = response.reason
@@ -526,22 +519,11 @@
return response
def askRetryAfterError(self, response, operation, message=''):
- """Dumps response data to stderr"""
+ """Dumps response data"""
if not message \
and response.getheader('Bobo-Exception-Type') is not None:
message = '%s: %s' % (response.getheader('Bobo-Exception-Type'),
response.getheader('Bobo-Exception-Value'))
-
- sys.stderr.write('Error occurred: %s:\n%d %s\n%s\n'
- % (operation, response.status,
- response.reason, message))
-
- if hasattr(response, 'msg'):
- headers = ''.join(response.msg.headers)
- else:
- headers = ''
-
- sys.stderr.write('\n----\n%s\n%s\n----\n' % (headers, response.read()))
return askRetryCancel('%s:\n%d %s\n%s' % (operation, response.status,
response.reason, message))
@@ -560,7 +542,6 @@
def errorDialog(message):
MessageBox(message, title, MB_OK + MB_ICONERROR + MB_SYSTEMMODAL)
- sys.stderr.write(message + '\n')
def askRetryCancel(message):
return MessageBox(message, title,
@@ -618,7 +599,7 @@
showerror(title, message)
has_tk()
finally:
- sys.stderr.write(message + '\n')
+ print message
def askRetryCancel(message):
if has_tk():
@@ -660,7 +641,6 @@
def fatalError(message, exit=1):
"""Show error message and exit"""
errorDialog('FATAL ERROR: %s' % message)
- traceback.print_exc(file=sys.stderr)
# Write out debug info to a temp file
debug_f = open(mktemp('-zopeedit-traceback.txt'), 'w')
try: