Anyone knows how to define unique constraint in datastore?

See I have a Blog model, and it has these properties:
name, content, title, keywords, description and so on.

I need provide a URL to get this blog like this:
http://<domain>/blog/<name>.html

So user cannot have two blogs that share the same name, otherwise one
of them cannot be gotten via URL.

I also need provide a way to change blogs' names.


It seems I need to define a BlogName model to store Blog's name as
keyname, and start a transaction to store the 2 entities:

Creating:
1. Get BlogName entity by keyname, if not exsit, create one, else exit
as failed.
2. Create a Blog entity which parent and name is this BlogName entity.

Editing:
1. Get BlogName entity by keyname, if not exsit, create one, else exit
as failed.
2. Get the old Blog entity and old BlogName entity by keyname.
3. Create a Blog entity which parent and name is this BlogName entity,
and rest the same to the old one.
4. Delete the old 2 ones.

Well, it seems can work, but how terrible it is!


And if I want a blog can have multiple names, so the two URLs can get
the same blog:
http://<domain>/blog/hello.html
http://<domain>/blog/你好.html

I don't think I can get them by keyname since they are in a list
property now, so it can't be done in a transaction.
And if I keep them in two Blog entities, I need change both of them
when I edit one of its properties.
So it seems I need define BlogContent model, BlogTitle model,
BlogKeywords model, BlogDescription model for referece from Blog
model.

Any better idea for me?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to