Skip to content

Instantly share code, notes, and snippets.

@femmerling
Created January 22, 2014 09:15
Show Gist options
  • Save femmerling/8555741 to your computer and use it in GitHub Desktop.
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
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