user1612947
user1612947

Reputation: 193

Special characters and key names

I have the following model class:

class Test(db.Model):
   name = db.StringProperty()

I am supposed to use unique key names for each entity, so I can retrieve entities this way:

<input type="text" name="name" />

def post(self):
    key_name = self.request.get('name')
    entity = db.get_or_insert(key_name, name=key_name)
      # first key_name needs encoding?

How should I encode the key_name in order to allow for characters such as æ, ø, å and others in the html form?

Upvotes: 0

Views: 348

Answers (1)

thikonom
thikonom

Reputation: 4267

You do not really need to do anything special. These characters are handled normally.

In case you wanted support for HTML special characters you would have to change it to:

cgi.escape(self.request.get('name'))

Upvotes: 1

Related Questions