alorence / django-modern-rpc

Simple XML-RPC and JSON-RPC server for modern Django
http://django-modern-rpc.rtfd.io
MIT License
98 stars 17 forks source link

Update jsonhandler.py #15

Closed sergio-bershadsky closed 7 years ago

sergio-bershadsky commented 7 years ago

More pythonic way to check attribute existance

alorence commented 7 years ago

Actually, the result code is not valid.

exception AttributeError:

should be replaced by

except AttributeError:

Anyway, I don't see any reason to replace a 1-line test by a 3-lines "try catch" block. It could be interesting if the result dict have to get a default value when no data is found in the exception, but this is not the case.