Richmond Wang Richmond Wang - 2 months ago 6
Python Question

What/Where can I find GAE (python) Reserved Keys (key path element)

I am creating an app that will involve a lot of users which they can Assign any username they want to, which will be used as the entity ID/Name.

But when I tried the username '__something__' , GAE gave me an error:

raised BadRequestError(The key path element name "__something__" is reserved.)


I dont have problem with that, because I can just catch it.
But what I want is to blacklist all the reserved keys before they are even submitted by the user.

I tried searching through the web but haven't found anything.
Is there a list of this that we can get?

Answer

The problem with that specific key are the two '_' (underscore) at the beginning and ending of the username:

  • __jroyal__ is reserved.
  • jroyal is not.
  • __anything__ is reserved.

So you don't list to blacklist a list of terms. You just need to validate that your user doesn't use __ at the beginning and end of the username.