On 22.4.2014 13:32, Tomas Babej wrote:
Thank you for the suggestions. Updated, rebased patch is attached.


This API.txt change from the next patch belongs in this patch:

+capability: datetime_values 2.84


I think you should use the LDAP_GENERALIZED_TIME_FORMAT constant here:

+    accepted_formats = ['%Y%m%d%H%M%SZ',       # generalized time


This is not right:

+        elif isinstance(val, datetime.datetime):
+            return val

To actually decode LDAP generalized time attributes to datetime, you need to do this:

         '2.16.840.1.113719.1.301.4.41.1' : DN,  # krbSubTrees
         '2.16.840.1.113719.1.301.4.52.1' : DN,  # krbObjectReferences
         '2.16.840.1.113719.1.301.4.53.1' : DN,  # krbPrincContainerRef
+
+        '1.3.6.1.4.1.1466.115.121.1.24'  : datetime.datetime,
     }

     # In most cases we lookup the syntax from the schema returned by

and this:

                     return val
                 elif target_type is unicode:
                     return val.decode('utf-8')
+                elif target_type is datetime.datetime:
+ return datetime.datetime.strptime(val, LDAP_GENERALIZED_TIME_FORMAT)
                 else:
                     return target_type(val)
             except Exception, e:

and add code for formatting datetime values to the textui backend.

--
Jan Cholasta

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to