[Zope] Quotas on folder

Terry Hancock hancock@anansispaceworks.com
Tue, 12 Feb 2002 13:51:53 -0800


Is it possible to set a quota on a folder?  I.e. the
folder knows how much space is consumed by the objects
it contains, and refuses to add objects after a certain
point.

Clearly the actual data storage may be larger, due to
the space consumed for undos, but this would be the
"packed" size of the folder's contents.  Also, the
packed size is something users can more easily manage
for themselves.

I need to set something like this up for site users to
have a small amount of user space on the system (and
avoid abuse of it).

I was hoping there would be a product to do this, but
I haven't found one, so perhaps I'll write one. But
I'd prefer not to reinvent if not necessary.  Also,
any hints on how to do it would be appreciated.

Currently it looks as if I would have to iterate the
folders contents and call "getSize()" for Files and
Images and "get_size()" for DTMLDocuments and DTMLMethods,
and possibly something else for other content (presumeably
I'd have to recursively search Folders, for example).
This is basically the "du" (*nix command) approach.

Alternatively, maybe I could catch the size when the
objects were added or deleted?

Thanks for any ideas,
Terry

-- 
------------------------------------------------------
Terry Hancock
hancock@anansispaceworks.com       
Anansi Spaceworks                 
http://www.anansispaceworks.com 
------------------------------------------------------