Sharing images between different sites
Is there any way to set up an images folder which can be shared between several sites under one zope instance? If so how would I reference them if they were all in the /images folder? -- John
John Poltorak wrote:
Is there any way to set up an images folder which can be shared between several sites under one zope instance?
If so how would I reference them if they were all in the /images folder?
Very basic acquisition design. Put the 'images' folder in the site root. It will be available everywhere by acquisition. Refer to it as relative to wherever you are. --jcc
On Wed, Nov 17, 2004 at 03:04:25PM -0600, J Cameron Cooper wrote:
John Poltorak wrote:
Is there any way to set up an images folder which can be shared between several sites under one zope instance?
If so how would I reference them if they were all in the /images folder?
Very basic acquisition design. Put the 'images' folder in the site root. It will be available everywhere by acquisition. Refer to it as relative to wherever you are.
Does it also work in Plone sites? I tried to include an image from '/images' in the 'left_slot'. Ended up with this:- * Module Products.PageTemplates.ZRPythonExpr, line 47, in __call__ __traceback_info__: path(pathexpr) * Module Python expression "path(pathexpr)", line 1, in <expression> * Module Products.PageTemplates.PythonExpr, line 81, in __call__ * Module Products.PageTemplates.Expressions, line 201, in __call__ * Module Products.PageTemplates.Expressions, line 189, in _eval * Module Products.PageTemplates.Expressions, line 145, in _eval __traceback_info__: * Module Products.PageTemplates.Expressions, line 347, in restrictedTraverse __traceback_info__: {'path': ['images', 'logo'], 'TraversalRequestNameStack': ['logo']} KeyError: 'images' (Also, an error occurred while attempting to render the standard error message.) In my left_slots definition I have:- /images/logo What am I doing wrong?
--jcc
-- John
Your page template should have a plain text img tag: <img src="/images/logo" width=xxx height=yyy alt="caption"> The page itself should render even if /images/logo does not exist, and there would be no traceback. Cliff John Poltorak wrote:
On Wed, Nov 17, 2004 at 03:04:25PM -0600, J Cameron Cooper wrote:
John Poltorak wrote:
Is there any way to set up an images folder which can be shared between several sites under one zope instance?
If so how would I reference them if they were all in the /images folder?
Very basic acquisition design. Put the 'images' folder in the site root. It will be available everywhere by acquisition. Refer to it as relative to wherever you are.
Does it also work in Plone sites?
I tried to include an image from '/images' in the 'left_slot'. Ended up with this:-
* Module Products.PageTemplates.ZRPythonExpr, line 47, in __call__ __traceback_info__: path(pathexpr) * Module Python expression "path(pathexpr)", line 1, in <expression> * Module Products.PageTemplates.PythonExpr, line 81, in __call__ * Module Products.PageTemplates.Expressions, line 201, in __call__ * Module Products.PageTemplates.Expressions, line 189, in _eval * Module Products.PageTemplates.Expressions, line 145, in _eval __traceback_info__: * Module Products.PageTemplates.Expressions, line 347, in restrictedTraverse __traceback_info__: {'path': ['images', 'logo'], 'TraversalRequestNameStack': ['logo']}
KeyError: 'images' (Also, an error occurred while attempting to render the standard error message.)
In my left_slots definition I have:-
/images/logo
What am I doing wrong?
--jcc
In addition to previous comments: In dtml you could do it like this: <dtml-var expr="restrictedTraverse('/images/logo').tag()"> In a page template this works: <div tal:content="structure container/images/logo" tal:omit-tag=""></div> Cliff Cliff Ford wrote:
Your page template should have a plain text img tag:
<img src="/images/logo" width=xxx height=yyy alt="caption">
The page itself should render even if /images/logo does not exist, and there would be no traceback.
Cliff
John Poltorak wrote:
On Wed, Nov 17, 2004 at 03:04:25PM -0600, J Cameron Cooper wrote:
John Poltorak wrote:
Is there any way to set up an images folder which can be shared between several sites under one zope instance?
If so how would I reference them if they were all in the /images folder?
Very basic acquisition design. Put the 'images' folder in the site root. It will be available everywhere by acquisition. Refer to it as relative to wherever you are.
Does it also work in Plone sites?
I tried to include an image from '/images' in the 'left_slot'. Ended up with this:-
* Module Products.PageTemplates.ZRPythonExpr, line 47, in __call__ __traceback_info__: path(pathexpr) * Module Python expression "path(pathexpr)", line 1, in <expression> * Module Products.PageTemplates.PythonExpr, line 81, in __call__ * Module Products.PageTemplates.Expressions, line 201, in __call__ * Module Products.PageTemplates.Expressions, line 189, in _eval * Module Products.PageTemplates.Expressions, line 145, in _eval __traceback_info__: * Module Products.PageTemplates.Expressions, line 347, in restrictedTraverse __traceback_info__: {'path': ['images', 'logo'], 'TraversalRequestNameStack': ['logo']}
KeyError: 'images' (Also, an error occurred while attempting to render the standard error message.)
In my left_slots definition I have:-
/images/logo
What am I doing wrong?
--jcc
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
On Thu, Nov 18, 2004 at 03:19:32AM +0000, Cliff Ford wrote:
Your page template should have a plain text img tag:
<img src="/images/logo" width=xxx height=yyy alt="caption">
This doesn't work either. I get:- * Module Products.PageTemplates.ZRPythonExpr, line 47, in __call__ __traceback_info__: path(pathexpr) * Module Python expression "path(pathexpr)", line 1, in <expression> * Module Products.PageTemplates.PythonExpr, line 81, in __call__ * Module Products.PageTemplates.Expressions, line 164, in __init__ * Module Products.PageTemplates.Expressions, line 114, in __init__ CompilerError: Invalid variable name "<img src="" (Also, an error occurred while attempting to render the standard error message.) This is probably Plone related so I'll as on the Plone list.
Cliff
John Poltorak wrote:
On Wed, Nov 17, 2004 at 03:04:25PM -0600, J Cameron Cooper wrote:
John Poltorak wrote:
Is there any way to set up an images folder which can be shared between several sites under one zope instance?
If so how would I reference them if they were all in the /images folder?
Very basic acquisition design. Put the 'images' folder in the site root. It will be available everywhere by acquisition. Refer to it as relative to wherever you are.
Does it also work in Plone sites?
I tried to include an image from '/images' in the 'left_slot'. Ended up with this:-
* Module Products.PageTemplates.ZRPythonExpr, line 47, in __call__ __traceback_info__: path(pathexpr) * Module Python expression "path(pathexpr)", line 1, in <expression> * Module Products.PageTemplates.PythonExpr, line 81, in __call__ * Module Products.PageTemplates.Expressions, line 201, in __call__ * Module Products.PageTemplates.Expressions, line 189, in _eval * Module Products.PageTemplates.Expressions, line 145, in _eval __traceback_info__: * Module Products.PageTemplates.Expressions, line 347, in restrictedTraverse __traceback_info__: {'path': ['images', 'logo'], 'TraversalRequestNameStack': ['logo']}
KeyError: 'images' (Also, an error occurred while attempting to render the standard error message.)
In my left_slots definition I have:-
/images/logo
What am I doing wrong?
--jcc
-- John
I want users be able to WebDAV or FTP images into a Zope/Plone site. Once each image reaches the site, I want it to be automatically migrated to the filesystem with the same file name (worse case, cronning the migration). I don't want the image referenced or stored anywhere in the zodb following the migration - just moved from the zodb to the filesystem. I only the client to use only their zope/plone login password. I don't want to provide direct FTP or HTTP access to the filesystem or dish out server accounts for scp. Can anyone advise a possible solution to this. Regards, David
Hi David, You might be interested in this: http://www.plope.com/software/FilesystemMigration The default setup does not name the file after its ZMI name, but this can be accomplished (if necessary, it doesn't sound like it is necessary, because you don't want to provide HTTP access to the disk-files except via Zope). On Sun, 2004-11-28 at 13:21, David Pratt wrote:
I want users be able to WebDAV or FTP images into a Zope/Plone site. Once each image reaches the site, I want it to be automatically migrated to the filesystem with the same file name (worse case, cronning the migration). I don't want the image referenced or stored anywhere in the zodb following the migration - just moved from the zodb to the filesystem. I only the client to use only their zope/plone login password. I don't want to provide direct FTP or HTTP access to the filesystem or dish out server accounts for scp. Can anyone advise a possible solution to this.
Regards, David
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Hi Chris. This sound like the product I am seeking. The names being the same would be benefit since I am also hoping to make reference to the images in the filesystem from non-zope content. Will having same names be a setting in the product? I take it part of the file must still live in the zodb after the file has migrated - is this correct? Can the image or file still be used with static content in the typical way without any interaction with zope? Regards, Dave On Sunday, November 28, 2004, at 03:42 PM, Chris McDonough wrote:
Hi David,
You might be interested in this:
http://www.plope.com/software/FilesystemMigration
The default setup does not name the file after its ZMI name, but this can be accomplished (if necessary, it doesn't sound like it is necessary, because you don't want to provide HTTP access to the disk-files except via Zope).
On Sun, 2004-11-28 at 13:21, David Pratt wrote:
I want users be able to WebDAV or FTP images into a Zope/Plone site. Once each image reaches the site, I want it to be automatically migrated to the filesystem with the same file name (worse case, cronning the migration). I don't want the image referenced or stored anywhere in the zodb following the migration - just moved from the zodb to the filesystem. I only the client to use only their zope/plone login password. I don't want to provide direct FTP or HTTP access to the filesystem or dish out server accounts for scp. Can anyone advise a possible solution to this.
Regards, David
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
On Sun, 2004-11-28 at 16:02, David Pratt wrote:
Hi Chris. This sound like the product I am seeking. The names being the same would be benefit since I am also hoping to make reference to the images in the filesystem from non-zope content.
That's fine.
Will having same names be a setting in the product?
It is, via the "naming expression" exposed by the product (a TALES expression), although it's much simpler to give it an "opaque" name rather than naming it after the Zope path of the object because then the product doesn't need to do anything when a file object moves or is renamed within the ZODB. If you name the file after the Zope path of the object, and the object moves or gets renamed, you need to go move the respective disk file. The product does not do this. You can override this via the naming expression, and cause the file to be created in a path that makes more sense to a human, but the naming expression needs to always generate the same path for the lifetime of the object (e.g. if you base the naming expression on the id of the object, but you later change the id of the object, it will fail to find the file). IOW, the naming expression needs to be "idempotent": for the lifetime of the object, it needs to generate the same path no matter what else might happen to that object. You can work around this as necessary by modifying MigratableFile/FilesystemTool but it's not supported out of the box. Out of the box, the product attaches a "filesystem id" to an object when it is added (a 32-digit hexadecimal number). A disk path is created from this filesystem id and the file lives on disk in the file named by this path for the lifetime of the object. Of course, the path is "gibberish", but that's by design; no one is tempted to change it once its been set. You can change the path, the id, the title, and so forth, and the filesystem id isn't effected. FWIW, if it's important for the files to created in a structure on disk that matches the Zope hierarchy and you aren't willing to write product code to help MigratableFile with this, you might look elsewhere (LocalFS?). From your original description, this didn't seem like a requirement.
I take it part of the file must still live in the zodb after the file has migrated - is this correct?
Yes. It's usually around 2 or 3k of data for a normal Zope file object.
Can the image or file still be used with static content in the typical way without any interaction with zope?
It's a file on disk, so to the extent that you can use a file on disk, yes. - C
David Pratt wrote at 2004-11-28 14:21 -0400:
I want users be able to WebDAV or FTP images into a Zope/Plone site. Once each image reaches the site, I want it to be automatically migrated to the filesystem with the same file name (worse case, cronning the migration). I don't want the image referenced or stored anywhere in the zodb following the migration - just moved from the zodb to the filesystem. I only the client to use only their zope/plone login password. I don't want to provide direct FTP or HTTP access to the filesystem or dish out server accounts for scp. Can anyone advise a possible solution to this.
Apparently, all you use from Zope is its authentication. You might use Apache instead for the WebDAV access and use its external authentication to just delegate authentication to Zope. -- Dieter
On Mon, Nov 29, 2004 at 09:51:14PM +0100, Dieter Maurer wrote:
Apparently, all you use from Zope is its authentication.
You might use Apache instead for the WebDAV access and use its external authentication to just delegate authentication to Zope.
I've briefly considered this before, but AFAICT all it does is handle authentication, not authorization. In other words, apache will authenticate against zope, but you still need to use .htaccess files to tell apache which users can access which data. Am I wrong? I'd love to be wrong :-) -- Paul Winkler http://www.slinkp.com
Paul Winkler wrote at 2004-11-29 16:26 -0500:
On Mon, Nov 29, 2004 at 09:51:14PM +0100, Dieter Maurer wrote:
You might use Apache instead for the WebDAV access and use its external authentication to just delegate authentication to Zope.
I've briefly considered this before, but AFAICT all it does is handle authentication, not authorization. In other words, apache will authenticate against zope, but you still need to use .htaccess files to tell apache which users can access which data. Am I wrong?
I do not know. I know only from reading the mailing lists that Apache can delegate authentication to Zope. Maybe, the authentication modul could be extended to return group/role information. Then, an ".htaccess" based on such groups/roles could become feasible. -- Dieter
Hi, Am Mittwoch, den 17.11.2004, 20:52 +0000 schrieb John Poltorak:
Is there any way to set up an images folder which can be shared between several sites under one zope instance?
If so how would I reference them if they were all in the /images folder?
Of course. And you reference them by context.images.whateverimage or in HTML: <img src="/images/whateverimage"> You should always specify a path starting with / in Zope links. it does not matter if the site is somewhere down the path, aquision solves it (as long as there is no other images object in the path to root) You can share such a folder between many zope instances if you use ZEO and mount points. See zope.conf at the end. Regards Tino
On Wed, Nov 17, 2004 at 11:16:14PM +0100, Tino Wildenhain wrote:
Hi,
Am Mittwoch, den 17.11.2004, 20:52 +0000 schrieb John Poltorak:
Is there any way to set up an images folder which can be shared between several sites under one zope instance?
If so how would I reference them if they were all in the /images folder?
Of course. And you reference them by context.images.whateverimage or in HTML: <img src="/images/whateverimage">
You should always specify a path starting with / in Zope links. it does not matter if the site is somewhere down the path, aquision solves it (as long as there is no other images object in the path to root)
But this breaks when you use virtual hosting. I try to always do one of the following: a) give a relative path and let acquisition deal with it... e.g. <img src="images/whateverimage" /> or (preferred) b) call a method that gives a good result in all circumstances, e.g. <img tal:replace="here/images/whateverimage" /> or <img tal:attributes="href here/images/whateverimage/absolute_url" /> or <img tal:attributes="href here/images/whateverimage/absolute_url_path" /> etc. -- Paul Winkler http://www.slinkp.com
participants (8)
-
Chris McDonough -
Cliff Ford -
David Pratt -
Dieter Maurer -
J Cameron Cooper -
John Poltorak -
Paul Winkler -
Tino Wildenhain