[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Folder - FolderLimit.py:1.1.4.1
Stephan Richter
srichter@cbu.edu
Wed, 27 Mar 2002 11:31:53 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Folder
In directory cvs.zope.org:/tmp/cvs-serv22834/lib/python/Zope/App/OFS/Folder
Added Files:
Tag: Zope-3x-branch
FolderLimit.py
Log Message:
- Test fixes after massive checkin.
Still a set of tests is broken and do not know why.
=== Added File Zope3/lib/python/Zope/App/OFS/Folder/FolderLimit.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""
Revision information:
$Id: FolderLimit.py,v 1.1.4.1 2002/03/27 16:31:52 srichter Exp $
"""
from Zope.App.OFS.Container.IContainerLimit import IContainerLimit
class FolderLimitExeededError(Exception):
"""Exception that is raised, when the limit of the folder was
reached."""
pass
class FolderLimit:
"""Implements a feature that allows to restrict the amount of items in
a Folder.
"""
__implements__ = (IContainerLimit,)
_limit = 1000
############################################################
# Implementation methods for interface
# Zope.App.OFS.IContainerLimit
def setLimit(self, limit):
'''See interface IContainerLimit'''
self._limit = limit
def getLimit(self):
'''See interface IContainerLimit'''
return self._limit
def isLimitReached(self):
'''See interface IContainerLimit'''
if self.objectCount() >= self._limit:
return 1
else:
return 0
#
############################################################