# HG changeset patch # User souliane # Date 1412587117 -7200 # Node ID 72f25d67136897b11684799efbb5a2772804392f # Parent 82dabb442e2ee17fa7966ec51c1dcd0613c822c9 memory (params): use more generic param attribute "constraint" instead of "min" and "max" diff -r 82dabb442e2e -r 72f25d671368 src/memory/params.py --- a/src/memory/params.py Sat Oct 04 10:26:10 2014 +0200 +++ b/src/memory/params.py Mon Oct 06 11:18:37 2014 +0200 @@ -44,17 +44,17 @@ - + - + - - - - + + + + @@ -65,13 +65,13 @@ 'category_general': D_("General"), 'category_connection': D_("Connection"), 'history_param': C.HISTORY_LIMIT, - 'label_history': D_('Chat history limit'), - 'label_NewAccount': D_("Register new account"), - 'label_autoconnect': D_('Connect on frontend startup'), - 'label_autodisconnect': D_('Disconnect on frontend closure'), - 'category_misc': D_("Misc"), + 'history_label': D_('Chat history limit'), 'force_server_param': C.FORCE_SERVER_PARAM, 'force_port_param': C.FORCE_PORT_PARAM, + 'new_account_label': D_("Register new account"), + 'autoconnect_label': D_('Connect on frontend startup'), + 'autodisconnect_label': D_('Disconnect on frontend closure'), + 'category_misc': D_("Misc"), } def load_default_params(self): @@ -755,10 +755,13 @@ log.debug(_("Trying to set parameter '%(param)s' in category '%(cat)s' with an non-integer value" % {'param': name, 'cat': category})) return defer.succeed(None) - if node[1].hasAttribute("min"): - value = str(max(int(value), int(node[1].getAttribute("min")))) - if node[1].hasAttribute("max"): - value = str(min(int(value), int(node[1].getAttribute("max")))) + if node[1].hasAttribute("constraint"): + constraint = node[1].getAttribute("constraint") + try: + min_, max_ = [int(limit) for limit in constraint.split(";")] + except ValueError: + raise exceptions.InternalError("Invalid integer parameter constraint: %s" % constraint) + value = str(min(max(int(value), min_), max_)) log.info(_("Setting parameter (%(category)s, %(name)s) = %(value)s") % {'category': category, 'name': name, 'value': value if type_ != 'password' else '********'}) diff -r 82dabb442e2e -r 72f25d671368 src/plugins/plugin_misc_imap.py --- a/src/plugins/plugin_misc_imap.py Sat Oct 04 10:26:10 2014 +0200 +++ b/src/plugins/plugin_misc_imap.py Mon Oct 06 11:18:37 2014 +0200 @@ -51,7 +51,7 @@ - + diff -r 82dabb442e2e -r 72f25d671368 src/plugins/plugin_misc_smtp.py --- a/src/plugins/plugin_misc_smtp.py Sat Oct 04 10:26:10 2014 +0200 +++ b/src/plugins/plugin_misc_smtp.py Mon Oct 06 11:18:37 2014 +0200 @@ -51,7 +51,7 @@ - + diff -r 82dabb442e2e -r 72f25d671368 src/plugins/plugin_xep_0065.py --- a/src/plugins/plugin_xep_0065.py Sat Oct 04 10:26:10 2014 +0200 +++ b/src/plugins/plugin_xep_0065.py Mon Oct 06 11:18:37 2014 +0200 @@ -444,14 +444,14 @@ - + - +