fix stupid crypto bug
authorBernard Blackham <[email protected]>
Sun, 31 Oct 2004 09:29:05 +0000 (09:29 +0000)
committerBernard Blackham <[email protected]>
Sun, 31 Oct 2004 09:29:05 +0000 (09:29 +0000)
sql-edition/servers/VendingMachine.py

index 4a40922..d7e7a8f 100644 (file)
@@ -44,6 +44,7 @@ class VendingMachine:
                        except socket.error:
                                raise VendingException('failed to read input from vending machine')
                        if s == '': raise VendingException('nothing read!')
+                       if (s != '#' and s != '%') and state == 1: prefix += s
                        if s == '\n' or s == '\r':
                                state = 1
                                prefix = ''
@@ -114,7 +115,7 @@ class VendingMachine:
        def vend(self, item):
                if not re.search('^[0-9][0-9]$', item):
                        return (False, 'Invalid item requested (%s)'%item)
-               self.wfh.write(self.authed_message(('V%s\n'%item)+'\n'))
+               self.wfh.write(self.authed_message(('V%s'%item))+'\n')
                (code, string) = self.get_response()
                return (code == '100', code, string)
 

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