def enshelf(self): if self.subject not in list_of_shelves: Shelf(self.subject) contentOfShelves[list_of_shelves.index(self.subject)][0][self.subject].update({self.name: self.quantity()}) else: contentOfShelves[list_of_shelves.index(self.subject)][0][self.subject].update({self.name: self.quantity()})
def unshelf(self): _shelfContent = contentOfShelves[list_of_shelves.index(self.subject)][0] _title = self.name #book_quantity.keys()[list_of_shelves.index(self.subject)]#_title = books[self.id] bookqty = int(_shelfContent[self.subject][_title]) bookqty += -1 if bookqty == 0: del _shelfContent[self.subject][_title] else: _shelfContent[self.subject][_title] = bookqty del books[self.id]
def getShelfNumber(subject): return list_of_shelves.index(subject)
def createShelf(self): if self.subject in list_of_shelves: print print "USER ERROR: Shelf already exists. " + self.subject.upper() + " is shelf - " + str(list_of_shelves.index(self.subject) + 1) print "PLEASE RECREATE LIBRARY AGAIN! FOLLOW INSTRUCTIONS ACCORDINGLY. " print sys.exit() else: list_of_shelves.append(self.subject) self._updatecontentOfShelves()