Module: check_mk
Branch: master
Commit: 277eaf2fbfbfb44c50018e57b2bd460d4fc09499
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=277eaf2fbfbfb4…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Jun 29 10:07:00 2011 +0200
WATO: fix problem in API
---
web/htdocs/wato.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index ed486b0..76b502c 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -1867,7 +1867,7 @@ def get_folder_and_file():
def make_path(filename):
if not filename or filename == "/":
return ()
- parts = filename[1:].rstrip("/").split("/")
+ parts = filename.strip("/").split("/")
return tuple(parts)
# Create link keeping the context to the current folder / file
@@ -2808,6 +2808,10 @@ class API:
return g_root_folder
elif path[-1].endswith(".mk"):
folder = self.get_folder(path[:-1])
+ if not folder:
+ raise MKGeneralException("No WATO folder %s." % (path,))
+ if ".files" not in folder:
+ raise MKGeneralException("Path %s does not point to a WATO
file." % (path,))
return folder[".files"].get(path[-1])
else:
return self.get_folder(path)