[Linux-ha-dev] [GUI][patch1]The check of the parameter
Yan Gao
ygao at novell.com
Tue Oct 23 21:15:23 MDT 2007
On Tue, 2007-10-23 at 12:06 +0200, Lars Marowsky-Bree wrote:
> > + def check_unique_params(rsc, meta, paraname=None, dspmsg=True) :
> > + if meta != None :
> > + names = []
> > +
> > + if paraname == None :
> > + target_rsc = rsc
> > + else :
> > + target_rsc = rsc[paraname]
> > +
> > + names = [f["name"] for f in target_rsc]
> > +
> > + for paramMeta in meta.parameters :
> > + if paramMeta["unique"] == "1" :
> > + if names.count(paramMeta["name"]) > 1 :
> > + if dspmsg :
> > + msgbox(_("An unique parameter is duplicated."))
> > + return False
> > + return True
>
> I may be wrong, but this code reads as if you're checking the "unique"
> parameter against the resource itself; that's not intended, and will
> always be OK (because it's a hash-table).
>
Maybe we do not need to check the "unique". We could just check if it's
repeated and ask user if he want to retain the setting , or use the last
setting, or cancel the applying to re-edit it.
BTW, we could also check parameters for the resource of "lsb" RA type
(when the meta == None).
> The "unique" parameter was meant to imply that the value of this
> parameter must be unique across all resources of this type+class withinen
> the entire CIB.
It was confusing me too;-)
>
> > new_params = self.param_list.get_data()
> > +
> > + if not check_content(new_params, self.meta, None) :
> > + glade.get_widget("reset").set_property("sensitive", True)
> > + return
> > +
>
> Again I may be wrong, but does this not imply that when trying to submit
> a resource with such "wrong" settings, you're resetting the inputs?
It was just changing the "Reset" button from gray to black.
>
> That doesn't strike me as good. A popup warning the user, but with the
> option to override it (continue, re-edit) seems better.
Yes, using the "confirmbox" with options insead of "msgbox" is better.
--
Yan Gao
China R&D Software Engineer
ygao at novell.com
+86 10 65339229
Novell, Inc.
SUSE® Linux Enterprise
Your Linux is ready
http://www.novell.com/linux
More information about the Linux-HA-Dev
mailing list