[Zope] Close But No Cigar (Formulator/ZPT)

Dylan Reinhardt Dylan@DylanReinhardt.com
Tue, 05 Nov 2002 10:08:50 -0800


At 01:49 PM 11/5/2002 -0400, beno wrote:
>message = "Hi, Mike! You've just been sent an email from your Web site!\n\n"
>message += "Sender's name: " + YourName + "\n"
>message += "Sender's phone: " + YourPhone + "\n"
>message += "Sender's email: " + YourEmail + "\n\n"
>message += "Sender's comments: " + YourMessage + "\n"
>mMsg = message


Somewhat unrelated, but hopefully helpful:

The quoted code snippet will work quite a bit more efficiently as:

message = []
message.append("Hi, Mike! You've just been sent an email from your Web 
site!\n")
message.append("Sender's name: %s" % YourName)
...
mMsg = '\n'.join(message)

If you aren't sending out a lot of these, it may not make much difference 
in this specific case, but making a habit of using %s and append/join to 
concatenate strings instead of  + and +=  is well worth your while.

FWIW,

Dylan