Hi, How do I store a file in LocalFS? Of about 8 emails I've posted for various questions in the last 4 months, 1 was answered. The rest ignored. Seemingly you get a response if you pretend to be stupid and ask for the whole answer without denoting that you actually have done some research or supply contraindications to your problem.... Cheers and excuse today's hangover moodiness, Paz
How do I store a file in LocalFS?
Don't. LocalFS is a VIEW of your file system. Simply move your file in the directory managed by LocalFS and you are done.
Cheers and excuse today's hangover moodiness,
You're not alone, don't give up :-) Cyril
This is incorrect. LocalFS also allows you to write files to the directory that you are "viewing" through the LocalFS object, provided the user your zope process runs under has the privilege to write into that directory. i know this won't help non-technical people, but i have found the code for LocalFS to be very clean, well-written and self-explanatory and have done a few python utilities based on it without ever needing more documentation than the code itself. jonothan has put up a page with an overview over LocalFS capabilities right here: http://www.zope.org/Members/jfarr/Products/LocalFS/LocalFS-0.10.1.tgz/info hope that helps jens on 2/23/01 6:22, Cyril Elkaim at cyril.elkaim@free.fr wrote:
How do I store a file in LocalFS?
Don't. LocalFS is a VIEW of your file system. Simply move your file in the directory managed by LocalFS and you are done.
Cheers and excuse today's hangover moodiness,
You're not alone, don't give up :-)
Cyril
Ah, good. Thank you. You at least confirm my suspicions. But being 'non-(so)-technical' or at a much more basic level than those that can take stable syntax knowledge for granted, can someone offer me how to write into my LocalFS mount called AdminImgMnt. I can easily write a proper image in Zope, but directing through the mount evades me completely. I would not know where to begin on how to tell manage_addImage to go through LocalFS..... The following working line of code drops my image, but now i want it to be directed to AdminImgMnt which is the LFS mount.... User rights should be okay. I think Im only missing the syntaxing. <dtml-call expr="manage_addImage(_.str(pid) + '.jpg', REQUEST.form['imgfile'], '')"> My first assumptions were to be <dtml-call expr="AdminImgMnt.manage_addImage(_.str(pid) + '.jpg', REQUEST.form['imgfile'], '')"> or <dtml-with AdminImgMnt> <dtml-call expr="manage_addImage(_.str(pid) + '.jpg', REQUEST.form['imgfile'], '')"> </dtml-with> But both just deposit the file locall (in Zope) next to the LocalFS mount. Now Im just getting confused beyond rationale..... Thanks as always, Paz Jens Vagelpohl wrote:
This is incorrect. LocalFS also allows you to write files to the directory that you are "viewing" through the LocalFS object, provided the user your zope process runs under has the privilege to write into that directory.
i know this won't help non-technical people, but i have found the code for LocalFS to be very clean, well-written and self-explanatory and have done a few python utilities based on it without ever needing more documentation than the code itself.
jonothan has put up a page with an overview over LocalFS capabilities right here:
http://www.zope.org/Members/jfarr/Products/LocalFS/LocalFS-0.10.1.tgz/info
hope that helps
jens
on 2/23/01 6:22, Cyril Elkaim at cyril.elkaim@free.fr wrote:
How do I store a file in LocalFS?
Don't. LocalFS is a VIEW of your file system. Simply move your file in the directory managed by LocalFS and you are done.
Cheers and excuse today's hangover moodiness,
You're not alone, don't give up :-)
Cyril
Paul, If you're specifically wanting to create Zope objects that provide a view to individual uploaded files stored outside of the ZODB, you might want to consider the ExtFile product. Its function lies somewhere between Image and LocalFS. As I understand it, LocalFS works on a directory basis, and uses certain heuristics on file extensions to map files to Zope class instances. With ExtFile/ExtImage you have more explicit control over individual files. In this case, you'd use manage_addExtImage() to create the ExtImage object. On Fri, Feb 23, 2001 at 02:25:55PM +0100, Paul Zwarts wrote:
I can easily write a proper image in Zope, but directing through the mount evades me completely. I would not know where to begin on how to tell manage_addImage to go through LocalFS.....
-- Fred Yankowski fred@OntoSys.com tel: +1.630.879.1312 Principal Consultant www.OntoSys.com fax: +1.630.879.1370 OntoSys, Inc 38W242 Deerpath Rd, Batavia, IL 60510, USA
Thanks Fred, I have indeed installed the ExtFile product but have avoided it to get LocalFS going.... I admit I was a bit thrown by ExtFile's description about external repository. I have large directory structures that are accessed by different systems that will not like to interface with Zope... Thus I want to maintain a highly external structure. But on your advice I think its time to get 'distracted' by ExtFS. Based on what i explain above, do you still recommend this product? Thanks, Paz Fred Yankowski wrote:
Paul,
If you're specifically wanting to create Zope objects that provide a view to individual uploaded files stored outside of the ZODB, you might want to consider the ExtFile product. Its function lies somewhere between Image and LocalFS. As I understand it, LocalFS works on a directory basis, and uses certain heuristics on file extensions to map files to Zope class instances. With ExtFile/ExtImage you have more explicit control over individual files.
In this case, you'd use manage_addExtImage() to create the ExtImage object.
On Fri, Feb 23, 2001 at 02:25:55PM +0100, Paul Zwarts wrote:
I can easily write a proper image in Zope, but directing through the mount evades me completely. I would not know where to begin on how to tell manage_addImage to go through LocalFS.....
-- Fred Yankowski fred@OntoSys.com tel: +1.630.879.1312 Principal Consultant www.OntoSys.com fax: +1.630.879.1370 OntoSys, Inc 38W242 Deerpath Rd, Batavia, IL 60510, USA
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
ExtFile/ExtImage indeed maintains its own repository of files. It's geared toward managing files completely within its system, keeping track of the file and related object wrapper from the time of file-upload through eventual deletion of the object. So it might _not_ suit your case if you're not eager to have ExtFile create its own copy of each of your files. Perhaps we could lobby the owner of ExtFile to add a mode of operation that would allow ExtImage (or some variant) to be used more directly as a view over a file managed outside of the ExtFile machinery. But it may be that this is too far removed from the intent and architecture of ExtFile. On Fri, Feb 23, 2001 at 03:32:26PM +0100, Paul Zwarts wrote:
I have indeed installed the ExtFile product but have avoided it to get LocalFS going.... I admit I was a bit thrown by ExtFile's description about external repository. I have large directory structures that are accessed by different systems that will not like to interface with Zope... Thus I want to maintain a highly external structure.
But on your advice I think its time to get 'distracted' by ExtFS. Based on what i explain above, do you still recommend this product?
-- Fred Yankowski fred@OntoSys.com tel: +1.630.879.1312 Principal Consultant www.OntoSys.com fax: +1.630.879.1370 OntoSys, Inc 38W242 Deerpath Rd, Batavia, IL 60510, USA
Jens,
This is incorrect. LocalFS also allows you to write files to the directory that you are "viewing" through the LocalFS object, provided the user your zope process runs under has the privilege to write into that directory.
Thanks for the info. I hope to dig for good in the source once I've finished my current job. Cyril
Hi all, I'd like to thank everyone with their help. I finally got it going with the following code: <dtml-call expr="AdminImgMnt.manage_upload(id=_.str(pid) + '.jpg', file=REQUEST['imgfile'])"> There is some magic at work here i dont quite understand yet, but it seems to work so, leave it at that for now.... I think the difference was two things: a) i had never used id= and file= because it always gave me TypeErrors. b) i used manage_addImage and not manage_upload.... is there really a big difference in context to LocalFS? But again, it it works, fry some bigger fish.... Paz Jens Vagelpohl wrote:
This is incorrect. LocalFS also allows you to write files to the directory that you are "viewing" through the LocalFS object, provided the user your zope process runs under has the privilege to write into that directory.
i know this won't help non-technical people, but i have found the code for LocalFS to be very clean, well-written and self-explanatory and have done a few python utilities based on it without ever needing more documentation than the code itself.
jonothan has put up a page with an overview over LocalFS capabilities right here:
http://www.zope.org/Members/jfarr/Products/LocalFS/LocalFS-0.10.1.tgz/info
hope that helps
jens
on 2/23/01 6:22, Cyril Elkaim at cyril.elkaim@free.fr wrote:
How do I store a file in LocalFS?
Don't. LocalFS is a VIEW of your file system. Simply move your file in the directory managed by LocalFS and you are done.
Cheers and excuse today's hangover moodiness,
You're not alone, don't give up :-)
Cyril
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
b) i used manage_addImage and not manage_upload.... is there really a big difference in context to LocalFS?
manage_addImage and friends should work with LocalFS (in an ideal world), but unfortunately that feature is broken, or I should say, has never worked. I've spent countless hours trying to figure out how to fix it, but to no avail. Perhaps one day I'll be motivated to give it another try. ;) --jfarr
When /foo/bar is a Local File System object, you may find nice help on it at /foo/bar/manage_help Perhaps this should be made more obvious (or this help info become accessible in the current "standard" way). I got there through the links in property names under the "Edit" tab. -- jmce: +351 919838775 ~ http://artenumerica.com/ ~ http://artenumerica.org/
On Sat, Feb 24, 2001 at 02:57:43PM +0000, J M Cerqueira Esteves wrote:
When /foo/bar is a Local File System object, you may find nice help on it at
/foo/bar/manage_help
... however, it still states that in manage_upload(file) the `file' parameter can be a string. It can't be a string, only a FileUpload instance (see HTTPRequest.py), but it would be nice if it could be. I'm having to deal with it right now, handling in a python method a form which can be presented in two alternative modes: - with a 'type="file"' input field for upload; - with '<textarea >' input field for editing on the browser. Perhaps I'll just create a small "pseudo-FileUpload" class with just the methods used by manage_upload, for wrapping a string with the desired file contents... -- jmce: +351 919838775 ~ http://artenumerica.com/ ~ http://artenumerica.org/
On Sat, Feb 24, 2001 at 03:55:17PM +0000, J M Cerqueira Esteves wrote:
... however, it still states that in manage_upload(file) the `file' parameter can be a string. It can't be a string, only a FileUpload instance (see HTTPRequest.py), but it would be nice if it could be.
I ended up using the same method as for regular folders (with "foo.bar" a LocalFS): foo.bar.manage_addProduct['OFSP'].manage_addFile (file_name, file = content) where `content' is a string with the intended file content. -- jmce: +351 919838775 ~ http://artenumerica.com/ ~ http://artenumerica.org/
participants (6)
-
Cyril Elkaim -
Fred Yankowski -
J M Cerqueira Esteves -
Jens Vagelpohl -
Jonothan Farr -
Paul Zwarts