The value stored in the database for content type is "text/plain;
charset=utf-8" (without the quotes) and it gives me that error. I
tried editing the database to have just 'text' and it didn't work, and
I did a manual post using http://code.google.com/p/rest-client/ and
set the content type ot "text". That saved properly as "text" and it
failed on the GET. Is it something weird in my code somewhere?

On Sep 15, 6:39 pm, "Marzia Niccolai" <[EMAIL PROTECTED]> wrote:
> Hi Steve,
>
> I wrote this little app to test out what you are trying to do, and it works
> fine:
>
> class Card(db.Model):
>   contentType = db.StringProperty()
>
> class CardsRoot(webapp.RequestHandler):
>   def get(self):
>     self.response.headers['Content-Type'] = 'text'
>     self.redirect('/string')
>
> class CardsResponse(webapp.RequestHandler):
>   def get(self):
>     my_str = self.request.headers['Content-Type'] = 'text'
>     new_card = Card(contentType=my_str)
>     new_card.put()
>
>     self.response.headers['Content-Type'] = new_card.contentType
>     self.response.out.write(new_card.contentType)
>
> And the content-type header and field in the datastore are both set to
> 'text'.
>
> This makes me wonder how the Content-Type header for the requests your app
> is receiving are set.  Before I explicitly set it, there was no content-type
> header, and I was getting errors.
>
> For the example entity that is throwing the error, what is listed in the
> datastore for contentType?
>
> -Marzia
>
> On Mon, Sep 15, 2008 at 7:44 AM, Steve Armstrong
> <[EMAIL PROTECTED]>wrote:
>
>
>
> > Greetings,
>
> > I'm trying to setup a basic REST api for an address book, and the line
>
> > self.response.headers['Content-Type'] = card.contentType
>
> > causes the following traceback:
>
> > Traceback (most recent call last):
> >  File "C:\Python25\lib\wsgiref\handlers.py", line 92, in run
> >    self.result = application(self.environ, self.start_response)
> >  File "C:\Program
> > Files\Google\google_appengine\google\appengine\ext\webapp
> > \__init__.py",
> > line 519, in __call__
> >    response.wsgi_write(start_response)
> >  File "C:\Program
> > Files\Google\google_appengine\google\appengine\ext\webapp
> > \__init__.py",
> > line 248, in wsgi_write
> >    write = start_response('%d %s' % self.__status,
> > self.__wsgi_headers)
> >  File "C:\Python25\lib\wsgiref\handlers.py", line 185, in
> > start_response
> >    assert type(val) is StringType,"Header values must be strings"
> > AssertionError: Header values must be strings
>
> > card.contentType is defined as db.StringProperty()
>
> > Here's the full source:
> >http://code.google.com/p/olabs/source/browse/trunk/server/appengine/c...
> > Any help is appreciated.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to