best practice? null/None vs 'None' vs '' (in web/sql)

fluxent at yahoo.com fluxent at yahoo.com
Fri Mar 30 11:12:47 EST 2001


(Python 2.x, Win2K, IIS5)

I've got some simple pages for viewing and editing SQL records via 
Python in ASP.

I would really like to distinguish between fields with null values 
and fields that might actually include the text string 'None'. Right 
now both cases come out from a SELECT as showing up as 'None', and 
then when I submit and edit they definitely get changed to 'None', so 
I end up with no nulls.

I can see that the ODBC result set distinguishes them. But of course 
when things get rendered out to HTML you don't want to see single 
quotes around every string value, so 'None' and None become the same 
thing.

So, I guess this isn't a platform bug, it's a nasty area calling for 
some sort of interface standard. Is there a best practice I should 
adopt?

Maybe (a) transform the outputs of each SELECT to a different 
representation of None (either '' or 'null'?), then (b) transform all 
UPDATE query strings before executing them to change any ='' (or 
='null') to =NULL?






More information about the Python-list mailing list