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

Tomas Babej tbabej at redhat.com
Wed May 7 14:01:22 UTC 2014


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
>
>
> _______________________________________________
> Freeipa-devel mailing list
> Freeipa-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/freeipa-devel

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()

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20140507/770a9e14/attachment.htm>


More information about the Freeipa-devel mailing list