You are here: Home / Documentation / How To's / How to set file and image size limits in a ZEO cluster environment

How to set file and image size limits in a ZEO cluster environment

by nguyen — published Nov 18, 2009 11:50 AM, last modified Aug 16, 2016 10:50 AM
using plone.recipe.atcontenttypes

Background Info

You want to limit the size of files that can be added to your site.  You want to limit the size of images (file size as well as width/height dimensions).  

See

These links describe how to set it up in a zinstance / standalone install.

Plone Version Compatibility

So far it seems that this does not work with Plone 2.5, where it resulted in a KeyError: 'global_defines' in rendering the main_template.

It has worked for us with Plone 3.0, 3.1, and 3.2.  We have not tested other versions.

Setup for a ZEO Cluster

Here we run ZEO cluster installations with sometimes up to five ZEO clients (so far).

This is what you will want to add to the parts section of your buildout.cfg.  You need one "atcontenttypes" part per ZEO client.  In this example we have five ZEO clients: 

    atcontenttypes-client1
    atcontenttypes-client2
    atcontenttypes-client3
    atcontenttypes-client4
    atcontenttypes-client5

so your parts section will end up looking something like this: 

parts =
    plone
    zope2
    productdistros
    zeoserver
    client1
    client2
    client3
    client4
    client5
    zopepy
    precompile
    chown
    unifiedinstaller
    flash
    atcontenttypes-client1
    atcontenttypes-client2
    atcontenttypes-client3
    atcontenttypes-client4
    atcontenttypes-client5

Then somewhere else, maybe at the end of buildout.cfg add this: 

# This places limits on image and file sizes
#
[atcontenttypes-client1]
recipe                 = plone.recipe.atcontenttypes
zope-instance-location = ${client1:location}
max-file-size          = ATImage:500kb
                         ATFile:30mb
                         ATNewsItem:500kb
max-image-dimension    = ATNewsItem:640,400
                         ATImage:1024,1024

[atcontenttypes-client2]
recipe                 = plone.recipe.atcontenttypes
zope-instance-location = ${client2:location}
max-file-size          = ${atcontenttypes-client1:max-file-size}
max-image-dimension    = ${atcontenttypes-client1:max-image-dimension}

[atcontenttypes-client3]
recipe                 = plone.recipe.atcontenttypes
zope-instance-location = ${client3:location}
max-file-size          = ${atcontenttypes-client1:max-file-size}
max-image-dimension    = ${atcontenttypes-client1:max-image-dimension}

[atcontenttypes-client4]
recipe                 = plone.recipe.atcontenttypes
zope-instance-location = ${client4:location}
max-file-size          = ${atcontenttypes-client1:max-file-size}
max-image-dimension    = ${atcontenttypes-client1:max-image-dimension}

[atcontenttypes-client5]
recipe                 = plone.recipe.atcontenttypes
zope-instance-location = ${client5:location}
max-file-size          = ${atcontenttypes-client1:max-file-size}
max-image-dimension    = ${atcontenttypes-client1:max-image-dimension}

Only the atcontenttypes-client1 section specifies the size limits; the other atcontenttypes sections for clients 2 through 5 use the limits set for client 1. 

Instead, you could specify different limits for each client. That could be useful if you wanted certain users using a specific client to be able to have higher or no limits at all.

 
Navigation