No, I mean the content of a file so if it's a text file then it'll
contain text.

I found this to add to the File class:
contents = db.BlobProperty()

and this when I set it:
file.contents = db.Blob(content)

but when I retrive it from the data store I can't find a way to get
the value.

And for the os like folder and file structure, wouldn't it be better
to store the path of the folder to the data store instead of saving
only the parents key?

because if I would want to get a file with this path:
Folder/Folder 2/File.txt

then I would just search for a file named File.txt with a path "Folder/
Folder 2",
instead of searching for a folder called "Folder" and the searching in
it for a folder named "Folder 2" and then searching in it a file named
"File.txt".

just want your opinion because you all clearly have much more
experience than me with database structure etc.

On 7 מאי, 16:26, slink3r <slin...@gmail.com> wrote:
> A blob with a key pointing back to the folder
>
> -Brian
>
> On May 6, 8:00 am, Shedokan <shedok...@gmail.com> wrote:
>
> > Tim:
> > I don't quite understand most of what you said because I kinda really
> > new to python programming I know only php and python, but what I do
> > understand I will try to do.
>
> > What type do you people suggest I'll use for the file content?
>
> > On 6 מאי, 06:16, Pranav Prakash <pra...@gmail.com> wrote:
>
> > > class Folder(db.Model):
> > >   name = db.StringProperty()
> > >   subfolders = db.ListProperty(File)
> > >   parent = db.SelfReferenceProperty()
>
> > > This is how folder can be implemented. A folder must know what all
> > > files are child. Also a folder must know the parent folder (folders in
> > > case of cyclic dir structure).
>
> > > Apart from this, you might also implement Linux inode system in a
> > > model, for book keeping.
>
> > > On May 6, 5:41 am, Tim Hoffman <zutes...@gmail.com> wrote:
>
> > > > You will need to create a Folder entity
> > > > It will need to know it's children, and you will need to support
> > > > some form of url traversability to walk the folder heirarchy.
>
> > > > I am doing that with zope3 components on gae
>
> > > > Django doesn't normally do url traversing, but has a regex match to
> > > > method
>
> > > > Do you really need a folder heirarchy, have you gone down  that path
> > > > because you are just trying to
> > > > replicate a filesystem, with out really needing those semantics ?
>
> > > > If you really want this sort of functionality you might want to look
> > > > at repoze.bfg it is just been
> > > > made useable under gae (and is zope 3 based though much simpler) and
> > > > does support inherintly
> > > > the notion of url traversal over an object model/graph
>
> > > > Rgds
>
> > > > T
>
> > > > On May 6, 6:34 am, Shedokan <shedok...@gmail.com> wrote:
>
> > > > > I am porting my WebOS(Shedokan OS) to python from php so I can use it
> > > > > og GAE and I came to the stage where I need to read and write files.
>
> > > > > And after a lot of searching I found out that I cannot create files or
> > > > > write to files.
> > > > > here is my code:
>
> > > > > from google.appengine.ext import db
>
> > > > > class File(db.Model):
> > > > >         filename = db.StringProperty(multiline=False)
> > > > >         filedata = db.BlobProperty
> > > > >         date = db.DateTimeProperty(auto_now_add=True)
>
> > > > > def createFile(fileName, content):
> > > > >         if fileName=='' or content=='':
> > > > >                 return
> > > > >         file = File()
> > > > >         file.filedata = content
> > > > >         file.filename = fileName
> > > > >         file.put()
>
> > > > > def getFile(fileName):
>
> > > > >         if fileName=='':
> > > > >                 return
> > > > >         return db.GqlQuery('SELECT * FROM File WHERE filename= 
> > > > > :1',fileName)
>
> > > > > any way to make this work with a folder structure?
>
> > > > > also I want to note that I started learning python just about 3 days
> > > > > ago, so I think I'm a begginer.
>
> > > > > thanks.
--~--~---------~--~----~------------~-------~--~----~
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