So I'm following the Python Image tutorial for Google App Engine and I'm getting the error: "raise ValueError('Name %r cannot contain period characters' % (name,))"
I'm trying to save an image as part of my Model. I think it has to do with how I'm saving the uploaded image. I used ndb.BlobProperty() in my Model class. Here's the code.
class Greeting(ndb.Model): """A main model for representing an individual Guestbook entry.""" author = ndb.StructuredProperty(Author) content = ndb.StringProperty(indexed=False) avatar = ndb.BlobProperty() date = ndb.DateTimeProperty(auto_now_add=True)
Then I tried to put the model into the database by making a model and using .put() to add. I'm not sure if the syntax is right for setting the attribute. Here's what I have in my handler class in the post(self) method.
greeting = Greeting(parent=guestbook_key(guestbook_name)) greeting.content = self.request.get('content') avatar = images.resize(self.request.get('img'), 32, 32) greeting.avatar = ndb.BlobProperty(avatar) greeting.put()
Sorry, here's the stack trace