summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2010-12-02 16:31:42 -0500
committerRob Crittenden <rcritten@redhat.com>2010-12-02 16:31:42 -0500
commita41e69fba360d7cfc83e8592528562e06573533b (patch)
treea6083668289531b51ceb36e101b7b08b2389e531 /ipalib
parent6c393e53b01222ba7629ce86384d0adb34f7f275 (diff)
downloadfreeipa-a41e69fba360d7cfc83e8592528562e06573533b.tar.gz
freeipa-a41e69fba360d7cfc83e8592528562e06573533b.tar.xz
freeipa-a41e69fba360d7cfc83e8592528562e06573533b.zip
Add labels for passwords, fix output of exceptions, fix passwd output.
Passwords didn't have internationalizable labels. Exceptions that occured during required input weren't printed as unicode so weren't being translated properly. Don't use output_for_cli() directly in the passwd plugin, use output.Output. ticket 352
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/cli.py2
-rw-r--r--ipalib/plugins/migration.py3
-rw-r--r--ipalib/plugins/passwd.py18
3 files changed, 14 insertions, 9 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index 1be392567..375607ff0 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -903,7 +903,7 @@ class cli(backend.Executioner):
error = None
while True:
if error is not None:
- print '>>> %s: %s' % (param.label, error)
+ print '>>> %s: %s' % (unicode(param.label), unicode(error))
raw = self.Backend.textui.prompt(param.label, default)
try:
value = param(raw, **kw)
diff --git a/ipalib/plugins/migration.py b/ipalib/plugins/migration.py
index 6dc993423..9f311911d 100644
--- a/ipalib/plugins/migration.py
+++ b/ipalib/plugins/migration.py
@@ -124,7 +124,7 @@ def _pre_migrate_group(ldap, pkey, dn, entry_attrs, failed, config, ctx):
def validate_ldapuri(ugettext, ldapuri):
m = re.match('^ldaps?://[-\w\.]+(:\d+)?$', ldapuri)
if not m:
- err_msg = 'Invalid LDAP URI.'
+ err_msg = _('Invalid LDAP URI.')
raise errors.ValidationError(name='ldap_uri', error=err_msg)
@@ -171,6 +171,7 @@ class migrate_ds(Command):
),
Password('bindpw',
cli_name='password',
+ label=_('Password'),
doc=_('bind password'),
),
)
diff --git a/ipalib/plugins/passwd.py b/ipalib/plugins/passwd.py
index ef515605e..3d65f0150 100644
--- a/ipalib/plugins/passwd.py
+++ b/ipalib/plugins/passwd.py
@@ -39,6 +39,7 @@ from ipalib import api, errors, util
from ipalib import Command
from ipalib import Str, Password
from ipalib import _
+from ipalib import output
class passwd(Command):
@@ -54,9 +55,14 @@ class passwd(Command):
autofill=True,
create_default=lambda **kw: util.get_current_principal(),
),
- Password('password'),
+ Password('password',
+ label=_('Password'),
+ ),
)
+ has_output = output.standard_value
+ msg_summary = _('Changed password for "%(value)s"')
+
def execute(self, principal, password):
"""
Execute the passwd operation.
@@ -84,11 +90,9 @@ class passwd(Command):
ldap.modify_password(dn, password)
- return dict(result=True)
-
- def output_for_cli(self, textui, result, principal, password):
- assert password is None
- textui.print_name(self.name)
- textui.print_dashed('Changed password for "%s."' % principal)
+ return dict(
+ result=True,
+ value=principal,
+ )
api.register(passwd)