Re: [Zope] Limiting folder space

2000-07-31 Thread Kapil Thangavelu

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
 consume.
 
 Hence:
 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.

example implementation.

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"

trth colspan="4"dtml-var id Directory Contents/th/tr
trtdFile Name/tdtdType/tdtdSize/tdtdTimeStamp/td/tr

dtml-in "objectItems(['File', 'Image'])"
dtml-with sequence-item
dtml-call "REQUEST.set('DirectorySize', DirectorySize+size)"

tr
tda href="dtml-var sequence-key"dtml-var sequence-key/a/td
tddtml-var content_type/td
tddtml-var size/td
tddtml-var bobobase_modification_time/td
/tr
/dtml-with
/dtml-in

dtml-call "REQUEST.set('DirectorySize', DirectorySize/1000)"
trtd colspan="4"Total Directory Size: dtml-var
DirectorySizeK/td/tr
/table

 Regards,
 Brendon
 --
 70South: the No.1 source for Antarcticles.
 For the latest news and views on Antarctica visit : http://www.70south.com
 
 ___
 Zope maillist  -  [EMAIL PROTECTED]
 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 )

___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] Limiting folder space

2000-07-31 Thread Otto Hammersmith

One thing I considered doing was using 2.2's mountable databases for
something like this.  Give each user their own database (possibly
without undo information) and use a cron job to check file sizes.  If
you have root on the box, you could create users id's for each user and
use quota on the filesystem to handle quota checking for you.

Of course, this wouldn't be horribly practical for a *lot* of users.

-Otto.

Kapil Thangavelu wrote:
 
 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 consume.
 
  Hence:
  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?
[snip]

___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] Limiting folder space

2000-07-26 Thread Oleg Broytmann

Hello!

   ZODB (like any other filesystem-like storage) should has "qouta"
support. But while it is not implemented I'd like to hear your recipe.

On Tue, 25 Jul 2000, Bill Anderson wrote:
 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
  consume.
  
  Hence:
  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?
 
 Short answer: no.
 
 Longer Answer:
 Not under thattype of setup, There ar emethods that could be used now to do this, 
but the
 ones I come up with off the top of my head require system level access.

Oleg.(All opinions are mine and not of my employer)
 
Oleg Broytmann  Foundation for Effective Policies  [EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.


___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] Limiting folder space

2000-07-26 Thread Bill Anderson

Oleg Broytmann wrote:
 
 Hello!
 
ZODB (like any other filesystem-like storage) should has "qouta"
 support. But while it is not implemented I'd like to hear your recipe.

I don't beleive ZODB is a 'filesystem-like' storage, as it is an Object Database. The
problem (well, one of them anyway ;) would be determining just how much 'space' a given
object is consuming.

Now, what I am doing, is to use the Mountable Database (?) product to mount a given
client's site on. I then calculate storage based upon the size of that particular 
Data.fs,
and then:

 o let the fs handle the quota for the user
 --or--
 o run cron jobs to monitor size of the 
   Data,fs-es, and notify me of any over 
   a specified limit.

I have the two methods because I offer varying levels of server options; some have user
accounts, others do not.

I am migrating to ZEO, but am currently experiencing some difficulty with the
aforementioned  product, but will soon have a new one to take the place. :-)

Bill


--
Do not meddle in the affairs of sysadmins, for they are easy to annoy,
and have the root password.

___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] Limiting folder space

2000-07-26 Thread Oleg Broytmann

Thanks!

On Wed, 26 Jul 2000, Bill Anderson wrote:
 Now, what I am doing, is to use the Mountable Database (?) product to mount a given
 client's site on. I then calculate storage based upon the size of that particular 
Data.fs,
 and then:
 
  o let the fs handle the quota for the user
  --or--
  o run cron jobs to monitor size of the 
Data,fs-es, and notify me of any over 
a specified limit.
 
 I have the two methods because I offer varying levels of server options; some have 
user
 accounts, others do not.
 
 I am migrating to ZEO, but am currently experiencing some difficulty with the
 aforementioned  product, but will soon have a new one to take the place. :-)

Oleg.(All opinions are mine and not of my employer)
 
Oleg Broytmann  Foundation for Effective Policies  [EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.


___
Zope maillist  -  [EMAIL PROTECTED]
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 )




[Zope] Limiting folder space

2000-07-25 Thread Brendon Grunewald

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
consume.

Hence:
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?

Regards,
Brendon
--
70South: the No.1 source for Antarcticles.
For the latest news and views on Antarctica visit : http://www.70south.com


___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] Limiting folder space

2000-07-25 Thread Bill Anderson

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
 consume.
 
 Hence:
 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?

Short answer: no.

Longer Answer:
Not under thattype of setup, There ar emethods that could be used now to do this, but 
the
ones I come up with off the top of my head require system level access.


--
Do not meddle in the affairs of sysadmins, for they are easy to annoy,
and have the root password.

___
Zope maillist  -  [EMAIL PROTECTED]
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 )