[Zope-Checkins] CVS: Zope/lib/python/App - ApplicationManager.py:1.90 Extensions.py:1.23 Management.py:1.64 Product.py:1.66 ProductRegistry.py:1.16 special_dtml.py:1.26 tar.py:1.7

Tres Seaver cvs-admin at zope.org
Tue Nov 18 08:17:29 EST 2003


Update of /cvs-repository/Zope/lib/python/App
In directory cvs.zope.org:/tmp/cvs-serv30559/lib/python/App

Modified Files:
	ApplicationManager.py Extensions.py Management.py Product.py 
	ProductRegistry.py special_dtml.py tar.py 
Log Message:
 - Merge tseaver-strexp_delenda-branch to the head.


=== Zope/lib/python/App/ApplicationManager.py 1.89 => 1.90 ===
--- Zope/lib/python/App/ApplicationManager.py:1.89	Sat Jul 19 22:55:51 2003
+++ Zope/lib/python/App/ApplicationManager.py	Tue Nov 18 08:16:58 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/Extensions.py 1.22 => 1.23 ===
--- Zope/lib/python/App/Extensions.py:1.22	Wed Jul  9 14:44:24 2003
+++ Zope/lib/python/App/Extensions.py	Tue Nov 18 08:16:58 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.63 => 1.64 ===
--- Zope/lib/python/App/Management.py:1.63	Fri Oct 17 12:21:14 2003
+++ Zope/lib/python/App/Management.py	Tue Nov 18 08:16:58 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.65 => 1.66 ===
--- Zope/lib/python/App/Product.py:1.65	Thu Oct  2 15:09:27 2003
+++ Zope/lib/python/App/Product.py	Tue Nov 18 08:16:58 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.16 ===
--- Zope/lib/python/App/ProductRegistry.py:1.15	Wed Aug 14 17:31:40 2002
+++ Zope/lib/python/App/ProductRegistry.py	Tue Nov 18 08:16:58 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.26 ===
--- Zope/lib/python/App/special_dtml.py:1.25	Tue Feb 11 12:17:04 2003
+++ Zope/lib/python/App/special_dtml.py	Tue Nov 18 08:16:58 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.7 ===
--- Zope/lib/python/App/tar.py:1.6	Wed Aug 14 17:31:41 2002
+++ Zope/lib/python/App/tar.py	Tue Nov 18 08:16:58 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