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

Fredrik Lundh fredrik at pythonware.com
Wed Oct 12 01:49:32 EDT 2005


Andy Leszczynski wrote:

> watch this:
> http://www.turbogears.org.nyud.net:8090/docs/wiki20/20MinuteWiki.mov
>
> or read this:
> http://www.turbogears.org.nyud.net:8090/docs/wiki2 0/page4.html
>
> 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":

from page 5:

http://www.turbogears.org.nyud.net:8090/docs/wiki20/page5.html

    Converting incoming arguments

    Something that's a little ugly in that save method is the
    'if new == "True"'. Wouldn't it be nicer to just use the
    more pythonic 'if new'? Piece of cake... we just need to
    use a validator. /.../

</F>






More information about the Python-list mailing list