Difference for python/CFItemBroker.py from version 1.1 to 1.2


version 1.1 version 1.2
Line 1
 
Line 1
 #CFItemBroker.py  #CFItemBroker.py
 #An often used bit of code to add or remove a number of objects  #An often used bit of code to add or remove a number of objects
 #Mostly useful for removing items (like in payment or as part of  #Useful for removing items (like in payment or as part of
 #an inventory check)  #an inventory check)  This is also useful for setting the number
 #This will not check for the existance of an item as that would better  #of a newly created item(s) as it will check for existing item(s) and add
   #the appropriate number of new items avoiding such sillyness as the
   #number of the existing items being reset.
   #This will not check for the existence of an item as that would better
 #be done in the calling script so you can be flexable.  #be done in the calling script so you can be flexable.
 #  #
 #ToddMitchell  #ToddMitchell
   
 import CFPython  import CFPython
   
 class ItemBroker:  class Item:
   
     def __init__(self, object):      def __init__(self, object):
         self.object = object          self.object = object
         self.numberof = CFPython.GetQuantity(self.object)          self.numberof = CFPython.GetQuantity(self.object)
   
     def add(self, number):      def add(self, number):
         tmp = self.numberof + number          tmp = (self.numberof + number)-1
         CFPython.SetQuantity(self.object, tmp)          CFPython.SetQuantity(self.object, tmp)
         return 1          return 1
                  


Legend:
line(s) removed in v.1.1 
line(s) changed
 line(s) added in v.1.2

File made using version 1.96 of cvs2html by leaf at 2006-02-15 17:26