hi ravi,

i was not thinking to make the folder know about its children. files and 
folders have a StringListProperty where i store all keys of the folders it 
belongs to.

your approach is exactly what i wanted to avoid. i think its not the right way 
to do this because the longer the path the longer the query and lets say im at 
level 10, ill need to do 10 get() operations.


On Jul 2, 2011, at 2:55 PM, Ravi Sharma wrote:

> One Suggestion
> Instead of making a folder know his all child folder and files..may be try 
> other way round by letting every folder/file know its parent...  also save 
> depth of folder and files......
> e.g.
> Class File{
> Key id,
> String anme;
> Key parentId,
> int depth;
> String type;//folder or file
> }
> 
> and for path point of view i think you will show your folders like   
> yoursite.com/root/parent1/parent2 
> then on server for this request
> 
> first search a folder entry where name=root and depth =1
> you will get only one record at this level you can not have more then one 
> root folder
> 
> then search for folder entry where name=parent1 and depth =2 and parent 
> id=<id of entity found above>
> you will find only one entry at this depth with this parent....
> 
> and same search for parent2
> 
> 
> this way whenever you will have long path you will do few more queries... but 
> renaming wont be a problem...... and copying content from one folder to 
> another will be lot easier....
> 
> 
> 
> 
> 
> 
> 
> On Sat, Jul 2, 2011 at 11:25 AM, andreas schmid <[email protected]> wrote:
> hi,
> 
> I'm trying to build a filesystem like folder tree on appengine python but I'm 
> not sure about the architecture of the app.
> 
> lets say i have folders and images. folders can contain other folders and 
> images. building the relationship is not the problem
> because every entity will have a StringListProperty with all the keys to the 
> folders it belongs.
> 
> the folders will have a path which lets me know which folder contents to show 
> on the site. like in a filesystem i would like to be
> able to rename a folder. if i rename a folder all child folders of that 
> folder will have to change path too.
> 
> is it possible to know a folders path based on its ancestors without writing 
> the path into the folder entity and of course without fetching all folders in 
> the path?
> 
> i would like to avoid this because if i change a folders name on the root 
> level i will need to do an update operation on all subfolders to change
> this path and if there will be for example 500+ subfolders in the tree it 
> wont be an easy and quick operation.
> 
> would love to hear your suggestions.
> 
> thank you
> 
> --
> 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.
> 
> 
> 
> -- 
> 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.

-- 
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