[Freeipa-users] What does the "u" mean in IPA messages?

John Dennis jdennis at redhat.com
Thu Feb 28 23:01:18 UTC 2013


On 02/28/2013 05:34 PM, KodaK wrote:
> On Thu, Feb 28, 2013 at 3:27 PM, John Dennis <jdennis at redhat.com> wrote:
>> On 02/28/2013 04:18 PM, KodaK wrote:
>>>
>>> When performing an operation with the IPA tools, I get a message every
>>> time similar to this:
>>>
>>> ipa: INFO: Forwarding 'hbactest' to server u'https://ipaserver/ipa/xml'
>>>
>>> What does it mean?  I've never seen it say anything other than "u"
>>> (that I've noticed.)  A pointer to documentation is preferred, but
>>> I've been looking and haven't found anything.  (Lots of stuff on the
>>> International Phonetic Alphabet's use of "u" though.  I think I'm
>>> qualified to edit dictionaries now.)
>>
>>
>> It means unicode, It's a Python'ism. In Python2 there are two different
>> string types str and unicode. str's are have 8-bit characters, unicode have
>> wide characters (either 16-bit UCS2 or 32-bit UCS4) depending on how Python
>> was built (unicode is UCS4 on our builds). Since IPA in internationalized we
>> use unicode for all strings.
>>
>> What the u prefix is telling you is the type of the string. The only reason
>> you see it is because in some places we use the repr method to output string
>> data and the repr method prefixes unicode with a u character. We've been
>> fixing places where repr method is used, not sure if this is one of those or
>> not. We were using repr because early on we were not consistent with whether
>> we used str's or unicode objects and it was handy to know the difference,
>> it's not so much of an issue any more.
>
> Ah, thanks for the explanation.  If I build parsing scripts for
> things, is the "u" going to disappear in the future with the
> discontinuation of the repr method?  (That's what set this off in the
> first place.)

You should not depend on the type prefix. There are other prefixes 
besides u but I think u is the only one you'll see in practice. My 
suggestion for parsing would be to permit the prefix but to ignore it if 
it's present.

BTW, why are you parsing diagnostic output?  They are not part of the 
official API. We do not have any consistency rules for INFO and DEBUG 
messages, they can change at any time and often do. On the other hand 
command output is fairly consistent and not subject to the capricious 
whims of developers.



-- 
John Dennis <jdennis at redhat.com>

Looking to carve out IT costs?
www.redhat.com/carveoutcosts/




More information about the Freeipa-users mailing list