Created
January 22, 2014 09:15
-
-
Save femmerling/8555741 to your computer and use it in GitHub Desktop.
Have problems checking class variable type to ensure that value will be typecasted accordingly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def parser(passed_object, request_data): | |
for item in request_data.values: | |
if hasattr(passed_object, item) and request_data.values.get(item) != None: | |
inputval = request_data.values.get(item) | |
#TODO: check the corresponding class variable type before typecasting | |
setattr(passed_object, item, inputval) | |
return passed_object |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment