16 |
# write to the Free Software Foundation, Inc., 59 Temple Place |
# write to the Free Software Foundation, Inc., 59 Temple Place |
17 |
# - Suite 330, Boston, MA 02111-1307, USA. |
# - Suite 330, Boston, MA 02111-1307, USA. |
18 |
# |
# |
19 |
# Copyright 2001 Free Software Foundation |
# Copyright 2001-2003 Free Software Foundation |
20 |
# |
# |
21 |
# FILE: |
# FILE: |
22 |
# sockets/CommDriver.py |
# sockets/CommDriver.py |
81 |
raise KeyError |
raise KeyError |
82 |
|
|
83 |
if not hasattr(socket, 'AF_UNIX'): |
if not hasattr(socket, 'AF_UNIX'): |
84 |
raise GComm.AdapterConfigurationError, \ |
tmsg = _("Your configuration references a file-based sockets connection.\n") \ |
85 |
_("Your configuration references a file-based sockets connection.\n") \ |
+ _("However, your operating system does not support file-based sockets.") |
86 |
+ _("However, your operating system does not support file-based sockets.") |
raise GComm.AdapterConfigurationError, tmsg |
87 |
|
|
88 |
self._location = file |
self._location = file |
89 |
|
|
93 |
self.__socket.connect(file) |
self.__socket.connect(file) |
94 |
|
|
95 |
except: |
except: |
96 |
raise AdapterInitializationError, \ |
tmsg = _("Unable to initialize the requested socket located at %s") % \ |
97 |
_("Unable to initialize the requested socket located at %s") % \ |
(file) |
98 |
(file) |
raise AdapterInitializationError, tmsg |
99 |
|
|
100 |
|
|
101 |
except KeyError: |
except KeyError: |
110 |
self.__socket.connect((host, port)) |
self.__socket.connect((host, port)) |
111 |
|
|
112 |
except KeyError: |
except KeyError: |
113 |
raise GComm.AdapterConfigurationError, \ |
tmsg = _("To use the sockets commdriver, you must specify either a sockets") \ |
114 |
_("To use the sockets commdriver, you must specify either a sockets") \ |
+ _("\nfile or a host and port number. Please see documentation.") |
115 |
+ _("\nfile or a host and port number. Please see documentation.") |
raise GComm.AdapterConfigurationError, tmsg |
116 |
|
|
117 |
except: |
except: |
118 |
raise AdapterInitializationError, \ |
tmsg = _("Unable to initialize the requested socket located at %s:%s") % \ |
119 |
_("Unable to initialize the requested socket located at %s:%s") % \ |
(host,port) |
120 |
(host,port) |
raise AdapterInitializationError, tmsg |
121 |
|
|
122 |
|
|
123 |
def __repr__(self): |
def __repr__(self): |