[Tutor] can you explain string replacement syntax and comma separated statements (fwd)

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Mon Aug 7 16:53:06 CEST 2006



---------- Forwarded message ----------
Date: Mon, 7 Aug 2006 00:33:08 -0700 (PDT)
From: anil maran <anilmrn at yahoo.com>
To: Danny Yoo <dyoo at hkn.eecs.berkeley.edu>
Subject: Re: [Tutor] can you explain string replacement syntax and comma
     separated statements

Dear danny yoo
The help page doesnt take about multiline string replacement and this example doesnt work for me - it gives an error on text+ line
Please help me out
thanks a lot
Anil



olderror = web.internalerror
  def error():
      olderror()
      import sys, traceback
      tb = sys.exc_info()
      text = """From: the bugman <y... at example.com>
  To: the bugfixer <y... at example.com>
  Subject: bug: %s: %s (%s)
  Content-Type: multipart/mixed; boundary="----here----"

------here----
  Content-Type: text/plain
  Content-Disposition: inline

%s

%s

------here----
  Content-Type: text/html; name="bug.html"
  Content-Disposition: attachment; filename="bug.html"

""" % (tb[0], tb[1], web.ctx.path, web.ctx.method+' '+web.ctx.home+web.ctx.f
  ullpath,
       ''.join(traceback.format_exception(*tb)),
      text += str(web.djangoerror())
      utils.send('... at example.com', '... at example.com', text)

web.internalerror = error

Danny Yoo <dyoo at hkn.eecs.berkeley.edu> wrote:

On Sun, 6 Aug 2006, anil maran wrote:

>    text = """From: the bugman
> To: the bugfixer
> Subject: bug: %s: %s (%s)
> Content-Type: multipart/mixed; boundary="----here----"

[text example cut]

Hi Anil,

Anil, take a look at:

      http://www.python.org/doc/lib/typesseq-strings.html

Does this address your question?


On a high-level view of your questions so far:  Are you running into
problems because you can't find the documentation?  Or is the issue that
the documentation is unclear?



---------------------------------
Do you Yahoo!?
  Next-gen email? Have it all with the  all-new Yahoo! Mail Beta.


More information about the Tutor mailing list