TurboGears /.-ed, >new == True< or >new == "True"<

Sybren Stuvel sybrenUSE at YOURthirdtower.com.imagination
Wed Oct 12 01:55:22 EDT 2005


Andy Leszczynski enlightened us with:
> should not it be:
>
> 2 def save(self, pagename, data, submit, new):
> 3 hub.begin()
> 4 if new == True:
> 5     page = Page(pagename=pagename, data=data)
> 6 else:
> 7     page = Page.byPagename(pagename)
> 8     page.data = data
>
> instead of:
>
> 4 if new == "True":

No it should not. The values passed to the function are the strings
passed by the GET request, hence all strings. There are methods of
dealing with this - read the rest of the documentation.

Sybren
-- 
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself? 
                                             Frank Zappa



More information about the Python-list mailing list