Commit cc8e9a87 authored by Tres Seaver's avatar Tres Seaver

- Work around absence of named Unauthorized exception in Zope 2.3x

parent 05c752d6
...@@ -17,7 +17,7 @@ Page Template-specific implementation of TALES, with handlers ...@@ -17,7 +17,7 @@ Page Template-specific implementation of TALES, with handlers
for Python expressions, string literals, and paths. for Python expressions, string literals, and paths.
""" """
__version__='$Revision: 1.26 $'[11:-2] __version__='$Revision: 1.27 $'[11:-2]
import re, sys import re, sys
from TALES import Engine, CompilerError, _valid_name, NAME_RE, \ from TALES import Engine, CompilerError, _valid_name, NAME_RE, \
...@@ -46,7 +46,11 @@ def installHandlers(engine): ...@@ -46,7 +46,11 @@ def installHandlers(engine):
if sys.modules.has_key('Zope'): if sys.modules.has_key('Zope'):
import AccessControl import AccessControl
from AccessControl import getSecurityManager, Unauthorized from AccessControl import getSecurityManager
try:
from AccessControl import Unauthorized
except ImportError:
Unauthorized = "Unauthorized"
if hasattr(AccessControl, 'full_read_guard'): if hasattr(AccessControl, 'full_read_guard'):
from ZRPythonExpr import PythonExpr, _SecureModuleImporter, \ from ZRPythonExpr import PythonExpr, _SecureModuleImporter, \
call_with_ns call_with_ns
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
Zope object encapsulating a Page Template. Zope object encapsulating a Page Template.
""" """
__version__='$Revision: 1.28 $'[11:-2] __version__='$Revision: 1.29 $'[11:-2]
import os, AccessControl, Acquisition, sys import os, AccessControl, Acquisition, sys
from Globals import DTMLFile, ImageFile, MessageDialog, package_home from Globals import DTMLFile, ImageFile, MessageDialog, package_home
...@@ -25,7 +25,11 @@ from DateTime.DateTime import DateTime ...@@ -25,7 +25,11 @@ from DateTime.DateTime import DateTime
from string import join, strip, rstrip, split, replace, lower from string import join, strip, rstrip, split, replace, lower
from Shared.DC.Scripts.Script import Script, BindingsUI from Shared.DC.Scripts.Script import Script, BindingsUI
from Shared.DC.Scripts.Signature import FuncCode from Shared.DC.Scripts.Signature import FuncCode
from AccessControl import getSecurityManager, Unauthorized from AccessControl import getSecurityManager
try:
from AccessControl import Unauthorized
except ImportError:
Unauthorized = "Unauthorized"
from OFS.History import Historical, html_diff from OFS.History import Historical, html_diff
from OFS.Cache import Cacheable from OFS.Cache import Cacheable
from OFS.Traversable import Traversable from OFS.Traversable import Traversable
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment