Re: [Freeipa-devel] [PATCHES] Bring back old outputting functionality
Rob Crittenden wrote: Pavel Zuna wrote: I compiled 3 patches, that effectively bring back all the functionality we had before Jasons big patch (i.e. before introducing output validation and the common output interface). --all and --raw are back, but this time as global options replacing DNs with primary keys is back clever attribute printing (word-wrapping etc.) is back too To implement --all and --raw as global options, we had to find a way to propagate additional information (apart from command name and parameters) from client to server. We extended the XML-RPC signature from: (arg0, arg1, ..., options) to: (args, options, extras) The extras dict is currently only filled with the 'print_all_attrs' and 'print_raw_attrs' settings when forwarding a call. The server saves the extras dict into the thread specific context variable. I also replaced the decoding table in Encoder, because it didn't really work as expected in special cases. It now uses a dont-decode function. In the case of ldap2, this function checks attribute type OIDs and returns False for binary types. This patch introduces a little problem with the env command, because it fixes a bug/feature, that made it work before. Before outputting an attribute, we check if it isn't of type str. If it is, we assume it is binary and decode it. All values in Env are str. I propose we either write a specific output_for_cli for the env command or think about switching from str to unicode. I tried the later and it didn't cause any problems so far. How it's supposed to work: # ./ipa user-show admin User login: admin Last name: Administrator Home directory: /home/admin Login shell: /bin/bash # ./ipa --all user-show admin dn: uid=admin,cn=users,cn=accounts,dc=pzuna User login: admin Last name: Administrator Full name: Administrator Home directory: /home/admin GECOS field: Administrator Login shell: /bin/bash Kerberos principal: ad...@pzuna UID: 1083719807 GID: 1083719807 Last password change date: 20100208132706Z Password expiration date: 20100509132706Z Member of groups: admins objectclass: top, person, posixaccount, krbprincipalaux, krbticketpolicyaux, inetuser # ./ipa --raw user-show admin uid: admin sn: Administrator homedirectory: /home/admin loginshell: /bin/bash # ./ipa --all --raw user-show admin dn: uid=admin,cn=users,cn=accounts,dc=pzuna uid: admin sn: Administrator cn: Administrator homedirectory: /home/admin gecos: Administrator loginshell: /bin/bash krbprincipalname: ad...@pzuna uidnumber: 1083719807 gidnumber: 1083719807 krblastpwdchange: 20100208132706Z krbpasswordexpiration: 20100509132706Z memberof: cn=admins,cn=groups,cn=accounts,dc=pzuna objectclass: top objectclass: person objectclass: posixaccount objectclass: krbprincipalaux objectclass: krbticketpolicyaux objectclass: inetuser Pavel Generally looks ok, have some questions though: - We currently rely on the fact that binary objects are encoded as python str, it's how we determine what to base64-encode. What mechanism will we have to do that now? I didn't (and I'm not planning to) make any changes in this matter. What I'm saying is that the Env object stores all strings as str and the env command uses the same output_for_cli as LDAP commands, that only use str for binary. So, we either need to override output_for_cli or switch to unicode in Env. - Is print_* the right prefix for these new global variables? It affects more than just printing in the case of all because it returns everything over XML-RPC as well. You're right, maybe get_* or something similar would be better. I'm open to suggestions. - Is there/should there be a way for a plugin to define its own extras? And not to be too pedantic but is extras the best description for these values? Not that I have any suggestions for an improvement :-( Perhaps global_options? The extras dict is there to pass additional information, that is command independent. Commands probably shouldn't define their own. I say probably, because it is possible, that we're going to find out this is actually the best way to accomplish something. Extras might not be the best description, but we need something general, because it can contain pretty much anything and not just global options. - Why are you removing get_options() from LDAPSearch()? Because it was only used to generate an option for the UUID attribute. Since Jason's no_create,no_update patch it isn't needed anymore, because we can just define an UUID param with these flags set. It doesn't look like this is going to conflict too much with the parallel work I've done in regard to including member/memberof in return values, nor in the output work I've done. So you don't need to work on the individual plugins at all, I've got that ready in my tree though I'm going to hold onto it until we can get these patches committed. Cool, that's good to hear... er
Re: [Freeipa-devel] [PATCHES] Bring back old outputting functionality
Rob Crittenden wrote: Pavel Zuna wrote: I compiled 3 patches, that effectively bring back all the functionality we had before Jasons big patch (i.e. before introducing output validation and the common output interface). --all and --raw are back, but this time as global options replacing DNs with primary keys is back clever attribute printing (word-wrapping etc.) is back too To implement --all and --raw as global options, we had to find a way to propagate additional information (apart from command name and parameters) from client to server. We extended the XML-RPC signature from: (arg0, arg1, ..., options) to: (args, options, extras) The extras dict is currently only filled with the 'print_all_attrs' and 'print_raw_attrs' settings when forwarding a call. The server saves the extras dict into the thread specific context variable. I also replaced the decoding table in Encoder, because it didn't really work as expected in special cases. It now uses a dont-decode function. In the case of ldap2, this function checks attribute type OIDs and returns False for binary types. This patch introduces a little problem with the env command, because it fixes a bug/feature, that made it work before. Before outputting an attribute, we check if it isn't of type str. If it is, we assume it is binary and decode it. All values in Env are str. I propose we either write a specific output_for_cli for the env command or think about switching from str to unicode. I tried the later and it didn't cause any problems so far. How it's supposed to work: # ./ipa user-show admin User login: admin Last name: Administrator Home directory: /home/admin Login shell: /bin/bash # ./ipa --all user-show admin dn: uid=admin,cn=users,cn=accounts,dc=pzuna User login: admin Last name: Administrator Full name: Administrator Home directory: /home/admin GECOS field: Administrator Login shell: /bin/bash Kerberos principal: ad...@pzuna UID: 1083719807 GID: 1083719807 Last password change date: 20100208132706Z Password expiration date: 20100509132706Z Member of groups: admins objectclass: top, person, posixaccount, krbprincipalaux, krbticketpolicyaux, inetuser # ./ipa --raw user-show admin uid: admin sn: Administrator homedirectory: /home/admin loginshell: /bin/bash # ./ipa --all --raw user-show admin dn: uid=admin,cn=users,cn=accounts,dc=pzuna uid: admin sn: Administrator cn: Administrator homedirectory: /home/admin gecos: Administrator loginshell: /bin/bash krbprincipalname: ad...@pzuna uidnumber: 1083719807 gidnumber: 1083719807 krblastpwdchange: 20100208132706Z krbpasswordexpiration: 20100509132706Z memberof: cn=admins,cn=groups,cn=accounts,dc=pzuna objectclass: top objectclass: person objectclass: posixaccount objectclass: krbprincipalaux objectclass: krbticketpolicyaux objectclass: inetuser Pavel Am I to assume that a plugin that wants to call api.Command['some_command'] will need to set the local context for all if it wants to return all values? Well, yes. How are we going to do --all for tests? Isn't the environment fixed once the API is initialized? It is fixed, but we can use context in tests as well, right? I have to admit, that this is something I didn't think through when implementing --all and --raw as global options. Setting context to change the behavior of commands called internally isn't going to look very good. :( I'll think about this a little more and see if I can come up with a better solution. rob Pavel ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
[Freeipa-devel] [PATCH] Pass target locale to msginit
Pass target locale to msginit msginit should have been passed the locale because the resulting .po file is parameterized from the locale. Also, if the target locale is not specified it defaults to the current locale. If the target locale is English msgid's are copied to their msgstr's resulting in a fully translated .po instead of a fully untranslated .po. Add some comments to better explain some of the cryptic sed commands. -- John Dennis Looking to carve out IT costs? www.redhat.com/carveoutcosts/ From 2f7b71b109699dd0b5aedb21631cc6839380b719 Mon Sep 17 00:00:00 2001 From: John Dennis Date: Wed, 10 Feb 2010 09:33:11 -0500 Subject: [PATCH] Pass target locale to msginit msginit should have been passed the locale because the resulting .po file is parameterized from the locale. Also, if the target locale is not specified it defaults to the current locale. If the target locale is Engish msgid's are copied to their msgstr's resulting in a fully translated .po instead of a fully untranslated .po. Add some comments to better explain some of the cryptic sed commands. --- install/po/Makefile.in | 40 +++- install/po/ipa.pot |4 ++-- 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/install/po/Makefile.in b/install/po/Makefile.in index bd1f8f9..0a8cd5e 100644 --- a/install/po/Makefile.in +++ b/install/po/Makefile.in @@ -24,7 +24,7 @@ XGETTEXT_OPTIONS = \ --package-name="$(PACKAGE_NAME)" \ --msgid-bugs-address="$(PACKAGE_BUGREPORT)" -languages = $(shell sed 's/\#.*//' LINGUAS) +languages = $(shell sed 's/\#.*//' LINGUAS) # The sed command removes comments po_files = $(patsubst %, %.po, $(languages)) mo_files = $(patsubst %.po, %.mo, $(po_files)) @@ -167,16 +167,18 @@ SUFFIXES = .po .mo $(po_files): $(DOMAIN).pot @if [ ! -f @a ]; then \ + lang=`echo $@ | sed -r -e 's/\.po$$//'` # Strip .po suffix ; \ echo Creating nonexistent $@, you should add this file to your SCM repository; \ - $(MSGINIT) --locale en_US --no-translator -i $(DOMAIN).pot -o $@; \ + $(MSGINIT) --locale $$lang --no-translator -i $(DOMAIN).pot -o $@; \ fi; \ $(MSGMERGE) $@ -o $@ $(DOMAIN).pot create-po: $(DOMAIN).pot @for po_file in $(po_files); do \ if [ ! -e $$po_file ]; then \ + lang=`echo $$po_file | sed -r -e 's/\.po$$//'` # Strip .po suffix ; \ echo Creating nonexistent $$po_file, you should add this file to your SCM repository; \ - $(MSGINIT) --locale en_US --no-translator -i $(DOMAIN).pot -o $$po_file; \ + $(MSGINIT) --locale $$lang --no-translator -i $(DOMAIN).pot -o $$po_file; \ fi; \ done @@ -199,7 +201,11 @@ update-pot: --language="c" \ $(C_POTFILES) \ && \ - mv $(DOMAIN).pot.update $(DOMAIN).pot + mv $(DOMAIN).pot.update $(DOMAIN).pot \ + && \ + # Replace the charset with UTF-8 ; \ + sed -i -r -e 's%("Content-Type: text/plain; charset=)(.*)(\\n")%\1UTF-8\3%' $(DOMAIN).pot + install: $(mo_files) @for lang in $(languages); do \ @@ -216,9 +222,33 @@ clean: mostlyclean distclean: clean rm -f Makefile +# We test our translations by taking the original untranslated string +# (e.g. msgid) and prepend a prefix character and then append a suffix +# character. The test consists of asserting that the first character in the +# translated string is the prefix, the last character in the translated string +# is the suffix and the everything between the first and last character exactly +# matches the original msgid. +# +# We use unicode characters not in the ascii character set for the prefix and +# suffix to enhance the test. To make reading the translated string easier the +# prefix is the unicode right pointing arrow and the suffix left pointing arrow, +# thus the translated string looks like the original string enclosed in +# arrows. In ASCII art the string "foo" would render as: +# -->foo<-- +# +# Unicode right pointing arrow: u'\u2192', utf-8 = '\xe2\x86\x92' +# Unicode left pointing arrow: u'\u2190', utf-8 = '\xe2\x86\x90' +# +# The sed command below performs the prefix and suffix substitution. +# +# When msginit is invoked with an English target locale it copies the msgid +# into the msgstr. This is an undocumented feature of msginit. Otherwise the +# msgstr will be set to the empty string (i.e. untranslated). We depend on +# the msgid being copied to the msgstr. + test_lang: rm -rf test.po test_locale - $(MSGINIT) --no-translator -i $(DOMAIN).pot -o test.po + $(MSGINIT) --no-translator -i $(DOMAIN).pot -l en_US -o test.po sed -i -r -e 's/^msgstr[ \t]+"(.*)"[ \t]*$$/msgstr "\xe2\x86\x92\1\xe2\x86\x90"/' test.po $(MKDIR_P) test_locale/en_US/LC_MESSAGES $(MSGFMT) -o test_locale/en_US/LC_MESSAGES/ipa.mo test.po diff --git a/install/po/ipa.pot b/install/po/ipa.pot index 5662807..5631c01 100644 --- a/install/po/ipa.pot +++ b/install/po/ipa.pot @@ -9,12 +9,12 @@ msgstr "" "Project-Id-Version: ipa\n" "Report-Msgid-Bugs-To: https://hosted.fedoraproject.org/projects/free
Re: [Freeipa-devel] [PATCHES] Bring back old outputting functionality
Pavel Zuna wrote: Rob Crittenden wrote: Pavel Zuna wrote: I compiled 3 patches, that effectively bring back all the functionality we had before Jasons big patch (i.e. before introducing output validation and the common output interface). --all and --raw are back, but this time as global options replacing DNs with primary keys is back clever attribute printing (word-wrapping etc.) is back too To implement --all and --raw as global options, we had to find a way to propagate additional information (apart from command name and parameters) from client to server. We extended the XML-RPC signature from: (arg0, arg1, ..., options) to: (args, options, extras) The extras dict is currently only filled with the 'print_all_attrs' and 'print_raw_attrs' settings when forwarding a call. The server saves the extras dict into the thread specific context variable. I also replaced the decoding table in Encoder, because it didn't really work as expected in special cases. It now uses a dont-decode function. In the case of ldap2, this function checks attribute type OIDs and returns False for binary types. This patch introduces a little problem with the env command, because it fixes a bug/feature, that made it work before. Before outputting an attribute, we check if it isn't of type str. If it is, we assume it is binary and decode it. All values in Env are str. I propose we either write a specific output_for_cli for the env command or think about switching from str to unicode. I tried the later and it didn't cause any problems so far. How it's supposed to work: # ./ipa user-show admin User login: admin Last name: Administrator Home directory: /home/admin Login shell: /bin/bash # ./ipa --all user-show admin dn: uid=admin,cn=users,cn=accounts,dc=pzuna User login: admin Last name: Administrator Full name: Administrator Home directory: /home/admin GECOS field: Administrator Login shell: /bin/bash Kerberos principal: ad...@pzuna UID: 1083719807 GID: 1083719807 Last password change date: 20100208132706Z Password expiration date: 20100509132706Z Member of groups: admins objectclass: top, person, posixaccount, krbprincipalaux, krbticketpolicyaux, inetuser # ./ipa --raw user-show admin uid: admin sn: Administrator homedirectory: /home/admin loginshell: /bin/bash # ./ipa --all --raw user-show admin dn: uid=admin,cn=users,cn=accounts,dc=pzuna uid: admin sn: Administrator cn: Administrator homedirectory: /home/admin gecos: Administrator loginshell: /bin/bash krbprincipalname: ad...@pzuna uidnumber: 1083719807 gidnumber: 1083719807 krblastpwdchange: 20100208132706Z krbpasswordexpiration: 20100509132706Z memberof: cn=admins,cn=groups,cn=accounts,dc=pzuna objectclass: top objectclass: person objectclass: posixaccount objectclass: krbprincipalaux objectclass: krbticketpolicyaux objectclass: inetuser Pavel Generally looks ok, have some questions though: - We currently rely on the fact that binary objects are encoded as python str, it's how we determine what to base64-encode. What mechanism will we have to do that now? I didn't (and I'm not planning to) make any changes in this matter. My point is that for binary objects we were explicitly setting their type to str. We don't seem to be doing that any more, so are we relying on python-ldap to default to the str type? It's ok if we do I'd just like to see a comment to that effect in case something changes in the future. What I'm saying is that the Env object stores all strings as str and the env command uses the same output_for_cli as LDAP commands, that only use str for binary. So, we either need to override output_for_cli or switch to unicode in Env. Not exactly sure what to do here though using unicode seems like the best route. - Is print_* the right prefix for these new global variables? It affects more than just printing in the case of all because it returns everything over XML-RPC as well. You're right, maybe get_* or something similar would be better. I'm open to suggestions. I'm ok with print_raw because that is what it does. maybe print_all -> retrieve_all? - Is there/should there be a way for a plugin to define its own extras? And not to be too pedantic but is extras the best description for these values? Not that I have any suggestions for an improvement :-( Perhaps global_options? The extras dict is there to pass additional information, that is command independent. Commands probably shouldn't define their own. I say probably, because it is possible, that we're going to find out this is actually the best way to accomplish something. Extras might not be the best description, but we need something general, because it can contain pretty much anything and not just global options. Ok, I don't want to agonize too much over a variable name. - Why are you removing get_options() from LDAPSearch()? Because it was only used to generat
[Freeipa-devel] [PATCH] Add 1 intital language translation
The %{find_lang} macro in the ipa.spec file will fail if there are no language translations causing the build to fail. This patch creates an Italian translation (in honor of Simo). The Italian translation is initially fully untranslated. -- John Dennis Looking to carve out IT costs? www.redhat.com/carveoutcosts/ From 76a311bafa180b0fe1db53a8feae16039496b14e Mon Sep 17 00:00:00 2001 From: John Dennis Date: Wed, 10 Feb 2010 11:07:22 -0500 Subject: [PATCH] Add 1 intital language translation The %{find_lang} macro in the ipa.spec file will fail if there are no language translations causing the build to fail. This patch creates an Italian translation (in honor of Simo). The Italian translation is initially fully untranslated. --- install/po/LINGUAS |1 + install/po/it.po | 604 2 files changed, 605 insertions(+), 0 deletions(-) create mode 100644 install/po/it.po diff --git a/install/po/LINGUAS b/install/po/LINGUAS index e69de29..7d5856f 100644 --- a/install/po/LINGUAS +++ b/install/po/LINGUAS @@ -0,0 +1 @@ +it diff --git a/install/po/it.po b/install/po/it.po new file mode 100644 index 000..8c19f47 --- /dev/null +++ b/install/po/it.po @@ -0,0 +1,604 @@ +# Italian translations for ipa-server package. +# Copyright (C) 2010 Red Hat +# This file is distributed under the same license as the ipa-server package. +# Automatically generated, 2010. +# +msgid "" +msgstr "" +"Project-Id-Version: ipa\n" +"Report-Msgid-Bugs-To: https://hosted.fedoraproject.org/projects/freeipa/"; +"newticket\n" +"POT-Creation-Date: 2010-02-10 09:13-0500\n" +"PO-Revision-Date: 2010-02-10 09:13-0500\n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: ../../ipalib/parameters.py:228 +msgid "incorrect type" +msgstr "" + +#: ../../ipalib/parameters.py:231 +msgid "Only one value is allowed" +msgstr "" + +#: ../../ipalib/parameters.py:795 +msgid "must be True or False" +msgstr "" + +#: ../../ipalib/parameters.py:896 +msgid "must be an integer" +msgstr "" + +#: ../../ipalib/parameters.py:947 +#, python-format +msgid "must be at least %(minvalue)d" +msgstr "" + +#: ../../ipalib/parameters.py:957 +#, python-format +msgid "can be at most %(maxvalue)d" +msgstr "" + +#: ../../ipalib/parameters.py:967 +msgid "must be a decimal number" +msgstr "" + +#: ../../ipalib/parameters.py:989 +#, python-format +msgid "must be at least %(minvalue)f" +msgstr "" + +#: ../../ipalib/parameters.py:999 +#, python-format +msgid "can be at most %(maxvalue)f" +msgstr "" + +#: ../../ipalib/parameters.py:1059 +#, python-format +msgid "must match pattern \"%(pattern)s\"" +msgstr "" + +#: ../../ipalib/parameters.py:1077 +msgid "must be binary data" +msgstr "" + +#: ../../ipalib/parameters.py:1092 +#, python-format +msgid "must be at least %(minlength)d bytes" +msgstr "" + +#: ../../ipalib/parameters.py:1102 +#, python-format +msgid "can be at most %(maxlength)d bytes" +msgstr "" + +#: ../../ipalib/parameters.py:1112 +#, python-format +msgid "must be exactly %(length)d bytes" +msgstr "" + +#: ../../ipalib/parameters.py:1130 +msgid "must be Unicode text" +msgstr "" + +#: ../../ipalib/parameters.py:1160 +#, python-format +msgid "must be at least %(minlength)d characters" +msgstr "" + +#: ../../ipalib/parameters.py:1170 +#, python-format +msgid "can be at most %(maxlength)d characters" +msgstr "" + +#: ../../ipalib/parameters.py:1180 +#, python-format +msgid "must be exactly %(length)d characters" +msgstr "" + +#: ../../ipalib/parameters.py:1219 +#, python-format +msgid "must be one of %(values)r" +msgstr "" + +#: ../../ipalib/cli.py:505 +#, python-format +msgid "Enter %(label)s again to verify: " +msgstr "" + +#: ../../ipalib/cli.py:509 +msgid "Passwords do not match!" +msgstr "" + +#: ../../ipalib/cli.py:514 +msgid "Cancelled." +msgstr "" + +#: ../../ipalib/frontend.py:377 +msgid "Results are truncated, try a more specific search" +msgstr "" + +#: ../../ipalib/errors.py:297 +#, python-format +msgid "%(cver)s client incompatible with %(sver)s server at %(server)r" +msgstr "" + +#: ../../ipalib/errors.py:315 +#, python-format +msgid "unknown error %(code)d from %(server)s: %(error)s" +msgstr "" + +#: ../../ipalib/errors.py:331 +msgid "an internal error has occurred" +msgstr "" + +#: ../../ipalib/errors.py:353 +#, python-format +msgid "an internal error has occurred on server at %(server)r" +msgstr "" + +#: ../../ipalib/errors.py:369 +#, python-format +msgid "unknown command %(name)r" +msgstr "" + +#: ../../ipalib/errors.py:386 ../../ipalib/errors.py:411 +#, python-format +msgid "error on server %(server)r: %(error)s" +msgstr "" + +#: ../../ipalib/errors.py:402 +#, python-format +msgid "cannot connect to %(uri)r: %(error)s" +msgstr "" + +#: ../../ipalib/errors.py:420 +#, python-format +msgid "Invalid JSON-RPC request: %(error)s" +msgstr
Re: [Freeipa-devel] [PATCH] Add 1 intital language translation
John Dennis wrote: The %{find_lang} macro in the ipa.spec file will fail if there are no language translations causing the build to fail. This patch creates an Italian translation (in honor of Simo). The Italian translation is initially fully untranslated. ack, pushed to master ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] Pass target locale to msginit
John Dennis wrote: Pass target locale to msginit msginit should have been passed the locale because the resulting .po file is parameterized from the locale. Also, if the target locale is not specified it defaults to the current locale. If the target locale is English msgid's are copied to their msgstr's resulting in a fully translated .po instead of a fully untranslated .po. Add some comments to better explain some of the cryptic sed commands. ack, pushed to master ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] add a test locale to our i18n support, used for testing translations
John Dennis wrote: This patch adds testing support to our i18n translations. Read the file test_i18n.py to see how this is done. Makefile now supports a test_lang and test target "make test" creates the test language, installs it in under a temporary locale directory in the install/po subdir and then runs test_i18n.py. At some point in the future we need to add a real test for translations but that is dependent on Jason finishing the LazyText work. That test will follow the logic in test_i18n.py. ack, pushed to master ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCHES] Bring back old outputting functionality
On Wed, 2010-02-10 at 10:30 -0500, Rob Crittenden wrote: > Pavel Zuna wrote: > > What I'm saying is that the Env object stores all strings as str and the > > env command uses the same output_for_cli as LDAP commands, that only use > > str for binary. So, we either need to override output_for_cli or switch > > to unicode in Env. > > Not exactly sure what to do here though using unicode seems like the > best route. > Yes, we should store the env as `unicode`... this is something I've been meaning to do. I originally left them as `str` because I was having problems using `unicode` somewhere (maybe it was python-ldap), but we should just fix this special case in the appropriate place. As I wrote the latest Env version (using Martins work as a starting point), I can make this change. Should this be post-alpha? ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
[Freeipa-devel] [PATCH] Friendlier diagnostics for i18n test
The diagnostic messages in test_i18n.py were a bit confusing because it didn't indicate what the test string was and where it came from. Hopefully this is clearer now. -- John Dennis Looking to carve out IT costs? www.redhat.com/carveoutcosts/ From c81728580e4e5f43d5cd35a0d48073e63d2cfe05 Mon Sep 17 00:00:00 2001 From: John Dennis Date: Wed, 10 Feb 2010 11:57:58 -0500 Subject: [PATCH] Make test_i18n.py diagnostics friendlier --- install/po/test_i18n.py | 14 +- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/install/po/test_i18n.py b/install/po/test_i18n.py index 8560fc8..be74d49 100755 --- a/install/po/test_i18n.py +++ b/install/po/test_i18n.py @@ -39,6 +39,8 @@ suffix = u'\u2190' # utf-8 == '\xe2\x86\x90' def main(): +test_file = 'test.po' + try: # The test installs the test message catalog under the en_US (e.g. U.S. English) @@ -53,28 +55,30 @@ def main(): gettext.install('ipa', 'test_locale', unicode=1) # We need a translatable string to test with, read one from the test po file -msgid = get_msgid('test.po') +msgid = get_msgid(test_file) + +print "Using message string \"%s\" found in file \"%s\"" % (msgid, test_file) # Get the translated version of the msgid string by invoking _() translated = _(msgid) # Verify the first character is the test prefix if translated[0] != prefix: -raise ValueError("first char in (%s) not equal to prefix (%s)" % \ +raise ValueError("First char in translated string \"%s\" not equal to prefix \"%s\"" % \ (translated.encode('utf-8'), prefix.encode('utf-8'))) # Verify the last character is the test suffix if translated[-1] != suffix: -raise ValueError("last char in (%s) not equal to suffix (%s)" % \ +raise ValueError("Last char in translated string \"%s\" not equal to suffix \"%s\"" % \ (translated.encode('utf-8'), suffix.encode('utf-8'))) # Verify everything between the first and last character is the # original untranslated string if translated[1:-1] != msgid: -raise ValueError("interior of (%s) not equal to msgid (%s)" % \ +raise ValueError("Translated string \"%s\" minus the first & last character is not equal to msgid \"%s\"" % \ (translated.encode('utf-8'), msgid)) -print "success: %s = %s" % (msgid, _(msgid).encode('utf-8')) +print "Success: message string \"%s\" maps to translated string \"%s\"" % (msgid, _(msgid).encode('utf-8')) except Exception, e: print >> sys.stderr, "ERROR: %s" % e return 1 -- 1.6.6 ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
[Freeipa-devel] Important: Action required if you add a new file
If you add a new file to our git tree and that file has translatable strings in it (e.g. a string enclosed in _()) then you must edit the file install/po/Makefile.in and add the file to one of the POTFILES list (currently there are two POTFILES lists, one for python sources and one for C sources). If the source code file is not listed in install/po/Makefile.in we won't pick up the translations for it. Sorry for introducing an extra manual step when adding a file but there is no way to automate this. If the new file is neither a python file nor a C file you will need to create a new POTFILES list for the language type (language as in source code language) and update the update-pot target in the Makefile.in to include the new POTFILES list (making sure to pay attention to the --language argument of xgettext). -- John Dennis Looking to carve out IT costs? www.redhat.com/carveoutcosts/ ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] 375 selinux fix for CRLs
On Tue, 2010-02-09 at 17:25 -0500, Rob Crittenden wrote: > Fix an SELinux permissions problem when retrieving CRLs via Apache. > > rob ack. pushed to master. ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH[ 376 fix ipa-join segfault
On Tue, 2010-02-09 at 23:04 -0500, Rob Crittenden wrote: > Make sure incoming data isn't NULL before trying to strdup() it. Bad > things happen otherwise. > > rob ack. pushed to master. ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
[Freeipa-devel] [PATCH] jderose 042 output_params
As discussed with Rob on IRC, this patch changes the Command.get_output_params() method so that by default your Command.output_params will be the same as your Command.params. This make the behavior similar to how Method.get_output_params() fills your Method.params with the params in the corresponding Object.params. If you have args or options that you *don't* want in output_params, add the 'no_output' flag, like this: Str('foo', flags=['no_output']) This is similar to the 'no_create', 'no_update', and 'no_search' flags for Method plugins. If you need output that wont be in your args or options, add them in a `has_output_params` tuple, like this: has_output_params = ( 'bar', 'baz', ) I'll add docstrings in another patch, but this is blocking Rob, so I made it a quickie. >From 0ff22e4a0fa946e6011e77554fd55f005d40d8d2 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Wed, 10 Feb 2010 21:15:47 -0700 Subject: [PATCH] Command.output_params not contains params in Command.params --- ipalib/frontend.py |7 +++ tests/test_ipalib/test_frontend.py | 27 +++ 2 files changed, 34 insertions(+), 0 deletions(-) diff --git a/ipalib/frontend.py b/ipalib/frontend.py index 1cc2ea2..0abb35b 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -810,6 +810,13 @@ class Command(HasParam): def get_output_params(self): for param in self._get_param_iterable('output_params', verb='has'): yield param +if self.params is None: +return +for param in self.params(): +if 'no_output' in param.flags: +continue +yield param + def output_for_cli(self, textui, output, *args, **options): if not isinstance(output, dict): diff --git a/tests/test_ipalib/test_frontend.py b/tests/test_ipalib/test_frontend.py index b5ecd05..7c67d6c 100644 --- a/tests/test_ipalib/test_frontend.py +++ b/tests/test_ipalib/test_frontend.py @@ -28,6 +28,7 @@ from ipalib.constants import TYPE_ERROR from ipalib.base import NameSpace from ipalib import frontend, backend, plugable, errors, parameters, config from ipalib import output +from ipalib.parameters import Str def test_RULE_FLAG(): assert frontend.RULE_FLAG == 'validation_rule' @@ -654,6 +655,32 @@ class test_Command(ClassChecker): 'nested', 'Subclass', 'world', 4, dict, tuple, nope ) +def test_get_output_params(self): +""" +Test the `ipalib.frontend.Command.get_output_params` method. +""" +class example(self.cls): +has_output_params = ( +'one', +'two', +'three', +) +takes_args = ( +'foo', +) +takes_options = ( +Str('bar', flags='no_output'), +'baz', +) + +inst = example() +assert list(inst.get_output_params()) == ['one', 'two', 'three'] +inst.finalize() +assert list(inst.get_output_params()) == [ +'one', 'two', 'three', inst.params.foo, inst.params.baz +] +assert list(inst.output_params) == ['one', 'two', 'three', 'foo', 'baz'] + class test_LocalOrRemote(ClassChecker): """ -- 1.6.3.3 ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel