[Freeipa-devel] Re: [PATCHES] Add support for incomplete (truncated) search results.

Rob Crittenden rcritten at redhat.com
Mon Jun 15 14:39:49 UTC 2009


Pavel Zuna wrote:
> Rob Crittenden wrote:
>> Pavel Zůna wrote:
>>> Rob Crittenden wrote:
>>>> Pavel Zůna wrote:
>>>>> Rob Crittenden wrote:
>>>>>> Pavel Zuna wrote:
>>>>>>> Patch 0001: Add support for incomplete (truncated) search results.
>>>>>>>
>>>>>>> ldap2 didn't have the capability to return search results when a 
>>>>>>> DS limitation got exceeded (an exception was raised).
>>>>>>>
>>>>>>> Pavel
>>>>>>
>>>>>> I think truncated should be initialized to False, not None. It 
>>>>>> looks like this could actually be transported across XML-RPC and I 
>>>>>> don't believe we've enabled the NULL option (and I'd rather avoid 
>>>>>> doing so).
>>>>>>
>>>>>> If this is ok I can make this change before committing the patch.
>>>>>>
>>>>>> rob
>>>>>
>>>>> It is set to None, because otherwise it gets encoded into a string 
>>>>> by the decode_retval decorator. If that's a problem I'll rework 
>>>>> decode_retval.
>>>>>
>>>>> Pavel
>>>>
>>>> Well, in general it would be nice if we could return booleans as 
>>>> welll, that is a supported XML-RPC data type.
>>>>
>>>> rob
>>>>
>>>
>>> The decode_retval decorator currently decodes everything returned by 
>>> the decorated function into the python unicode type except None 
>>> (unless configured otherwise). There is no option to only decode a 
>>> certain part, but it shouldn't be hard to rework it to be similar to 
>>> encode_args. I didn't think of this, because it is only used by 
>>> find_entries at this point.
>>>
>>> Pavel
>>
>> Why convert int, bool, long, etc into a unicode at all? Why not just 
>> return them as-is?
>>
>> rob
>>
> No reason really - I was just converting everything. I removed the 
> conversion of non-string scalar types. Here's an updated patch.
> 
> Pavel

Still doesn't work. I get the error on the server-side:

ipa: ERROR: non-public: TypeError: ("python built-in type expected, got 
'%s'", <type 'bool'>)

My diff to your pathc looks like:

diff --git a/ipalib/encoder.py b/ipalib/encoder.py
index f5899a4..9d9d735 100644
--- a/ipalib/encoder.py
+++ b/ipalib/encoder.py
@@ -126,8 +126,8 @@ class Encoder(object):
              return self.encoder_settings.decode_postprocessor(
                  var.decode(self.encoder_settings.decode_from)
              )
-        # elif isinstance(var, (bool, float, int, long)):
-        #    return 
self.encoder_settings.decode_postprocessor(unicode(var))
+        elif isinstance(var, (bool, float, int, long)):
+            return var
          elif isinstance(var, list):
              return [self.decode(m) for m in var]
          elif isinstance(var, tuple):

Can I fix this before committing or is it going to subtly break 
something else?

rob

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3245 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20090615/87517770/attachment.bin>


More information about the Freeipa-devel mailing list