[Pki-devel] [PATCH] 100 Refactoring profile.py and fixes a few issues

Abhishek Koneru akoneru at redhat.com
Thu Jul 10 16:59:18 UTC 2014


The attached patch contains the following changes.

-- Refactoring profile.py and replacing the usage of property with a
dictionary for attribute name conversions(when sending the objects back
to server).

-- Replace the logic of traversing the dict of NOTYPES with a search in
NOTYPES.itervalues for the instance of an object. The traversal method
causes an issue in-case of inherited classes as
isinstance(cert_review_response, obj)) is true for obj=
CertEnrolmentRequest/CertReviewResponse. Since a dict is not an ordered
data structure, we cannot traverse it correctly. This creates problems
during attr name conversion.

This can still be modified by using a Set for NOTYPES and TYPES and
adding the class objects to the sets and performing a lookup.
Since this requires changes across the python code, i think we should
take this up in a separate patch.

-- Rewrote the attr_name_conversion method in encoder.py to return a new
dict with the changes attribute names rather than make the changes to
the object's __dict__. This would allow re-usage of the object.
Otherwise an AttributeError will be raised when accessing an attribute.

--Abhishek
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pki-akoneru-0100-Refactoring-ProfileClient-to-remove-the-property-fie.patch
Type: text/x-patch
Size: 28908 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/pki-devel/attachments/20140710/7b329e48/attachment.bin>


More information about the Pki-devel mailing list