473,405 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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

watch this:
http://www.turbogears.org.nyud.net:8...MinuteWiki.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":
Oct 12 '05 #1
4 1788
Andy Leszczynski wrote:
watch this:
http://www.turbogears.org.nyud.net:8...MinuteWiki.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:8...i20/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>

Oct 12 '05 #2
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
Oct 12 '05 #3
Sybren Stuvel wrote:
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


So how does it correspond to other piece of the code:

2 def notfound(self, pagename):
3 return dict(pagename=pagename, data="", new=True)

new is a boolean here?

A.
Oct 13 '05 #4
Andy Leszczynski wrote:
So how does it correspond to other piece of the code:

2 def notfound(self, pagename):
3 return dict(pagename=pagename, data="", new=True)

new is a boolean here?


It comes through as a CGI query.

--
Erik Max Francis && ma*@alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
Men and women, women and men. It will never work.
-- Erica Jong
Oct 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Dave | last post by:
Hi everyone, (I already posted this to the VS.NET IDE news group without any responses, so I'm attempting one more time in this group) The issue I'm having is occuring in the IDE of VS.NET...
8
by: Tom | last post by:
Hi I have an aspx page which has javascript to configure xmldata. I added breakpoint to the button method. When I click submit button, it did not go to those breakpoint and show the following...
2
by: andrew007 | last post by:
I do xml / xslt transformation using asp.net but I found any value (w/xml format) in xml node html-encoded to &lt and &gt format if it's > or < tag. Since I have sub xml data in a parent xml node...
8
by: active | last post by:
I use quickwatch on (astrThisOne <> "") and it reports: False as it should because astrThisOne reports: "" Yet If (astrThisOne <> "") Then executes the Then clause
2
by: Water Cooler v2 | last post by:
What do you mean by a cookieless session state? When you set the sessionState section's cookieless attribute to true in the web.config file, what does that mean? I read this...
3
by: André | last post by:
Hi, I put that question already, but it's still not very clear to me, so ... Assume following option in web.config= debug="false" but in one aspx page (test.aspx) <%@ debug="true" ..%>
11
by: Holger | last post by:
Hi I have not been able to figure out how to do compound statement from C - "<test>?<true-val>:<false-val>" But something similar must exist...?! I would like to do the equivalent if python...
0
by: 2Barter.net | last post by:
newsmail@reuters.uk.ed10.net Fwd: Money for New Orleans, AL & GA Inbox Reply Reply to all Forward Print Add 2Barter.net to Contacts list Delete this message Report phishing Show original
1
by: mato81 | last post by:
Hi all! I am a newbie to WSDL. I have a questions which has been driving me crazy... If I would have a WSDL with a types element somewhat like below, what is the point of the third last row...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.