Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
9a6cedc8
Commit
9a6cedc8
authored
Nov 02, 2005
by
Philipp von Weitershausen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get rid of a deprecation warning by using the new immutable
i18n Messages. Made DummyEngine work with them.
parent
3d0c2bb1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
17 deletions
+6
-17
lib/python/TAL/DummyEngine.py
lib/python/TAL/DummyEngine.py
+3
-14
lib/python/TAL/tests/test_talinterpreter.py
lib/python/TAL/tests/test_talinterpreter.py
+3
-3
No files found.
lib/python/TAL/DummyEngine.py
View file @
9a6cedc8
...
...
@@ -22,17 +22,6 @@ from TALDefs import NAME_RE, TALESError, ErrorInfo
from
ITALES
import
ITALESCompiler
,
ITALESEngine
from
DocumentTemplate.DT_Util
import
ustr
IDomain
=
None
try
:
from
Zope2.I18n.ITranslationService
import
ITranslationService
from
Zope2.I18n.IDomain
import
IDomain
except
ImportError
:
pass
if
IDomain
is
None
:
# Before 2.7, or not in Zope
class
ITranslationService
:
pass
class
IDomain
:
pass
class
_Default
:
pass
Default
=
_Default
()
...
...
@@ -234,7 +223,6 @@ class Iterator:
return 1
class DummyDomain:
__implements__ = IDomain
def translate(self, msgid, mapping=None, context=None,
target_language=None, default=None):
...
...
@@ -246,8 +234,10 @@ class DummyDomain:
# things back together.
# simulate an unknown msgid by returning None
text = msgid
if msgid == "
don
't translate me":
text = default
if default is not None:
text = default
else:
text = msgid.upper()
...
...
@@ -257,7 +247,6 @@ class DummyDomain:
return cre.sub(repl, text)
class DummyTranslationService:
__implements__ = ITranslationService
def translate(self, domain, msgid, mapping=None, context=None,
target_language=None, default=None):
...
...
lib/python/TAL/tests/test_talinterpreter.py
View file @
9a6cedc8
...
...
@@ -28,7 +28,7 @@ from TAL.TALInterpreter import TALInterpreter
from
TAL.DummyEngine
import
DummyEngine
,
DummyTranslationService
from
TAL.TALInterpreter
import
interpolate
from
TAL.tests
import
utils
from
zope.i18nmessageid
import
Message
ID
from
zope.i18nmessageid
import
Message
class
TestCaseBase
(
unittest
.
TestCase
):
...
...
@@ -67,10 +67,10 @@ class I18NCornerTestCase(TestCaseBase):
def
setUp
(
self
):
self
.
engine
=
DummyEngine
()
self
.
engine
.
setLocal
(
'foo'
,
Message
ID
(
'FoOvAlUe'
,
'default'
))
self
.
engine
.
setLocal
(
'foo'
,
Message
(
'FoOvAlUe'
,
'default'
))
self
.
engine
.
setLocal
(
'bar'
,
'BaRvAlUe'
)
self
.
engine
.
setLocal
(
'raw'
,
'
\
t
RaW
\
n
'
)
self
.
engine
.
setLocal
(
'noxlt'
,
Message
ID
(
"don't translate me"
))
self
.
engine
.
setLocal
(
'noxlt'
,
Message
(
"don't translate me"
))
def
_check
(
self
,
program
,
expected
):
result
=
StringIO
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment