From f3de95ce99855cb15e26d8007c8901aaec96c595 Mon Sep 17 00:00:00 2001 From: Pavel Zuna Date: Wed, 23 Feb 2011 16:47:49 -0500 Subject: Fix translatable strings in ipalib plugins. Needed for xgettext/pygettext processing. --- ipalib/plugins/automount.py | 4 +++- ipalib/plugins/baseldap.py | 9 ++++++--- ipalib/plugins/batch.py | 4 ++-- ipalib/plugins/delegation.py | 2 +- ipalib/plugins/dns.py | 8 ++++++-- ipalib/plugins/host.py | 18 +++++++++++++----- ipalib/plugins/hostgroup.py | 2 +- ipalib/plugins/internal.py | 6 +----- ipalib/plugins/migration.py | 4 +++- ipalib/plugins/misc.py | 2 +- ipalib/plugins/netgroup.py | 2 +- ipalib/plugins/permission.py | 2 +- ipalib/plugins/privilege.py | 2 +- ipalib/plugins/role.py | 2 +- ipalib/plugins/selfservice.py | 2 +- ipalib/plugins/service.py | 2 +- ipalib/plugins/sudocmd.py | 2 +- ipalib/plugins/user.py | 7 +++---- 18 files changed, 47 insertions(+), 33 deletions(-) (limited to 'ipalib/plugins') diff --git a/ipalib/plugins/automount.py b/ipalib/plugins/automount.py index 9c2c0ad13..2835204c9 100644 --- a/ipalib/plugins/automount.py +++ b/ipalib/plugins/automount.py @@ -329,7 +329,9 @@ class automountlocation_import(LDAPQuery): fp.close() except IOError, e: if e.errno == 2: - raise errors.NotFound(reason=_('File %(file)s not found' % {'file':filename})) + raise errors.NotFound( + reason=_('File %(file)s not found') % {'file': filename} + ) else: raise e return map diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py index 4441e7960..02c839cf5 100644 --- a/ipalib/plugins/baseldap.py +++ b/ipalib/plugins/baseldap.py @@ -759,9 +759,12 @@ class LDAPUpdate(LDAPQuery, crud.Update): def _get_rename_option(self): rdnparam = getattr(self.obj.params, self.obj.rdnattr) - return rdnparam.clone_rename('rename', cli_name='rename', - required=False, label=_('Rename'), - doc=_('Rename the %s object' % self.obj.object_name)) + return rdnparam.clone_rename('rename', + cli_name='rename', required=False, label=_('Rename'), + doc=_('Rename the %(ldap_obj_name)s object') % dict( + ldap_obj_name=self.obj.object_name + ) + ) def get_options(self): for option in super(LDAPUpdate, self).get_options(): diff --git a/ipalib/plugins/batch.py b/ipalib/plugins/batch.py index 5455340b2..10277ceba 100644 --- a/ipalib/plugins/batch.py +++ b/ipalib/plugins/batch.py @@ -74,8 +74,8 @@ class batch(Command): ) has_output = ( - Output('count', int, doc=_('')), - Output('results', list, doc=_('')) + Output('count', int, doc=''), + Output('results', list, doc='') ) def execute(self, *args, **options): diff --git a/ipalib/plugins/delegation.py b/ipalib/plugins/delegation.py index 8ea0af9cf..c3b5e4825 100644 --- a/ipalib/plugins/delegation.py +++ b/ipalib/plugins/delegation.py @@ -221,7 +221,7 @@ class delegation_find(crud.Search): """ msg_summary = ngettext( - '%(count)d delegation matched', '%(count)d delegations matched' + '%(count)d delegation matched', '%(count)d delegations matched', 0 ) def execute(self, term, **kw): diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py index a18940b3a..1c03b5320 100644 --- a/ipalib/plugins/dns.py +++ b/ipalib/plugins/dns.py @@ -201,7 +201,9 @@ def is_ns_rec_resolvable(name): try: return api.Command['dns_resolve'](name) except errors.NotFound: - raise errors.NotFound(reason=_('Nameserver \'%(host)s\' does not have a corresponding A/AAAA record' % {'host':name})) + raise errors.NotFound( + reason=_('Nameserver \'%(host)s\' does not have a corresponding A/AAAA record') % {'host': name} + ) def add_forward_record(zone, name, str_address): addr = netaddr.IPAddress(str_address) @@ -816,7 +818,9 @@ class dns_resolve(Command): break if not found: - raise errors.NotFound(reason=_('Host \'%(host)s\' not found' % {'host':query})) + raise errors.NotFound( + reason=_('Host \'%(host)s\' not found') % {'host': query} + ) return dict(result=True, value=query) diff --git a/ipalib/plugins/host.py b/ipalib/plugins/host.py index f5f5157b0..53846cd33 100644 --- a/ipalib/plugins/host.py +++ b/ipalib/plugins/host.py @@ -316,7 +316,9 @@ class host_add(LDAPCreate): match = True break if not match: - raise errors.NotFound(reason=_('DNS zone %(zone)s not found' % dict(zone=domain))) + raise errors.NotFound( + reason=_('DNS zone %(zone)s not found') % dict(zone=domain) + ) if not options.get('no_reverse', False): # we prefer lookup of the IP through the reverse zone revzone, revname = get_reverse_zone(options['ip_address']) @@ -327,7 +329,9 @@ class host_add(LDAPCreate): match = True break if not match: - raise errors.NotFound(reason=_('Reverse DNS zone %(zone)s not found' % dict(zone=revzone))) + raise errors.NotFound( + reason=_('Reverse DNS zone %(zone)s not found') % dict(zone=revzone) + ) try: reverse = api.Command['dnsrecord_find'](revzone, idnsname=revname) if reverse['count'] > 0: @@ -395,7 +399,9 @@ class host_add(LDAPCreate): # context, don't crash. pass if exc: - raise errors.NonFatalError(reason=_('The host was added but the DNS update failed with: %(exc)s' % dict(exc=exc))) + raise errors.NonFatalError( + reason=_('The host was added but the DNS update failed with: %(exc)s') % dict(exc=exc) + ) set_certificate_attrs(entry_attrs) return dn @@ -457,7 +463,9 @@ class host_del(LDAPDelete): match = True break if not match: - raise errors.NotFound(reason=_('DNS zone %(zone)s not found' % dict(zone=domain))) + raise errors.NotFound( + reason=_('DNS zone %(zone)s not found') % dict(zone=domain) + ) # Get all forward resources for this host records = api.Command['dnsrecord_find'](domain, idnsname=parts[0])['result'] for record in records: @@ -602,7 +610,7 @@ class host_find(LDAPSearch): has_output_params = LDAPSearch.has_output_params + host_output_params msg_summary = ngettext( - '%(count)d host matched', '%(count)d hosts matched' + '%(count)d host matched', '%(count)d hosts matched', 0 ) member_attributes = ['memberof', 'enrolledby', 'managedby'] diff --git a/ipalib/plugins/hostgroup.py b/ipalib/plugins/hostgroup.py index f661a2ff5..715523440 100644 --- a/ipalib/plugins/hostgroup.py +++ b/ipalib/plugins/hostgroup.py @@ -126,7 +126,7 @@ class hostgroup_find(LDAPSearch): """ member_attributes = ['member', 'memberof'] msg_summary = ngettext( - '%(count)d hostgroup matched', '%(count)d hostgroups matched' + '%(count)d hostgroup matched', '%(count)d hostgroups matched', 0 ) api.register(hostgroup_find) diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py index ef1326265..f25e429e9 100644 --- a/ipalib/plugins/internal.py +++ b/ipalib/plugins/internal.py @@ -379,11 +379,7 @@ class i18n_messages(Command): "validation_error":_("Text does not match field pattern"), }, "ajax":{ - "401":_("Your kerberos ticket is no longer valid. "+ - "Please run kinit and then click 'Retry'. "+ - "If this is your first time running the IPA Web UI "+ - ""+ - "follow these directions to configure your browser.") + "401":_("Your kerberos ticket is no longer valid. Please run kinit and then click 'Retry'. If this is your first time running the IPA Web UI follow these directions to configure your browser.") }, "dirty":_("This page has unsaved changes. Please save or revert."), } diff --git a/ipalib/plugins/migration.py b/ipalib/plugins/migration.py index 4e3a4b00e..54e58273d 100644 --- a/ipalib/plugins/migration.py +++ b/ipalib/plugins/migration.py @@ -413,7 +413,9 @@ can use their Kerberos accounts.''') ) except errors.NotFound: if not options.get('continue',False): - raise errors.NotFound(reason=_('Container for %(container)s not found' % {'container':ldap_obj_name})) + raise errors.NotFound( + reason=_('Container for %(container)s not found') % {'container': ldap_obj_name} + ) else: truncated = False entries = [] diff --git a/ipalib/plugins/misc.py b/ipalib/plugins/misc.py index 6bb2fc0e7..32457ffbf 100644 --- a/ipalib/plugins/misc.py +++ b/ipalib/plugins/misc.py @@ -106,7 +106,7 @@ class plugins(LocalOrRemote): """Show all loaded plugins""" msg_summary = ngettext( - '%(count)d plugin loaded', '%(count)d plugins loaded' + '%(count)d plugin loaded', '%(count)d plugins loaded', 0 ) takes_options = LocalOrRemote.takes_options + ( diff --git a/ipalib/plugins/netgroup.py b/ipalib/plugins/netgroup.py index 610eb02c3..eeb6de65f 100644 --- a/ipalib/plugins/netgroup.py +++ b/ipalib/plugins/netgroup.py @@ -183,7 +183,7 @@ class netgroup_find(LDAPSearch): member_attributes = ['member', 'memberuser', 'memberhost', 'memberof'] has_output_params = LDAPSearch.has_output_params + output_params msg_summary = ngettext( - '%(count)d netgroup matched', '%(count)d netgroups matched' + '%(count)d netgroup matched', '%(count)d netgroups matched', 0 ) takes_options = LDAPSearch.takes_options + ( diff --git a/ipalib/plugins/permission.py b/ipalib/plugins/permission.py index db063334f..af25f8112 100644 --- a/ipalib/plugins/permission.py +++ b/ipalib/plugins/permission.py @@ -353,7 +353,7 @@ class permission_find(LDAPSearch): """ msg_summary = ngettext( - '%(count)d permission matched', '%(count)d permissions matched' + '%(count)d permission matched', '%(count)d permissions matched', 0 ) has_output_params = LDAPSearch.has_output_params + output_params diff --git a/ipalib/plugins/privilege.py b/ipalib/plugins/privilege.py index 3be466483..24398002f 100644 --- a/ipalib/plugins/privilege.py +++ b/ipalib/plugins/privilege.py @@ -117,7 +117,7 @@ class privilege_find(LDAPSearch): """ msg_summary = ngettext( - '%(count)d privilege matched', '%(count)d privileges matched' + '%(count)d privilege matched', '%(count)d privileges matched', 0 ) api.register(privilege_find) diff --git a/ipalib/plugins/role.py b/ipalib/plugins/role.py index 3324dba8c..8b084c83d 100644 --- a/ipalib/plugins/role.py +++ b/ipalib/plugins/role.py @@ -134,7 +134,7 @@ class role_find(LDAPSearch): """ msg_summary = ngettext( - '%(count)d role matched', '%(count)d roles matched' + '%(count)d role matched', '%(count)d roles matched', 0 ) api.register(role_find) diff --git a/ipalib/plugins/selfservice.py b/ipalib/plugins/selfservice.py index 557304241..53dd1f8da 100644 --- a/ipalib/plugins/selfservice.py +++ b/ipalib/plugins/selfservice.py @@ -183,7 +183,7 @@ class selfservice_find(crud.Search): """ msg_summary = ngettext( - '%(count)d selfservice matched', '%(count)d selfservices matched' + '%(count)d selfservice matched', '%(count)d selfservices matched', 0 ) def execute(self, term, **kw): diff --git a/ipalib/plugins/service.py b/ipalib/plugins/service.py index 21889aa69..d39486c43 100644 --- a/ipalib/plugins/service.py +++ b/ipalib/plugins/service.py @@ -432,7 +432,7 @@ class service_find(LDAPSearch): Search for IPA services. """ msg_summary = ngettext( - '%(count)d service matched', '%(count)d services matched' + '%(count)d service matched', '%(count)d services matched', 0 ) member_attributes = ['managedby'] takes_options = LDAPSearch.takes_options diff --git a/ipalib/plugins/sudocmd.py b/ipalib/plugins/sudocmd.py index 528d79079..117865ea7 100644 --- a/ipalib/plugins/sudocmd.py +++ b/ipalib/plugins/sudocmd.py @@ -127,7 +127,7 @@ class sudocmd_find(LDAPSearch): """ msg_summary = ngettext( - '%(count)d sudo command matched', '%(count)d sudo command matched' + '%(count)d sudo command matched', '%(count)d sudo command matched', 0 ) api.register(sudocmd_find) diff --git a/ipalib/plugins/user.py b/ipalib/plugins/user.py index ae730125d..aedcf4469 100644 --- a/ipalib/plugins/user.py +++ b/ipalib/plugins/user.py @@ -271,10 +271,9 @@ class user_add(LDAPCreate): if 'ipamaxusernamelength' in config: if len(keys[-1]) > int(config.get('ipamaxusernamelength')[0]): raise errors.ValidationError( - name=self.obj.primary_key.cli_name, error=_( - 'can be at most %(len)d characters' % dict( - len = int(config.get('ipamaxusernamelength')[0]) - ) + name=self.obj.primary_key.cli_name, + error=_('can be at most %(len)d characters') % dict( + len = int(config.get('ipamaxusernamelength')[0]) ) ) entry_attrs.setdefault('loginshell', config.get('ipadefaultloginshell')) -- cgit