예제 #1
0
	def addRoom(self, groupId, roomName, buildingName):
		checkData(locals())

		group = Group(buildingName = buildingName, id = groupId)
		group.retrieve()

		from app.backend.model.room import Room
		room = Room(buildingName = buildingName, roomName = roomName)
		room.retrieve()


		if group.crossRoomsValidation:
			print "\t\t\t\t\t\t\t\tTODO (" + self.__class__.__name__ + ":" + sys._getframe().f_code.co_name + ")  This part of the method as not been tested"
			# In this case we have to check that the room doesn't belong to another CrossRoomValidatioGroup
			from app.backend.model.building import Building
			building = Building(buildingName = buildingName)
			building.retrieve()
			crvgList = building.getCrossRoomValidationGroups(roomName = roomName, validationCategories = group.crossRoomsValidationCategories)

			if len(crvgList) > 0:
				raise WrongBuildingGroupRipartitionError("A room can belong to only one cross validation group per category. Room " + str(roomName) + " in already in group " + str(crvgList[0]))

		group.addRoom(room)

		return room.getDict()
예제 #2
0
	def getInfo(self, roomName, buildingName):
		checkData(locals())

		room = Room(buildingName = buildingName, roomName = roomName)
		room.retrieve()
		return room.getDict()