/[anoncvs]/projects/dispense2/sql-edition/servers/VendingMachine.py


UCC Code Repository

Diff of /projects/dispense2/sql-edition/servers/VendingMachine.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by cameron, Sun Aug 1 08:21:01 2004 UTC revision 1.13 by dagobah, Sun Oct 31 09:29:05 2004 UTC
# Line 44  class VendingMachine: Line 44  class VendingMachine:
44                          except socket.error:                          except socket.error:
45                                  raise VendingException('failed to read input from vending machine')                                  raise VendingException('failed to read input from vending machine')
46                          if s == '': raise VendingException('nothing read!')                          if s == '': raise VendingException('nothing read!')
47                            if (s != '#' and s != '%') and state == 1: prefix += s
48                          if s == '\n' or s == '\r':                          if s == '\n' or s == '\r':
49                                  state = 1                                  state = 1
50                                  prefix = ''                                  prefix = ''
# Line 114  class VendingMachine: Line 115  class VendingMachine:
115          def vend(self, item):          def vend(self, item):
116                  if not re.search('^[0-9][0-9]$', item):                  if not re.search('^[0-9][0-9]$', item):
117                          return (False, 'Invalid item requested (%s)'%item)                          return (False, 'Invalid item requested (%s)'%item)
118                  self.wfh.write(self.authed_message(('V%s\n'%item)+'\n'))                  self.wfh.write(self.authed_message(('V%s'%item))+'\n')
119                  (code, string) = self.get_response()                  (code, string) = self.get_response()
120                  return (code == '100', code, string)                  return (code == '100', code, string)
121    

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

Managed by UCC Webmasters ViewVC Help
Powered by ViewVC 1.1.26