コード例 #1
0
    def put(self, id):
        controller = CharacterSheetController(request)

        try:
            new_character = controller.edit(id)
        except (DoesNotExist, ValidationError):
            api.abort(400, "Charcter with id {} does not exist".format(id))

        return new_character
コード例 #2
0
    def post(self, id, memento_id):
        controller = CharacterSheetController(request)

        try:
            new_memento = controller.memento_backup(id, memento_id)
        except (DoesNotExist, ValidationError):
            api.abort(400, "Charcter with id {} does not exist".format(id))

        return new_memento
コード例 #3
0
    def get(self, id):
        controller = CharacterSheetController(request)

        try:
            character = controller.get_element_detail(id)
        except (DoesNotExist, ValidationError):
            api.abort(400, "Character with id {} does not exist".format(id))

        return json.loads(character)
コード例 #4
0
    def delete(self, id):
        controller = CharacterSheetController(request)
        deleted = controller.delete(id)

        return deleted
コード例 #5
0
    def post(self):
        controller = CharacterSheetController(request)
        args = controller.new()

        return args
コード例 #6
0
    def get(self):
        controller = CharacterSheetController(request)
        query = controller.list()

        return jsonify(query)
def get_controller():
    controller = CharacterSheetController(model=CharacterSheet,
                                          request=request)
    return controller