Module: check_mk
Branch: master
Commit: 6f1d84ddc4e68b7962380645f36741c1c4450ae2
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6f1d84ddc4e68b…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Feb 1 10:47:35 2016 +0100
Fix loosing non-general properties when editing a page type
---
web/htdocs/pagetypes.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/web/htdocs/pagetypes.py b/web/htdocs/pagetypes.py
index 37e2d51..a951588 100644
--- a/web/htdocs/pagetypes.py
+++ b/web/htdocs/pagetypes.py
@@ -898,16 +898,16 @@ class Overridable:
new_page_dict = forms.edit_valuespec(vs, page_dict, validate=validate)
if new_page_dict != None:
+ # Take over keys from previous value that are specific to the page type
+ # and not edited here.
+ if mode in ("edit", "clone"):
+ for key, value in page_dict.items():
+ new_page_dict.setdefault(key, value)
+
owner = html.var("owner", config.user_id)
new_page_dict["owner"] = owner
new_page = self(new_page_dict)
- if mode in ("edit", "clone"):
- # Take over non-editable keys from previous version
- for key in page_dict:
- if key not in new_page_dict:
- new_page_dict[key] = page_dict[key]
-
self.add_page(new_page)
self.save_user_instances(owner)
html.immediate_browser_redirect(1, back_url)