David Bear
David.Bear at asu.edu
Mon Jun 4 19:58:19 EDT 2007
Thanks. I was thinking in terms of using ',' string catenation like print 'this ', 'is something'.. while using req.write method. I hate having to keep learning the same thing over and over... On Mon, Jun 04, 2007 at 04:47:48PM -0700, David Schachter wrote: > David-- > > Try one of these: > > req.write("the uri is %s" % req.uri) > print >> req, "the uri is %s" % req.uri > print >> req, "the uri is", req.uri > > The latter two forms use the fact that the req object has a write() > method compatible with what the print keyword expects. It's a bit nicer > than the first form, imho. > > You tried to pass two strings to a function that takes only one string > and an optional boolean flag (flush=0). You are lucky the universe did > not invert into a black hole. Or perhaps unlucky; it depends on your > point of view, I suppose. > > -- David Schachter > > David Bear wrote: > >I'm trying to understand all the members/methods of the req object but > >anytime I try something like > > > >req.write('the uri is ', req.uri) > > > >or req.write('the hostname is ', req.hostname) > > > >I get an TypeError. > > > >I'm completely not understanding how to work with the req object. > > > >I assumed members would be 'callable' and return their value. > > > > -- David Bear phone: 602-496-0424 fax: 602-496-0955 College of Public Programs/ASU University Center Rm 622 411 N Central Phoenix, AZ 85007-0685 "Beware the IP portfolio, everyone will be suspect of trespassing"
|