[Freeipa-devel] [PATCH] 630 rpcserver: login_password datetime fix in expiration check

Tomas Babej tbabej at redhat.com
Thu May 22 08:37:16 UTC 2014


On 05/07/2014 04:37 PM, Petr Vobornik wrote:
> On 7.5.2014 16:30, Tomas Babej wrote:
>>
>> On 05/07/2014 04:26 PM, Petr Vobornik wrote:
>>> On 7.5.2014 16:01, Tomas Babej wrote:
>>>>
>>>> On 05/07/2014 03:47 PM, Petr Vobornik wrote:
>>>>> krbpasswordexpiration conversion to number of second since epoch
>>>>> failed
>>>>> because now we get datetime object instead of string.
>>>>>
>>>>> https://fedorahosted.org/freeipa/ticket/4339
>>>>>
>>>>>
>>>> NACK, I don't think this is the right approach. This does not leverage
>>>> the simplicity which the DateTime parameter refactoring provides.
>>>>
>>>> Instead of converting the datetime to the number of the seconds since
>>>> epoch, and getting the current time represented by the number of
>>>> seconds
>>>> since the epoch (using time.time()), why not use datetime module and
>>>> datetime.datetime.now() to get the current time?
>>>>
>>>> Then you could simplify this:
>>>>
>>>> +                        exp = time.mktime(expiration.timetuple())
>>>> +                        if exp <= time.time():
>>>>
>>>> to this:
>>>>
>>>> +                        if expiration <= datetime.datetime.now()
>>>>
>>>
>>> Good point, fixed
>>>
>>
>> Can you also please remove the (now) unused import for module time?
>>
> done
>

ACK.

-- 
Tomas Babej
Associate Software Engineer | Red Hat | Identity Management
RHCE | Brno Site | IRC: tbabej | freeipa.org 




More information about the Freeipa-devel mailing list