X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_nbi%2Fnbi.py;h=cb727d831617a04c2a82d166b085026dc143dc54;hb=refs%2Fchanges%2F29%2F6129%2F1;hp=a8f891d006d225e08f349ea738f99968742dd0fe;hpb=0ffaa99c277d76ca49fdbe4d4b6b9df4d7484857;p=osm%2FNBI.git diff --git a/osm_nbi/nbi.py b/osm_nbi/nbi.py index a8f891d..cb727d8 100644 --- a/osm_nbi/nbi.py +++ b/osm_nbi/nbi.py @@ -8,9 +8,9 @@ import yaml import html_out as html import logging from engine import Engine, EngineException -from dbbase import DbException -from fsbase import FsException -from msgbase import MsgException +from osm_common.dbbase import DbException +from osm_common.fsbase import FsException +from osm_common.msgbase import MsgException from base64 import standard_b64decode #from os import getenv from http import HTTPStatus @@ -152,10 +152,10 @@ class Server(object): "": {"METHODS": ("GET", "DELETE")} }, "vim_accounts": {"METHODS": ("GET", "POST"), - "": {"METHODS": ("GET", "DELETE")} + "": {"METHODS": ("GET", "DELETE", "PATCH")} }, "sdns": {"METHODS": ("GET", "POST"), - "": {"METHODS": ("GET", "DELETE")} + "": {"METHODS": ("GET", "DELETE", "PATCH")} }, } }, @@ -723,7 +723,12 @@ class Server(object): cherrypy.response.status = HTTPStatus.NO_CONTENT.value outdata = None else: - outdata = {"id": self.engine.edit_item(session, engine_item, args[1], indata, kwargs)} + outdata = {"id": self.engine.edit_item(session, engine_item, _id, indata, kwargs)} + elif method == "PATCH": + if not indata and not kwargs: + raise NbiException("Nothing to update. Provide payload and/or query string", + HTTPStatus.BAD_REQUEST) + outdata = {"id": self.engine.edit_item(session, engine_item, _id, indata, kwargs)} else: raise NbiException("Method {} not allowed".format(method), HTTPStatus.METHOD_NOT_ALLOWED) return self._format_out(outdata, session, _format)