コード例 #1
0
ファイル: world.py プロジェクト: Ragora/ScalyMUCK
	def create_room(self, name, description='<Unset>', owner=0):
		""" Creates a new Room if the World.

		Keyword arguments:
			description -- The description that is to be used with the new Room instance.
			owner -- The ID or instance of Player that is to become the owner of this Room.

		"""
		try:
			room = Room(name, description, owner)
			connection = self.connect()
			self.session.add(room)
			self.session.commit()
			self.session.refresh(room)
			room.session = self.session
			room.engine = self.engine
			connection.close()
			return room
		except OperationalError:
			self.session.rollback()
			self.database_status.send(sender=self, status=False)