[Zope-Checkins] CVS: Zope/lib/python/OFS -
Application.py:1.191.2.2.2.1 Cache.py:1.10.90.1
CopySupport.py:1.85.2.2.2.1 DTMLMethod.py:1.80.44.2.4.1
DefaultObservable.py:1.6.90.1 History.py:1.17.38.1
Image.py:1.145.2.3.2.1 ObjectManager.py:1.163.12.1.2.1
PropertyManager.py:1.52.2.2.2.1
PropertySheets.py:1.89.4.2.2.1 SimpleItem.py:1.106.34.1
rPickle.py:1.6.90.1
Tres Seaver
cvs-admin at zope.org
Mon Nov 17 17:10:23 EST 2003
Update of /cvs-repository/Zope/lib/python/OFS
In directory cvs.zope.org:/tmp/cvs-serv12097/lib/python/OFS
Modified Files:
Tag: tseaver-strexp_delenda-branch
Application.py Cache.py CopySupport.py DTMLMethod.py
DefaultObservable.py History.py Image.py ObjectManager.py
PropertyManager.py PropertySheets.py SimpleItem.py rPickle.py
Log Message:
- Rip string exceptins out by the root.
- webdav/*: clean up block statements for readability.
- XXX: Redirects are now showing up in the error log object; need
to filter!
=== Zope/lib/python/OFS/Application.py 1.191.2.2 => 1.191.2.2.2.1 ===
--- Zope/lib/python/OFS/Application.py:1.191.2.2 Wed Nov 5 00:29:18 2003
+++ Zope/lib/python/OFS/Application.py Mon Nov 17 17:09:52 2003
@@ -29,6 +29,7 @@
from misc_ import Misc_
import ZDOM
from zLOG import LOG, ERROR, WARNING, INFO
+from zExceptions import Redirect as RedirectException, Forbidden
from HelpSys.HelpSys import HelpSys
from Acquisition import aq_base
from App.Product import doInstall
@@ -87,8 +88,9 @@
def PrincipiaRedirect(self,destination,URL1):
"""Utility function to allow user-controlled redirects"""
- if destination.find('//') >= 0: raise 'Redirect', destination
- raise 'Redirect', ("%s/%s" % (URL1, destination))
+ if destination.find('//') >= 0:
+ raise RedirectException, destination
+ raise RedirectException, ("%s/%s" % (URL1, destination))
Redirect=ZopeRedirect=PrincipiaRedirect
def __bobo_traverse__(self, REQUEST, name=None):
@@ -124,12 +126,12 @@
def DELETE(self, REQUEST, RESPONSE):
"""Delete a resource object."""
self.dav__init(REQUEST, RESPONSE)
- raise 'Forbidden', 'This resource cannot be deleted.'
+ raise Forbidden, 'This resource cannot be deleted.'
def MOVE(self, REQUEST, RESPONSE):
"""Move a resource to a new location."""
self.dav__init(REQUEST, RESPONSE)
- raise 'Forbidden', 'This resource cannot be moved.'
+ raise Forbidden, 'This resource cannot be moved.'
test_url___allow_groups__=None
test_url=ZopeAttributionButton
=== Zope/lib/python/OFS/Cache.py 1.10 => 1.10.90.1 ===
--- Zope/lib/python/OFS/Cache.py:1.10 Wed Aug 14 17:42:56 2002
+++ Zope/lib/python/OFS/Cache.py Mon Nov 17 17:09:52 2003
@@ -404,7 +404,7 @@
'''
def ZCache_invalidate(self, ob):
- raise 'Not implemented'
+ raise NotImplementedError
def ZCache_get(self, ob, view_name, keywords, mtime_func, default):
# view_name: If an object provides different views that would
@@ -423,11 +423,11 @@
#
# default: If no entry is found, ZCache_get() should return
# default.
- raise 'Not implemented'
+ raise NotImplementedError
def ZCache_set(self, ob, data, view_name, keywords, mtime_func):
# See ZCache_get() for parameter descriptions.
- raise 'Not implemented'
+ raise NotImplementedError
class CacheManager:
@@ -437,7 +437,7 @@
ZCacheManager_getCache__roles__ = ()
def ZCacheManager_getCache(self):
- raise 'Not implemented'
+ raise NotImplementedError
_isCacheManager = 1
=== Zope/lib/python/OFS/CopySupport.py 1.85.2.2 => 1.85.2.2.2.1 ===
--- Zope/lib/python/OFS/CopySupport.py:1.85.2.2 Tue Nov 4 12:55:55 2003
+++ Zope/lib/python/OFS/CopySupport.py Mon Nov 17 17:09:52 2003
@@ -20,7 +20,7 @@
from App.Dialogs import MessageDialog
from AccessControl import getSecurityManager
from Acquisition import aq_base, aq_inner, aq_parent
-from zExceptions import Unauthorized
+from zExceptions import Unauthorized, BadRequest
from AccessControl import getSecurityManager
from webdav.Lockable import ResourceLockedError
@@ -223,7 +223,7 @@
def manage_renameObjects(self, ids=[], new_ids=[], REQUEST=None):
"""Rename several sub-objects"""
if len(ids) != len(new_ids):
- raise 'Bad Request','Please rename each listed object.'
+ raise BadRequest,'Please rename each listed object.'
for i in range(len(ids)):
if ids[i] != new_ids[i]:
self.manage_renameObject(ids[i], new_ids[i], REQUEST)
=== Zope/lib/python/OFS/DTMLMethod.py 1.80.44.2 => 1.80.44.2.4.1 ===
--- Zope/lib/python/OFS/DTMLMethod.py:1.80.44.2 Mon Jul 21 12:35:34 2003
+++ Zope/lib/python/OFS/DTMLMethod.py Mon Nov 17 17:09:52 2003
@@ -30,6 +30,7 @@
from AccessControl import getSecurityManager
from AccessControl.DTML import RestrictedDTML
from Cache import Cacheable
+from zExceptions import Forbidden
from zExceptions.TracebackSupplement import PathTracebackSupplement
_marker = [] # Create a new marker object.
@@ -294,7 +295,7 @@
if user is not None: return
- raise 'Forbidden', (
+ raise Forbidden, (
'You are not authorized to change <em>%s</em> because you '
'do not have proxy roles.\n<!--%s, %s-->' % (self.__name__, u, roles))
=== Zope/lib/python/OFS/DefaultObservable.py 1.6 => 1.6.90.1 ===
--- Zope/lib/python/OFS/DefaultObservable.py:1.6 Wed Aug 14 17:42:56 2002
+++ Zope/lib/python/OFS/DefaultObservable.py Mon Nov 17 17:09:52 2003
@@ -118,6 +118,8 @@
class DontGoHere( Exception ): pass
+ class Idawanna( Exception ): pass
+
class TestSubject( DefaultObservable ):
def __init__( self, paths ):
@@ -155,7 +157,7 @@
def tryVeto( subject, event ):
""" Simulate attempted veto. """
- raise 'Idawanna!'
+ raise Idawanna
observer = TestObserver()
=== Zope/lib/python/OFS/History.py 1.17 => 1.17.38.1 ===
--- Zope/lib/python/OFS/History.py:1.17 Sun Dec 22 18:06:44 2002
+++ Zope/lib/python/OFS/History.py Mon Nov 17 17:09:52 2003
@@ -19,6 +19,7 @@
from Acquisition import Implicit, aq_base
from struct import pack, unpack
from cgi import escape
+from zExceptions import Redirect
class TemporalParadox(Exception): pass
@@ -69,7 +70,7 @@
def manage_workspace(self, REQUEST):
"We aren't real, so we delegate to that that spawned us!"
- raise 'Redirect', REQUEST['URL2']+'/manage_change_history_page'
+ raise Redirect, REQUEST['URL2']+'/manage_change_history_page'
class Historical(ExtensionClass.Base):
"""Mix-in class to provide a veiw that shows hystorical changes
=== Zope/lib/python/OFS/Image.py 1.145.2.3 => 1.145.2.3.2.1 ===
--- Zope/lib/python/OFS/Image.py:1.145.2.3 Tue Oct 21 10:53:15 2003
+++ Zope/lib/python/OFS/Image.py Mon Nov 17 17:09:52 2003
@@ -31,6 +31,7 @@
from mimetools import choose_boundary
from ZPublisher import HTTPRangeSupport
from ZPublisher.HTTPRequest import FileUpload
+from zExceptions import Redirect
from cgi import escape
StringType=type('')
@@ -389,7 +390,7 @@
"""
The default view of the contents of the File or Image.
"""
- raise 'Redirect', URL1
+ raise Redirect, URL1
# private
update_data__roles__=()
=== Zope/lib/python/OFS/ObjectManager.py 1.163.12.1 => 1.163.12.1.2.1 ===
--- Zope/lib/python/OFS/ObjectManager.py:1.163.12.1 Sun Nov 2 13:04:26 2003
+++ Zope/lib/python/OFS/ObjectManager.py Mon Nov 17 17:09:52 2003
@@ -36,6 +36,7 @@
from App.config import getConfiguration
from AccessControl import getSecurityManager
from zLOG import LOG, ERROR
+from zExceptions import BadRequest
import sys,fnmatch,copy
from cgi import escape
from types import StringType, UnicodeType
@@ -450,10 +451,11 @@
v=self._getOb(id, self)
if v.wl_isLocked():
- raise ResourceLockedError, 'Object "%s" is locked via WebDAV' % v.getId()
+ raise ResourceLockedError, (
+ 'Object "%s" is locked via WebDAV' % v.getId())
if v is self:
- raise 'BadRequest', '%s does not exist' % escape(ids[-1])
+ raise BadRequest, '%s does not exist' % escape(ids[-1])
self._delObject(id)
del ids[-1]
if REQUEST is not None:
=== Zope/lib/python/OFS/PropertyManager.py 1.52.2.2 => 1.52.2.2.2.1 ===
--- Zope/lib/python/OFS/PropertyManager.py:1.52.2.2 Tue Nov 4 10:42:27 2003
+++ Zope/lib/python/OFS/PropertyManager.py Mon Nov 17 17:09:52 2003
@@ -21,6 +21,7 @@
from Globals import DTMLFile, MessageDialog
from Acquisition import Implicit, aq_base
from Globals import Persistent
+from zExceptions import BadRequest
from cgi import escape
@@ -168,11 +169,11 @@
self._wrapperCheck(value)
if not self.valid_property_id(id):
- raise 'Bad Request', 'Invalid or duplicate property id'
+ raise BadRequest, 'Invalid or duplicate property id'
if type in ('selection', 'multiple selection'):
if not hasattr(self, value):
- raise 'Bad Request', 'No select variable %s' % value
+ raise BadRequest, 'No select variable %s' % value
self._properties=self._properties + (
{'id':id, 'type':type, 'select_variable':value},)
if type=='selection':
@@ -189,7 +190,7 @@
# the value to the type of the existing property.
self._wrapperCheck(value)
if not self.hasProperty(id):
- raise 'Bad Request', 'The property %s does not exist' % escape(id)
+ raise BadRequest, 'The property %s does not exist' % escape(id)
if type(value)==type(''):
proptype=self.getPropertyType(id) or 'string'
if type_converters.has_key(proptype):
@@ -288,7 +289,7 @@
for name, value in props.items():
if self.hasProperty(name):
if not 'w' in propdict[name].get('mode', 'wd'):
- raise 'BadRequest', '%s cannot be changed' % escape(name)
+ raise BadRequest, '%s cannot be changed' % escape(name)
self._updateProperty(name, value)
if REQUEST:
message="Saved changes."
@@ -331,7 +332,7 @@
nd=self._reserved_names
for id in ids:
if not hasattr(aq_base(self), id):
- raise 'BadRequest', (
+ raise BadRequest, (
'The property <em>%s</em> does not exist' % escape(id))
if (not 'd' in propdict[id].get('mode', 'wd')) or (id in nd):
return MessageDialog(
=== Zope/lib/python/OFS/PropertySheets.py 1.89.4.2 => 1.89.4.2.2.1 ===
--- Zope/lib/python/OFS/PropertySheets.py:1.89.4.2 Tue Oct 21 11:33:11 2003
+++ Zope/lib/python/OFS/PropertySheets.py Mon Nov 17 17:09:52 2003
@@ -28,6 +28,7 @@
from Acquisition import aq_base
from AccessControl import getSecurityManager
from webdav.common import isDavCollection
+from zExceptions import BadRequest, Redirect
from cgi import escape
@@ -190,16 +191,16 @@
# systems.
self._wrapperCheck(value)
if not self.valid_property_id(id):
- raise 'Bad Request', 'Invalid property id, %s.' % escape(id)
+ raise BadRequest, 'Invalid property id, %s.' % escape(id)
if not self.property_extensible_schema__():
- raise 'Bad Request', (
+ raise BadRequest, (
'Properties cannot be added to this property sheet')
pself=self.p_self()
self=self.v_self()
if hasattr(aq_base(self),id):
if not (id=='title' and not self.__dict__.has_key(id)):
- raise 'Bad Request', (
+ raise BadRequest, (
'Invalid property id, <em>%s</em>. It is in use.' %
escape(id))
if meta is None: meta={}
@@ -207,7 +208,7 @@
pself._properties=pself._properties+(prop,)
if type in ('selection', 'multiple selection'):
if not value:
- raise 'Bad Request', (
+ raise BadRequest, (
'The value given for a new selection property '
'must be a variable name<p>')
prop['select_variable']=value
@@ -222,10 +223,10 @@
# it will used to _replace_ the properties meta data.
self._wrapperCheck(value)
if not self.hasProperty(id):
- raise 'Bad Request', 'The property %s does not exist.' % escape(id)
+ raise BadRequest, 'The property %s does not exist.' % escape(id)
propinfo=self.propertyInfo(id)
if not 'w' in propinfo.get('mode', 'wd'):
- raise 'Bad Request', '%s cannot be changed.' % escape(id)
+ raise BadRequest, '%s cannot be changed.' % escape(id)
if type(value)==type(''):
proptype=propinfo.get('type', 'string')
if type_converters.has_key(proptype):
@@ -243,13 +244,13 @@
# Delete the property with the given id. If a property with the
# given id does not exist, a ValueError is raised.
if not self.hasProperty(id):
- raise 'Bad Request', 'The property %s does not exist.' % escape(id)
+ raise BadRequest, 'The property %s does not exist.' % escape(id)
vself=self.v_self()
if hasattr(vself, '_reserved_names'):
nd=vself._reserved_names
else: nd=()
if (not 'd' in self.propertyInfo(id).get('mode', 'wd')) or (id in nd):
- raise 'Bad Request', '%s cannot be deleted.' % escape(id)
+ raise BadRequest, '%s cannot be deleted.' % escape(id)
delattr(vself, id)
pself=self.p_self()
pself._properties=tuple(filter(lambda i, n=id: i['id'] != n,
@@ -392,7 +393,7 @@
manage=DTMLFile('dtml/properties', globals())
def manage_propertiesForm(self, URL1):
" "
- raise 'Redirect', URL1+'/manage'
+ raise Redirect, URL1+'/manage'
def manage_addProperty(self, id, value, type, REQUEST=None):
"""Add a new property via the web. Sets a new property with
@@ -429,7 +430,7 @@
for name, value in props.items():
if self.hasProperty(name):
if not 'w' in propdict[name].get('mode', 'wd'):
- raise 'BadRequest', '%s cannot be changed' % escape(name)
+ raise BadRequest, '%s cannot be changed' % escape(name)
self._updateProperty(name, value)
if REQUEST is not None:
return MessageDialog(
=== Zope/lib/python/OFS/SimpleItem.py 1.106 => 1.106.34.1 ===
--- Zope/lib/python/OFS/SimpleItem.py:1.106 Tue Feb 4 11:38:10 2003
+++ Zope/lib/python/OFS/SimpleItem.py Mon Nov 17 17:09:52 2003
@@ -32,6 +32,7 @@
from Acquisition import aq_base, aq_parent, aq_inner, aq_acquire
from DocumentTemplate.ustr import ustr
from zExceptions.ExceptionFormatter import format_exception
+from zExceptions import Redirect
import time
from zLOG import LOG, BLATHER
@@ -222,7 +223,7 @@
def manage(self, URL1):
" "
- raise 'Redirect', "%s/manage_main" % URL1
+ raise Redirect, "%s/manage_main" % URL1
# This keeps simple items from acquiring their parents
# objectValues, etc., when used in simple tree tags.
=== Zope/lib/python/OFS/rPickle.py 1.6 => 1.6.90.1 ===
--- Zope/lib/python/OFS/rPickle.py:1.6 Wed Aug 14 17:42:56 2002
+++ Zope/lib/python/OFS/rPickle.py Mon Nov 17 17:09:52 2003
@@ -25,7 +25,7 @@
except: raise SystemError, 'Class not registered'
def load_string(self):
- raise 'BadPickle', 'Non binstring'
+ raise pickle.UnpicklingError, 'Bad pickle: Non binstring'
# Public interface
More information about the Zope-Checkins
mailing list