Пример #1
0
    def checkout_items(self, user, items, bldg):
        """
		Checks out the list of items passed to it, updating self.transactions.
		"""
        logger.debug("Entering")

        if user in self.transactions:
            logger.debug("User in transactions.")
            ts = self.transactions[user][0]  # Use the current timestamp
            old_items = self.transactions[user][-1]
        else:
            logger.debug("User not in transactions.")
            ts = self._make_timestamp()
            old_items = set()

        logger.debug(
            "Information being added: Timestamp Out: %r\nBldg: %r\nItems: %r" %
            (ts, bldg, items))
        db.check_items(
            items)  # Updates the file containing checked in/out items

        items.update(old_items)
        logger.debug("Full item list: %r" % items)
        self.transactions[user] = [ts, bldg,
                                   items]  # Update the user transaction

        self._save_transactions()
        logger.debug("Exititing")
Пример #2
0
	def checkin_items(self, user):
		"""
		Checks in the list of items passed to it.
		Stores the items into a logfile as timestamp_out;timestamp_in;user;bldg;items
		Returns the start and stop timestamp for the items.
		"""
		logger.debug("Entering")
		
		if not user in self.transactions:
			logger.warn("There should be a user in the transactions when checking out items.")
			raise KeyError

		ts, bldg, items = self.transactions.pop(user) # Remove the user.
		
		logger.info("%s;%s;%s;%s;%s" % (ts, self._make_timestamp(), user, bldg, items)) # Add the session to the log file.

		db.check_items(items) # Updates the file containing checked in/out items
		self._save_transactions()
		logger.debug("Exiting")
Пример #3
0
	def checkout_items(self, user, items, bldg):
		"""
		Checks out the list of items passed to it, updating self.transactions.
		"""
		logger.debug("Entering")

		if user in self.transactions:
			logger.debug("User in transactions.")
			ts = self.transactions[user][0] # Use the current timestamp
			old_items = self.transactions[user][-1]
		else:
			logger.debug("User not in transactions.")
			ts = self._make_timestamp()
			old_items = set()
			
		logger.debug("Information being added: Timestamp Out: %r\nBldg: %r\nItems: %r" % (ts, bldg, items))
		db.check_items(items) # Updates the file containing checked in/out items
		
		items.update(old_items)
		logger.debug("Full item list: %r" % items)
		self.transactions[user] = [ts, bldg, items] # Update the user transaction
		
		self._save_transactions()
		logger.debug("Exititing")
Пример #4
0
    def checkin_items(self, user):
        """
		Checks in the list of items passed to it.
		Stores the items into a logfile as timestamp_out;timestamp_in;user;bldg;items
		Returns the start and stop timestamp for the items.
		"""
        logger.debug("Entering")

        if not user in self.transactions:
            logger.warn(
                "There should be a user in the transactions when checking out items."
            )
            raise KeyError

        ts, bldg, items = self.transactions.pop(user)  # Remove the user.

        logger.info("%s;%s;%s;%s;%s" %
                    (ts, self._make_timestamp(), user, bldg,
                     items))  # Add the session to the log file.

        db.check_items(
            items)  # Updates the file containing checked in/out items
        self._save_transactions()
        logger.debug("Exiting")