If you need to check for and convert the “None” string when returning the value of an object, here is a quick and readable method in python:
myObj = None print myObj or ''
This brought back a reference to a blurb in Dive Into Python regarding ternary operators, although at the time I didn’t think of using it this way.
March 6th, 2010 at 4:32 pm
This is great! Thanks for your article. I am just starting django and this will help a lot.