Commit 16688f87 authored by Sidnei da Silva's avatar Sidnei da Silva

- Some PEP-328 related changes. Need to make imports conditionally

  relative using new syntax so that they work on Python 2.6.
parent 6219e315
......@@ -12,7 +12,11 @@
##############################################################################
__version__='$Revision: 1.9 $'[11:-2]
from DT_Util import parse_params, name_param
try:
from DT_Util import parse_params, name_param
except ImportError:
# See PEP-328
from .DT_Util import parse_params, name_param
class ReturnTag:
name='return'
......
......@@ -16,9 +16,17 @@ import os
import thread
import re
from DT_Util import ParseError, InstanceDict, TemplateDict, render_blocks, str
from DT_Var import Var, Call, Comment
from DT_Return import ReturnTag, DTReturn
try:
from DT_Util import ParseError, InstanceDict
from DT_Util import TemplateDict, render_blocks, str
from DT_Var import Var, Call, Comment
from DT_Return import ReturnTag, DTReturn
except ImportError:
# See PEP-328
from .DT_Util import ParseError, InstanceDict
from .DT_Util import TemplateDict, render_blocks, str
from .DT_Var import Var, Call, Comment
from .DT_Return import ReturnTag, DTReturn
_marker = [] # Create a new marker object.
......
......@@ -16,12 +16,25 @@ $Id$"""
import re
from html_quote import html_quote, ustr # for import by other modules, dont remove!
try:
# for import by other modules, dont remove!
from html_quote import html_quote, ustr
from cDocumentTemplate import InstanceDict, TemplateDict
from cDocumentTemplate import render_blocks, safe_callable
from cDocumentTemplate import join_unicode
except ImportError:
# See PEP-328:
# for import by other modules, dont remove!
from .html_quote import html_quote, ustr
from .cDocumentTemplate import InstanceDict, TemplateDict
from .cDocumentTemplate import render_blocks, safe_callable
from .cDocumentTemplate import join_unicode
from RestrictedPython.Guards import safe_builtins
from RestrictedPython.Utilities import utility_builtins
from RestrictedPython.Eval import RestrictionCapableEval
from cDocumentTemplate import InstanceDict, TemplateDict, \
render_blocks, safe_callable, join_unicode
test = utility_builtins['test'] # for backwards compatibility, dont remove!
......
......@@ -151,14 +151,22 @@ Evaluating expressions without rendering results
''' # '
__rcs_id__='$Id$'
__version__='$Revision: 1.60 $'[11:-2]
import string, re, sys
from cgi import escape
import string, re, sys
from urllib import quote, quote_plus, unquote, unquote_plus
from DT_Util import parse_params, name_param, str, ustr
from html_quote import html_quote # for import by other modules, dont remove!
try:
# for import by other modules, dont remove!
from html_quote import html_quote
from DT_Util import parse_params, name_param, str, ustr
except ImportError:
from .html_quote import html_quote
from .DT_Util import parse_params, name_param, str, ustr
from Acquisition import aq_base
from ZPublisher.TaintedString import TaintedString
from zope.structuredtext.html import HTMLWithImages, HTML
......
......@@ -109,6 +109,12 @@ __version__='$Revision: 1.14 $'[11:-2]
ParseError='Document Template Parse Error'
from DT_String import String, File
from DT_HTML import HTML, HTMLFile, HTMLDefault
try:
from DT_String import String, File
from DT_HTML import HTML, HTMLFile, HTMLDefault
except ImportError:
# See PEP-328
from .DT_String import String, File
from .DT_HTML import HTML, HTMLFile, HTMLDefault
# import DT_UI # Install HTML editing
......@@ -972,7 +972,7 @@ initcDocumentTemplate(void)
DictInstanceType.ob_type=&PyType_Type;
UNLESS (html_quote = PyImport_ImportModule("html_quote")) return;
UNLESS (html_quote = PyImport_ImportModule("DocumentTemplate.html_quote")) return;
ASSIGN(ustr, PyObject_GetAttrString(html_quote, "ustr"));
UNLESS (ustr) return;
ASSIGN(html_quote, PyObject_GetAttrString(html_quote, "html_quote"));
......
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