Brendon Grunewald wrote:
> I want to use Zope to offer registered visitors to my site a little free
> webspace on the site. Since I use hosting service that restricts and charges
> me for space, I would like to restrict the size that their zope folders can
> Is there any simple way of limiting the amount of space that a folder is
> allowed to consume including its subfolders? Alternatively, is there anyway
> of checking how much space a folder with subfolders consumes?
I set something up like this for myself at imeme.net (minus the file
limits) its basically just a simple zodb based remote file storage for
friends. basically to do it you can't let your visitors have access to
your manage screens.
create a folder called filesystem
stick all your adding and managing methods in filesystem
add a size limit property to filesystem
for each user create a folder under filesystem.
that folder should probably have a property called current_size
basically you're going to have forms for people uploading a file. on the
page where you would do the manage_addFile stuff you're going to
implement the logic. check size of the file with _.len(file) on the form
submit page and add to current_size see if its above the limit. if it is
don't add tell the user why. if it isn't add it update the current_size
on the directory. voila.
here's some sample code which does the basics of getting file info
without the management logic to get you started. it pretty prints a
table of file info.
<table align="center" border="1">
<tr><th colspan="4"><dtml-var id> Directory Contents</th></tr>
<dtml-in "objectItems(['File', 'Image'])">
<dtml-call "REQUEST.set('DirectorySize', DirectorySize+size)">
<td><a href="<dtml-var sequence-key>"><dtml-var sequence-key></a></td>
<dtml-call "REQUEST.set('DirectorySize', DirectorySize/1000)">
<tr><td colspan="4">Total Directory Size: <dtml-var
> 70South: the No.1 source for Antarcticles.
> For the latest news and views on Antarctica visit : http://www.70south.com
> Zope maillist - [EMAIL PROTECTED]
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-dev )
Zope maillist - [EMAIL PROTECTED]
** No cross posts or HTML encoding! **
(Related lists -