Commit 13d8ba0a authored by Sidnei da Silva's avatar Sidnei da Silva

- Cleanup DocumentTemplate module for relative imports

parent a538bdcd
......@@ -14,9 +14,9 @@
$Id$"""
from DT_String import String, FileMixin
import DT_String, re
from DT_Util import ParseError, str
import re
from DocumentTemplate.DT_String import String, FileMixin
from DocumentTemplate.DT_Util import ParseError, str
class dtml_re_class:
""" This needs to be replaced before 2.4. It's a hackaround. """
......@@ -129,7 +129,7 @@ class dtml_re_class:
def start(self, *args):
return self._start
class HTML(DT_String.String):
class HTML(String):
"""HTML Document Templates
HTML Document templates use HTML server-side-include syntax,
......
......@@ -78,7 +78,7 @@ __doc__='''Conditional insertion
__rcs_id__='$Id$'
__version__='$Revision: 1.19 $'[11:-2]
from DT_Util import ParseError, parse_params, name_param, str
from DocumentTemplate.DT_Util import ParseError, parse_params, name_param, str
class If:
blockContinuations='else','elif'
......
......@@ -333,13 +333,17 @@ __rcs_id__='$Id$'
__version__='$Revision: 1.62 $'[11:-2]
import sys
from DT_Util import ParseError, parse_params, name_param, str, join_unicode
from DT_Util import render_blocks, InstanceDict, ValidationError, Eval
from DT_Util import simple_name, add_with_prefix
import re
from DT_InSV import sequence_variables, opt
TupleType=type(())
StringTypes = (type(''), type(u''))
from DocumentTemplate.DT_Util import ParseError, parse_params, name_param
from DocumentTemplate.DT_Util import str, join_unicode
from DocumentTemplate.DT_Util import render_blocks, InstanceDict
from DocumentTemplate.DT_Util import ValidationError, Eval
from DocumentTemplate.DT_Util import simple_name, add_with_prefix
from DocumentTemplate.DT_InSV import sequence_variables, opt
TupleType = tuple
StringTypes = (str, unicode)
class InFactory:
blockContinuations=('else',)
......
......@@ -18,12 +18,13 @@ __version__='$Revision: 1.22 $'[11:-2]
from math import sqrt
import re
TupleType=type(())
try:
import Missing
mv=Missing.Value
except: mv=None
TupleType = tuple
class sequence_variables:
......
......@@ -40,10 +40,11 @@
as desired.
'''
from DT_Util import render_blocks, Eval, ParseError
from DT_Util import str # Probably needed due to hysterical pickles.
import re
from DocumentTemplate.DT_Util import render_blocks, Eval, ParseError
from DocumentTemplate.DT_Util import str # Probably needed due to
# hysterical pickles.
class Let:
blockContinuations=()
......
......@@ -27,7 +27,7 @@ __rcs_id__='$Id$'
__version__='$Revision: 1.13 $'[11:-2]
from zExceptions import upgradeException
from DT_Util import parse_params, name_param, render_blocks, str
from DocumentTemplate.DT_Util import parse_params, name_param, render_blocks, str
class InvalidErrorTypeExpression(Exception):
pass
......
......@@ -12,11 +12,7 @@
##############################################################################
__version__='$Revision: 1.9 $'[11:-2]
try:
from DT_Util import parse_params, name_param
except ImportError:
# See PEP-328
from .DT_Util import parse_params, name_param
from DocumentTemplate.DT_Util import parse_params, name_param
class ReturnTag:
name='return'
......
......@@ -16,17 +16,10 @@ import os
import thread
import re
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
from DocumentTemplate.DT_Util import ParseError, InstanceDict
from DocumentTemplate.DT_Util import TemplateDict, render_blocks, str
from DocumentTemplate.DT_Var import Var, Call, Comment
from DocumentTemplate.DT_Return import ReturnTag, DTReturn
_marker = [] # Create a new marker object.
......
......@@ -13,9 +13,9 @@
import sys, traceback
from cStringIO import StringIO
from DT_Util import ParseError, parse_params, render_blocks
from DT_Util import namespace, InstanceDict
from DT_Return import DTReturn
from DocumentTemplate.DT_Util import ParseError, parse_params, render_blocks
from DocumentTemplate.DT_Util import namespace, InstanceDict
from DocumentTemplate.DT_Return import DTReturn
class Try:
"""Zope DTML Exception handling
......
......@@ -15,7 +15,7 @@ __doc__='''Machinery to support through-the-web editing
$Id$'''
__version__='$Revision: 1.15 $'[11:-2]
from DT_HTML import HTML
from DocumentTemplate.DT_HTML import HTML
FactoryDefaultString="Factory Default"
......
......@@ -16,21 +16,12 @@ $Id$"""
import re
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
# for import by other modules, dont remove!
from DocumentTemplate.html_quote import html_quote, ustr
from .cDocumentTemplate import InstanceDict, TemplateDict
from .cDocumentTemplate import render_blocks, safe_callable
from .cDocumentTemplate import join_unicode
from DocumentTemplate.cDocumentTemplate import InstanceDict, TemplateDict
from DocumentTemplate.cDocumentTemplate import render_blocks, safe_callable
from DocumentTemplate.cDocumentTemplate import join_unicode
from RestrictedPython.Guards import safe_builtins
from RestrictedPython.Utilities import utility_builtins
......
......@@ -159,13 +159,9 @@ import string, re, sys
from cgi import escape
from urllib import quote, quote_plus, unquote, unquote_plus
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
# for import by other modules, dont remove!
from DocumentTemplate.html_quote import html_quote
from DocumentTemplate.DT_Util import parse_params, name_param, str, ustr
from Acquisition import aq_base
from ZPublisher.TaintedString import TaintedString
......
......@@ -36,8 +36,10 @@
__rcs_id__='$Id$'
__version__='$Revision: 1.15 $'[11:-2]
from DT_Util import parse_params, name_param, InstanceDict, render_blocks, str
from DT_Util import TemplateDict
from DocumentTemplate.DT_Util import parse_params, name_param
from DocumentTemplate.DT_Util import InstanceDict, render_blocks, str
from DocumentTemplate.DT_Util import TemplateDict
class With:
blockContinuations=()
name='with'
......
# alias module for backwards compatibility
from DT_Util import Eval
from DocumentTemplate.DT_Util import Eval
def careful_mul(env, *factors):
r = 1
......
......@@ -107,14 +107,8 @@ Document Templates may be created 4 ways:
__version__='$Revision: 1.14 $'[11:-2]
ParseError='Document Template Parse Error'
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
from DocumentTemplate.DT_Raise import ParseError
from DocumentTemplate.DT_String import String, File
from DocumentTemplate.DT_HTML import HTML, HTMLFile, HTMLDefault
# import DT_UI # Install HTML editing
......@@ -18,4 +18,5 @@ segregated in a separate package.
$Id$'''
__version__='$Revision: 1.18 $'[11:-2]
from DocumentTemplate import String, File, HTML, HTMLDefault, HTMLFile
from DocumentTemplate.DT_String import String, File
from DocumentTemplate.DT_HTML import HTML, HTMLDefault, HTMLFile
# split off into its own module for aliasing without circrefs
from cgi import escape
from ustr import ustr
from DocumentTemplate.ustr import ustr
def html_quote(v, name='(Unknown name)', md={}):
return escape(ustr(v), 1)
......@@ -20,7 +20,7 @@ __version__='$Revision: 1.42 $'[11:-2]
import sys, types
from types import StringType, UnicodeType, TupleType
from ustr import ustr
from DocumentTemplate.ustr import ustr
import warnings
warnings.warn('pDocumentTemplate is not longer in active use. '
......
......@@ -61,9 +61,10 @@ __version__='$Revision: 1.15 $'[11:-2]
from DocumentTemplate.DT_Util import ParseError, parse_params, name_param
from string import find, split, join, atoi, atof
StringType=type('')
str=__builtins__['str']
StringType = str
str = __builtins__['str']
class SQLVar:
name='sqlvar'
......
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