[Zope-CMF] Finding size of portal

Gitte Wange gitte@mmmanager.org
Mon, 16 Dec 2002 20:43:57 +0100


On Monday 16 December 2002 08:01 pm, you wrote:
> On Mon, 2002-12-16 at 13:30, Gitte Wange wrote:
> > On Monday 16 December 2002 06:31 pm, Ivo van der Wijk wrote:
> > > On Mon, Dec 16, 2002 at 06:20:50PM +0100, Gitte Wange wrote:
> > > > Hello,
> > > >
> > > > Is there anyone out there who have created a method that returns =
the
> > > > size of a CMF Portal ? (The size in MB or something?)
> > > > Or have any good ideas how I can create such a method ?
> > >
> > > You could use QuotaFolder for this. However, QuotaFolder currently
> > > doesn't count FilesystemDirectoryViews correctly, so the numbers ma=
y
> > > not be correct - we're working on this (actually, we're making
> > > QuotaFolder completely CMF aware so it can even serve as a restrict=
ed
> > > Member folder)
> > >
> > > Also, it's impossible to get an exact size of zope objects (and the=
ir
> > > properties, older versions, etc), but QuotaFolder gives you a pictu=
re
> > > of the size of the content, and a way to restrict it.
> > >
> > > Cheers
> > >
> > > =09Ivo
> >
> > Thanks for your reply Ivo ...
> >
> > But I just came to think of 1 thing ... in order to use QuotaFolder f=
or
> > this wouldn't the portal object need to inherite from QuotaFolder ?
>
> Gitte,
>
> You could stash the "content object size" as a metadata schema column i=
n
> the catalog, and then compute the "size" of the portal (or any
> subfolder) by querying the catalog and aggregating the attributes of th=
e
> brains objects.
>
> You would, of course, need to write a skin method for "correctly"
> computing the size, based on your policies.
>
> Tres.

Hi Tres,

Yes that was the solution I found ...
But I need to use the size of the portal in a modified UrlTool so it woul=
d=20
need to query the catalog each time a page was loaded (I don't think that=
=20
would be such a good idea *S*).
So - instead of using just an index in the catalog, I subclassed the cata=
log=20
and overruled the indexObject, unindexObject and reindexObject methods. H=
ere=20
I extracted the value of get_size of the object and incremented/decrement=
ed=20
an attribute in the tool that contains the total size of the portal. Not =
the=20
perfect solution but it works :-)

Thanks for the tip!
Gitte