def _doPost(self, dataObject): # The game creation should have no arguments. if self.arg is not None: return self._response({}, CODE.UNIMPLEMENTED) if "name" in dataObject: GM = QRzarGameMapper() game = QRzarGame() game.setName(dataObject["name"]) if "start_time" in dataObject: #Format 2012-11-07 12:53:51 game.setStartTime(datetime.strptime(dataObject["start_time"], "%Y-%m-%d %H:%M:%S")) if "end_time" in dataObject: game.setEndTime(datetime.strptime(dataObject["end_time"], "%Y-%m-%d %H:%M:%S")) game.setCreator(self.user) try: GM.insert(game) except mdb.DatabaseError, e: raise ServerError("Unable to create the game in the database (%s)" % e.args[1]) return self._response(Depth.build(game, self.depth), CODE.CREATED)