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

- Cleanup DocumentTemplate module for relative imports

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