I have a database that accepts user data and then repurposes it for use in 
a different context.  The problem is scrubbing for None; I can do it, but 
its ugly going line by line -- Id rather loop through it but I cant get it 
to work.  

Approach #1

for r in rows:
       . . . . 

       for e in [r.name . . . ]:
             if e == None:
                 e = ''
             r.update_record()    

#OUTPUT: r.name - unchanged . . . e = '' // Updates variable e, not the 
loop variables

Approach #2

for r in rows:
       . . . . 

       for k, v in {'name' : r.name . . . ].items():
             if v == None:
                 v = ''
             r.update_record(k=v)    

#OUTPUT: throws error

Thoughts?



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to