From hannes.flocke at gmx.li Wed Feb 17 19:04:43 2010 From: hannes.flocke at gmx.li (Hannes) Date: Wed, 17 Feb 2010 19:04:43 +0100 Subject: [Tramline-dev] How to get file_id from Tramline request? Message-ID: <4B7C2FBB.3000102@gmx.li> Hi Tramliners, I was looking hard and spend a lot of time with getting Tramline up and running. Now that I'm almost done, I'd like to know, how I get the file_id (file name) from the file that was uploaded? I'm using Tramline 0.5.1 and updated core.py manually to revision 14. I'm using Apache 2.2 on Linux together with latest stable Grok (Zope). thanks. Hannes From georges at racinet.fr Wed Feb 17 19:13:22 2010 From: georges at racinet.fr (Georges Racinet) Date: Wed, 17 Feb 2010 19:13:22 +0100 Subject: [Tramline-dev] How to get file_id from Tramline request? In-Reply-To: <4B7C2FBB.3000102@gmx.li> References: <4B7C2FBB.3000102@gmx.li> Message-ID: <4B7C31C2.5090507@racinet.fr> Hannes wrote: > Hi Tramliners, Hi ! > I was looking hard and spend a lot of time with getting Tramline up and > running. Now that I'm almost done, I'd like to know, how I get the > file_id (file name) from the file that was uploaded? Do you mean from tramline code or from the application that's being proxified ? In that latter case, the tramline id should have replaced the file content, but I suppose you already know that. > I'm using Tramline 0.5.1 and updated core.py manually to revision 14. > I'm using Apache 2.2 on Linux together with latest stable Grok (Zope). Cheers, -- Georges Racinet, http://www.racinet.fr Zope/CPS/Plone expertise, assistance & development GPG: 0x4862FFF7 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 553 bytes Desc: OpenPGP digital signature Url : http://codespeak.net/pipermail/tramline-dev/attachments/20100217/38904923/attachment.pgp From hannes.flocke at gmx.li Wed Feb 17 21:27:03 2010 From: hannes.flocke at gmx.li (Hannes) Date: Wed, 17 Feb 2010 21:27:03 +0100 Subject: [Tramline-dev] How to get file_id from Tramline request? In-Reply-To: <4B7C31C2.5090507@racinet.fr> References: <4B7C2FBB.3000102@gmx.li> <4B7C31C2.5090507@racinet.fr> Message-ID: <4B7C5117.30401@gmx.li> Hi Georges, I need to know, how I can access the file_id from the application. What exactly do you mean with file content? I read something like that before...when I access the upload field from the HTML form I get back a FileUpload object that looks like it belongs to ZOPE.... thanks. > Hannes wrote: > >> Hi Tramliners, >> > > Hi ! > > >> I was looking hard and spend a lot of time with getting Tramline up and >> running. Now that I'm almost done, I'd like to know, how I get the >> file_id (file name) from the file that was uploaded? >> > > Do you mean from tramline code or from the application that's being > proxified ? > In that latter case, the tramline id should have replaced the file > content, but I suppose you already know that. > > >> I'm using Tramline 0.5.1 and updated core.py manually to revision 14. >> I'm using Apache 2.2 on Linux together with latest stable Grok (Zope). >> > > Cheers, > > ------------------------------------------------------------------------ > > _______________________________________________ > Tramline-dev mailing list > Tramline-dev at codespeak.net > http://codespeak.net/mailman/listinfo/tramline-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/tramline-dev/attachments/20100217/93a3404e/attachment.htm From georges at racinet.fr Thu Feb 18 01:13:10 2010 From: georges at racinet.fr (Georges Racinet) Date: Thu, 18 Feb 2010 01:13:10 +0100 Subject: [Tramline-dev] How to get file_id from Tramline request? In-Reply-To: <4B7C5117.30401@gmx.li> References: <4B7C2FBB.3000102@gmx.li> <4B7C31C2.5090507@racinet.fr> <4B7C5117.30401@gmx.li> Message-ID: <4B7C8616.4070109@racinet.fr> Hannes wrote: > Hi Georges, > > I need to know, how I can access the file_id from the application. What > exactly do you mean with file content? I read something like that > before...when I access the upload field from the HTML form I get back a > FileUpload object that looks like it belongs to ZOPE.... Yes, that's the whole point of tramline. Suppose your application is meant to store file objects, and there is no tramline in front of it. Then what you get upon form submission is precisely a FileUpload object. Now if tramline is in front of it, it intercepts the file submission, and replace the file contents with the tramline id, at the level of the HTTP request. The goal is that your application (Zope or whatever, python based or not) will store it as a file, and treat it accordingly but it'll be much lighter in the DB (a few bytes). In the case of Zope, you'll get the tramline id from the FileUpload by reading it. For the record, in Zope 2, that would be fileupload.seek(0L) # in case that's not the first operation on it tramid = fileupload.read() # here you go but most of the times you don't need the tramline id at all. Serving the file with an additional header is all that's needed for tramline to intercept it and replace it with the true content. All of this is explained in much more detail on tramline's web page (don't know it by heart). The idea is that tramline will enhance almost transparently any application that's meant to handle files. I like to think of it as a proto-wsgi idea. Note also that there are similar interceptors in the wsgi world, notably Gawel's gp.fileupload Cheers > > thanks. >> Hannes wrote: >> >>> Hi Tramliners, >>> >> >> Hi ! >> >> >>> I was looking hard and spend a lot of time with getting Tramline up and >>> running. Now that I'm almost done, I'd like to know, how I get the >>> file_id (file name) from the file that was uploaded? >>> >> >> Do you mean from tramline code or from the application that's being >> proxified ? >> In that latter case, the tramline id should have replaced the file >> content, but I suppose you already know that. >> >> >>> I'm using Tramline 0.5.1 and updated core.py manually to revision 14. >>> I'm using Apache 2.2 on Linux together with latest stable Grok (Zope). >>> >> >> Cheers, >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Tramline-dev mailing list >> Tramline-dev at codespeak.net >> http://codespeak.net/mailman/listinfo/tramline-dev >> > -- Georges Racinet, http://www.racinet.fr Zope/CPS/Plone expertise, assistance & development GPG: 0x4862FFF7 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 553 bytes Desc: OpenPGP digital signature Url : http://codespeak.net/pipermail/tramline-dev/attachments/20100218/94023e5c/attachment.pgp