[Zope-Checkins] CVS: Zope/lib/python/App -
ApplicationManager.py:1.88.4.1.4.1
CacheManager.py:1.27.44.2.2.1 Extensions.py:1.21.12.1.4.1
Management.py:1.61.68.2.2.1 Product.py:1.63.2.2.4.1
ProductRegistry.py:1.15.90.1 special_dtml.py:1.25.34.1
tar.py:1.6.90.1
Tres Seaver
cvs-admin at zope.org
Mon Nov 17 17:10:19 EST 2003
Update of /cvs-repository/Zope/lib/python/App
In directory cvs.zope.org:/tmp/cvs-serv12097/lib/python/App
Modified Files:
Tag: tseaver-strexp_delenda-branch
ApplicationManager.py CacheManager.py Extensions.py
Management.py Product.py ProductRegistry.py special_dtml.py
tar.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/App/ApplicationManager.py 1.88.4.1 => 1.88.4.1.4.1 ===
--- Zope/lib/python/App/ApplicationManager.py:1.88.4.1 Mon Jul 21 12:35:11 2003
+++ Zope/lib/python/App/ApplicationManager.py Mon Nov 17 17:09:48 2003
@@ -28,6 +28,7 @@
from version_txt import version_txt
from cStringIO import StringIO
from AccessControl import getSecurityManager
+from zExceptions import Redirect
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
import zLOG
import Lifetime
@@ -352,7 +353,7 @@
def manage_app(self, URL2):
"""Return to the main management screen"""
- raise 'Redirect', URL2+'/manage'
+ raise Redirect, URL2+'/manage'
def process_time(self):
s=int(time.time())-self.process_start
@@ -463,7 +464,7 @@
def version_info(self):
r=[]
try: db=self._p_jar.db()
- except: raise 'Zope database version error', """
+ except: raise ValueError, """
Sorry, <em>Version management</em> is only supported if you use ZODB 3.
"""
for v in db.versions():
=== Zope/lib/python/App/CacheManager.py 1.27.44.2 => 1.27.44.2.2.1 ===
--- Zope/lib/python/App/CacheManager.py:1.27.44.2 Wed Nov 5 00:29:17 2003
+++ Zope/lib/python/App/CacheManager.py Mon Nov 17 17:09:48 2003
@@ -68,7 +68,7 @@
except:
# BoboPOS2:
if self._p_jar.db is not Globals.Bobobase._jar.db:
- raise 'Version Error', (
+ raise ValueError, (
'''You may not change the database cache age
while working in a <em>version</em>''')
self._cache_age=Globals.Bobobase._jar.cache.cache_age=value
@@ -98,7 +98,7 @@
except:
# BoboPOS2:
if self._p_jar.db is not Globals.Bobobase._jar.db:
- raise 'Version Error', (
+ raise ValueError, (
'''You may not change the database cache size
while working in a <em>version</em>''')
Globals.Bobobase._jar.cache.cache_size = value
=== Zope/lib/python/App/Extensions.py 1.21.12.1 => 1.21.12.1.4.1 ===
--- Zope/lib/python/App/Extensions.py:1.21.12.1 Mon Jul 21 12:35:11 2003
+++ Zope/lib/python/App/Extensions.py Mon Nov 17 17:09:48 2003
@@ -19,6 +19,7 @@
import os, zlib, imp
import Products
+from zExceptions import NotFound
path_split=os.path.split
path_join=os.path.join
exists=os.path.exists
@@ -116,7 +117,7 @@
p = module
p=getPath('Extensions', p, suffixes=('','py','pyp','pyc'))
if p is None:
- raise "Module Error", (
+ raise NotFound, (
"The specified module, <em>%s</em>, couldn't be found." % module)
__traceback_info__=p, module
@@ -140,7 +141,7 @@
else:
try: execsrc=open(p)
- except: raise "Module Error", (
+ except: raise NotFound, (
"The specified module, <em>%s</em>, couldn't be opened."
% module)
m={}
@@ -154,7 +155,7 @@
try:
return m[name]
except KeyError:
- raise 'Invalid Object Name', (
+ raise NotFound, (
"The specified object, <em>%s</em>, was not found in module, "
"<em>%s</em>." % (name, module))
=== Zope/lib/python/App/Management.py 1.61.68.2 => 1.61.68.2.2.1 ===
--- Zope/lib/python/App/Management.py:1.61.68.2 Fri Oct 17 12:37:35 2003
+++ Zope/lib/python/App/Management.py Mon Nov 17 17:09:48 2003
@@ -13,13 +13,13 @@
"""Standard management interface support
-$Id$"""
-
-__version__='$Revision$'[11:-2]
+$Id$
+"""
import sys, Globals, ExtensionClass, urllib
from Dialogs import MessageDialog
from Globals import DTMLFile, HTMLFile
+from zExceptions import Redirect
from AccessControl import getSecurityManager, Unauthorized
class Tabs(ExtensionClass.Base):
@@ -38,8 +38,10 @@
result=[]
- try: options=tuple(self.manage_options)
- except: options=tuple(self.manage_options())
+ try:
+ options=tuple(self.manage_options)
+ except:
+ options=tuple(self.manage_options())
for d in options:
@@ -48,10 +50,12 @@
continue
path=d.get('path', None)
- if path is None: path=d['action']
+ if path is None:
+ path=d['action']
o=self.unrestrictedTraverse(path, None)
- if o is None: continue
+ if o is None:
+ continue
try:
if validate(None, self, None, o):
@@ -70,13 +74,14 @@
options=self.filtered_manage_options(REQUEST)
try:
m=options[0]['action']
- if m=='manage_workspace': raise TypeError
+ if m=='manage_workspace':
+ raise TypeError
except:
raise Unauthorized, (
'You are not authorized to view this object.')
if m.find('/'):
- raise 'Redirect', (
+ raise Redirect, (
"%s/%s" % (REQUEST['URL1'], m))
return getattr(self, m)(self, REQUEST)
@@ -106,13 +111,19 @@
quote=urllib.quote,
):
out=[]
- while path[:1]=='/': path=path[1:]
- while path[-1:]=='/': path=path[:-1]
- while script[:1]=='/': script=script[1:]
- while script[-1:]=='/': script=script[:-1]
+ while path[:1]=='/':
+ path = path[1:]
+ while path[-1:]=='/':
+ path = path[:-1]
+ while script[:1]=='/':
+ script = script[1:]
+ while script[-1:]=='/':
+ script = script[:-1]
path=path.split('/')[:-1]
- if script: path=[script]+path
- if not path: return ''
+ if script:
+ path = [script] + path
+ if not path:
+ return ''
script=''
last=path[-1]
del path[-1]
@@ -124,7 +135,8 @@
class_manage_path__roles__=None
def class_manage_path(self):
- if self.__class__.__module__[:1] != '*': return
+ if self.__class__.__module__[:1] != '*':
+ return
path = getattr(self.__class__, '_v_manage_path_roles', None)
if path is None:
meta_type = self.meta_type
=== Zope/lib/python/App/Product.py 1.63.2.2 => 1.63.2.2.4.1 ===
--- Zope/lib/python/App/Product.py:1.63.2.2 Thu Oct 2 15:08:44 2003
+++ Zope/lib/python/App/Product.py Mon Nov 17 17:09:48 2003
@@ -260,14 +260,15 @@
"Product Distributions"
def __bobo_traverse__(self, REQUEST, name):
- if name[-7:] != '.tar.gz': raise 'Invalid Name', escape(name)
+ if name[-7:] != '.tar.gz':
+ raise ValueError, 'Invalid Name: %s' % escape(name)
l=name.find('-')
id, version = name[:l], name[l+1:-7]
product=self.aq_parent
if product.id==id and product.version==version:
return Distribution(product)
- raise 'Invalid version or product id', escape(name)
+ raise ValueError, 'Invalid version or product id: %s' % escape(name)
Distributions=Distributions()
=== Zope/lib/python/App/ProductRegistry.py 1.15 => 1.15.90.1 ===
--- Zope/lib/python/App/ProductRegistry.py:1.15 Wed Aug 14 17:31:40 2002
+++ Zope/lib/python/App/ProductRegistry.py Mon Nov 17 17:09:48 2003
@@ -56,7 +56,7 @@
if mt['name']==meta_type:
if not mt.has_key('product'): mt['product']=pid
if mt['product'] != pid:
- raise 'Type Exists', (
+ raise ValueError, (
'The type <em>%s</em> is already defined.' % meta_type)
mt['action']='%s%s' % (
self._constructor_prefix_string(pid), id)
@@ -97,7 +97,7 @@
for d in permissions:
if d['name']==permission:
- raise 'Type Exists', (
+ raise ValueError, (
'The permission <em>%s</em> is already defined.'
% permission)
=== Zope/lib/python/App/special_dtml.py 1.25 => 1.25.34.1 ===
--- Zope/lib/python/App/special_dtml.py:1.25 Tue Feb 11 12:17:04 2003
+++ Zope/lib/python/App/special_dtml.py Mon Nov 17 17:09:48 2003
@@ -177,7 +177,8 @@
except AttributeError:
if type(sys.exc_value)==InstanceType and sys.exc_value.args[0]=="_v_blocks":
LOG("ZPublisher",WARNING,"DTML file '%s' could not be read" % self.raw)
- raise "DTML file error","Check logfile for details"
+ raise ValueError, ("DTML file error: "
+ "Check logfile for details")
else:
raise
=== Zope/lib/python/App/tar.py 1.6 => 1.6.90.1 ===
--- Zope/lib/python/App/tar.py:1.6 Wed Aug 14 17:31:41 2002
+++ Zope/lib/python/App/tar.py Mon Nov 17 17:09:48 2003
@@ -62,7 +62,8 @@
pad(prefix, 155),
'\0'*12,
])
- if len(header) != 512: raise 'Bad Header Length', len(header)
+ if len(header) != 512:
+ raise ValueError, 'Bad Header Length: %d' % len(header)
header=(header[:148]+
oct8(reduce(lambda a,b: a+b, map(ord,header)))+
header[156:])
More information about the Zope-Checkins
mailing list