[Freeipa-devel] [PATCH] 0005 Verify otptoken timespan is valid

Jan Cholasta jcholast at redhat.com
Wed Jul 23 15:07:07 UTC 2014


Hi,

On 23.7.2014 15:46, David Kupka wrote:
> https://fedorahosted.org/freeipa/ticket/4244

1) Use "isinstance(X, Y)" instead of "type(X) is Y".

2) When is "type(not_before) is str" or "type(not_after) is str" true? 
The values coming from command options or LDAP should always be 
datetime, never str.

3) There are some misindentations:

+            raise ValidationError(name='not_after',
+                                    error='is before not_before!')

+                raise ValidationError(name='not_after',
+                                    error='is before not_before!')

+                raise ValidationError(name='not_before',
+                                    error='is after not_after!')

4) We don't do exclamation marks in errors messages.

5) Generally, when you want to validate command options, you should look 
into "options", not "entry_attrs".

6) This is not right:

+            result = self.api.Command.otptoken_find(ipatokenuniqueid=
+                entry_attrs.get('ipatokenuniqueid', None))['result']

This is:

+            result = self.api.Command.otptoken_show(keys[-1])['result']

Honza

-- 
Jan Cholasta




More information about the Freeipa-devel mailing list