summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Zuna <pzuna@redhat.com>2010-08-17 14:53:03 -0400
committerAdam Young <ayoung@redhat.com>2010-08-17 14:53:03 -0400
commit7a007d958b502df0aa94f03489db54680bdac655 (patch)
treef8947ebd31461ea97ebf4917866c8c38bea5d066
parent19466d499ba853c51f0e87bbbb1484fdee71509f (diff)
Fix Update function on details page.
The problem was that parameters with no values are automatically set to None by the framework and it wasn't handled properly in baseldap.py:get_attributes function. Also, there were two logical bugs in details.js: 1) atttribute callback to update values were called for input elements instead of dt elements 2) it was always trying to update the primary key
-rw-r--r--install/static/details.js23
-rw-r--r--ipalib/plugins/baseldap.py8
2 files changed, 17 insertions, 14 deletions
diff --git a/install/static/details.js b/install/static/details.js
index f9da3f996..d47cfe8b5 100644
--- a/install/static/details.js
+++ b/install/static/details.js
@@ -92,16 +92,8 @@ function ipa_details_update(pkey, on_win, on_fail)
return;
var attr = dt.attr('title');
- if (!attr)
- return;
-
- if (attr.indexOf('call_') == 0) {
- var func = window[attr.substr(5)];
- if (!func)
- return;
- func(dt, modlist, IPA_DETAILS_UPDATE);
+ if (!attr || attr.indexOf('call_') == 0)
return;
- }
var param_info = ipa_get_param_info(attr);
if (param_info) {
@@ -118,8 +110,19 @@ function ipa_details_update(pkey, on_win, on_fail)
var jobj = $(this);
var attr = jobj.attr('title');
- if (!attr || attr.indexOf('call_') == 0)
+ if (!attr)
+ return;
+
+ if (attr.indexOf('call_') == 0) {
+ var func = window[attr.substr(5)];
+ if (func)
+ func(jobj, modlist, IPA_DETAILS_UPDATE);
return;
+ }
+
+ var param_info = ipa_get_param_info(attr);
+ if (param_info && param_info['primary_key'])
+ return;
var next = jobj.next('dd');
if ((!next.length) || (!next.children('input').length))
diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py
index f3e5b0fe2..69bda6d81 100644
--- a/ipalib/plugins/baseldap.py
+++ b/ipalib/plugins/baseldap.py
@@ -49,10 +49,10 @@ def get_attributes(attrs):
Given a list of values in the form name=value, return a list of name.
"""
attrlist=[]
- for attr in attrs:
- m = re.match("\s*(.*?)\s*=\s*(.*?)\s*$", attr)
- attrlist.append(str(m.group(1)).lower())
-
+ if attrs:
+ for attr in attrs:
+ m = re.match("\s*(.*?)\s*=\s*(.*?)\s*$", attr)
+ attrlist.append(str(m.group(1)).lower())
return attrlist