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