File: README.txt

package info (click to toggle)
zope-quotafolder 0.1.1%2B0-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 100 kB
  • ctags: 41
  • sloc: python: 359; makefile: 29
file content (187 lines) | stat: -rw-r--r-- 7,917 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
QuotaFolder - Quota support for Zope

What is it?
-----------

QuotaFolder is a folder-ish object that restricts the total number of objects,
their total size and their individual maximum size. QuotaFolder takes
subfolders (recursively) into account, so it should not be possible to escape
the quota restrictions.

The basic goal of QuotaFolder is not to put an absolute limit on ZODB usage
- it is impossible to determine this. For example, each object may have
several revisions in the ZODB, and some of the internal state of the object
is stored in the ZODB that's not returned by get_size(). The goal is to 
limit the use of objects in general, to prevent people from offering large 
files or using up resources with enormous amounts of objects.

How does it work?
-----------------

QuotaFolder 'MonkeyPatches (tm)' some of the internal Zope components such
as ObjectManager, File, Image, DTMLMethod, DTMLDocument and more. The patching
constist of making the components 'quota aware'. This basically means the 
objects will track changes and report them to parent folders. If one if the
parent folders is a QuotaFolder, and the QuotaFolder detects that the change
will exceed the quota, a QuotaExceededException is raised, and the transaction
is rolled back.

At this moment, if an object supports the get_size() method, it's used. The
value reported by this method will not take all usage (i.e. properties) into
account, so this may be changed in the future.

Supported products
------------------

The QuotaFolder product knows how to account File, Image, DTMLMethod,
DTMLDocument and PythonScript objects. It also understands ObjectManager
based products such as Folder and BTreeFolder (TransparentFolder is not
thoroughly tested, but it seems to work well)

Most products (i.e. FLE, Squishdot, PhotoFolder, ZWiki) exist of ObjectManagers 
with subobjects, and QuotaFolder knows how to handle these quite well. 
Unknown objects who's size (and changes in size) cannot be determined are 
accounted as 1 object with size 0. If this is not satisfactory (for example, 
it's not at this moment for TinyTablePlus), extra support can be built in for 
these objects (as has been done with, for example, ZPT).

QuotaFolder also supports .zexp imports and copy/paste operations.

QuotaFolder has been tested with Zope 2.4.3, 2.4.4b1 and 2.5.0. It has not
been tested in ZEO setups.

Installing
----------

**WARNING**

This product patches classes in your Zope server. Please test the code on
a test-server or shadow server first! This code has been known to work 
succesfully with Zope 2.4.x and Zope 2.5. Use this product at your own
risk, and backup your Data.fs first!

Install the QuotaFolder product by simply unpacking into your Products
directory (either in your SOFTWARE_HOME or your INSTANCE_HOME) and restart
your Zope server. The QuotaFolder product should appear in 
/Control_Panel/Products, and it should also be available in the products
dropdown.

When creating (or editting) a QuotaFolder, you will be presented with the
following fields:

id
title               
Quota size in bytes          - this is the maximum total size of all objects 
                               that's allowed to be created
Maximum object size in bytes - The maximum allowed total size for single
                               objects
Maximum number of objects    - this is the maximum number of objects that's
                               allowed to be created
Require manager role in parent context?
                             - If this setting is enabled, a user must be 
                               manager in the folder context *above* the 
                               quotafolder itself to be able to edit the
                               quota. If you want to limit your users in their
                               usage, you don't want them to be able to edit
                               their quota themselves, do you?

After creation, you will get the same contents view as with a standard folder,
but with an extra tab to the right where you can view and (optionally edit)
the quota.

When visiting the quota tab, you will see an extra button 'Sync'. Pressing
this button will cause the QuotaFolder to recalculate all usage. Usually,
the folder shouldn't be out of sync. If you manage to get a QuotaFolder
out of sync, please contact me.

Migrating
---------

There are two ways to migrate a standard folder to a QuotaFolder:

- Create a new QuotaFolder, copy all objects from the old folder, paste
  them into the QuotaFolder and rename the folders. This will probably not
  work if you have versions (cut/paste may work with versions)

- Use the builtin _replaceFolder method. I.e. create the following external
  method:

  from Products.QuotaFolder.QuotaFolder import _replaceFolder

  def replace(self, name, quota_bytes, quota_objects, quota_maxsize, REQUEST):
    _replaceFolder(self, name, quota_bytes, quota_objects, quota_maxsize)
    return "%s converted" % name

  Create an appropriate external method object in your zope server and invoke
  it with an appropriately formatted url or create a dtml form.

Hacking contest!
----------------

QuotaFolder has been thoroughly tested, and seems very stable and compatible.
However, every now and then, new situations seem to appear where it's possible
to use more objects or space than the QuotaFolder should enforce. This may
be through unsupported objects (though these should generaly not make it
possible to create more free space for other objects), or using trickery
with PythonScripts, etc.

If anyone finds issues like this, please contact me (info below), so we can
make this product even more stable and robust :)

Please check the file KNOWNBUGS before reporting issues.

Release info
------------

0.1     Initial version, basic support for quota

Future plans
------------

- Support soft and hardlimit quota, with configurable timeleft
- Restrict installable metatypes
- Limit number of certain metatypes

Contact/License
---------------

QuotaFolder is partially based on ideas by Andrew Kenneth, though most of his
old QuotaFolder has disappeared.

QuotaFolder is written by Ivo van der Wijk as part of Amaze Internet Service's
FreeZope.org Free Zope hosting environment.

I can be contacted through ivo@amaze.nl or on IRC as VladDrac / VladDrak @ OPN

Recent versions of QuotaFolder and other Zope products can be found at:

http://www.zope.org/Members/ivo
http://vanderijk.info/

QuotaFolder is (c) 2002 Ivo van der Wijk / Amaze Internet Services

All rights reserved. 

Redistribution and use in source and binary forms, with or without 
modification, are permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
   derived from this software without specific prior written permission. 
   
   
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.