Update LAT version.
[zanchey/dispense2.git] / sql-edition / servers / VendingMachine.py
index 89dd09e..4a40922 100644 (file)
@@ -2,6 +2,7 @@
 import re
 from CRC import do_crc
 from select import select
+import socket, logging
 
 asynchronous_responses = [     '400', '401', # door open/closed
                                '610',        # switches changed
@@ -41,7 +42,6 @@ class VendingMachine:
                        try:
                                s = self.rfh.read(1)
                        except socket.error:
-                               print "Blah, seems DEC server has fallen over"
                                raise VendingException('failed to read input from vending machine')
                        if s == '': raise VendingException('nothing read!')
                        if s == '\n' or s == '\r':
@@ -63,7 +63,7 @@ class VendingMachine:
                        while s == '':
                                s = self.rfh.readline()
                                if s == '':
-                    raise VendingException('Input socket has closed!')
+                                       raise VendingException('Input socket has closed!')
                                s = s.strip('\r\n')
                        code = s[0:3]
                        text = s[4:]
@@ -96,7 +96,7 @@ class VendingMachine:
                elif code[0] == '2':
                        self.events.append((KEY, int(code[1:3])))
                else:
-                       sys.stderr.write('WARNING: Unhandled event! (%s %s)\n'%(code,text))
+                       logging.warning('Unhandled event! (%s %s)\n'%(code,text))
 
        def authed_message(self, message):
                if self.challenge == None:

UCC git Repository :: git.ucc.asn.au