comparison irclib.py @ 140:e077dc9f14e5

little fix in irclib concerning ServerConnection.socket Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Sun, 17 Jan 2010 11:12:56 +0100
parents f3a9c891f7c0
children 229a59acde0f
comparison
equal deleted inserted replaced
139:38eb220142a1 140:e077dc9f14e5
903 def send_raw(self, string): 903 def send_raw(self, string):
904 """Send raw string to the server. 904 """Send raw string to the server.
905 905
906 The string will be padded with appropriate CR LF. 906 The string will be padded with appropriate CR LF.
907 """ 907 """
908 if self.socket is None: 908 if not self.socket or self.socket == 'closed':
909 raise ServerNotConnectedError, self 909 raise ServerNotConnectedError, self
910 try: 910 try:
911 if self.ssl: 911 if self.ssl:
912 self.ssl.write(string.encode('utf-8') + "\r\n") 912 self.ssl.write(string.encode('utf-8') + "\r\n")
913 else: 913 elif self.socket and self.socket != 'closed':
914 self.socket.send(string.encode('utf-8') + "\r\n") 914 self.socket.send(string.encode('utf-8') + "\r\n")
915 if DEBUG: 915 if DEBUG:
916 print "TO SERVER:", string 916 print "TO SERVER:", string
917 except socket.error, x: 917 except socket.error, x:
918 # Ouch! 918 # Ouch!