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
8e4a6017
Commit
8e4a6017
authored
May 21, 2006
by
Philipp von Weitershausen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make ZopeContext.translate()'s signature actually comply with ITALExpressionContext.
Some docstring fixes.
parent
bd66f671
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
16 deletions
+10
-16
lib/python/Products/PageTemplates/Expressions.py
lib/python/Products/PageTemplates/Expressions.py
+10
-16
No files found.
lib/python/Products/PageTemplates/Expressions.py
View file @
8e4a6017
...
@@ -42,9 +42,8 @@ zope.deprecation.deprecated(
...
@@ -42,9 +42,8 @@ zope.deprecation.deprecated(
)
)
def
boboTraverseAwareSimpleTraverse
(
object
,
path_items
,
econtext
):
def
boboTraverseAwareSimpleTraverse
(
object
,
path_items
,
econtext
):
""" a slightly modified version of zope.tales.expressions.simpleTraverse()
"""A slightly modified version of zope.tales.expressions.simpleTraverse
that interacts correctly with objects implementing bobo_traverse().
that interacts correctly with objects requiring."""
"""
request
=
getattr
(
econtext
,
'request'
,
None
)
request
=
getattr
(
econtext
,
'request'
,
None
)
path_items
=
list
(
path_items
)
path_items
=
list
(
path_items
)
path_items
.
reverse
()
path_items
.
reverse
()
...
@@ -56,13 +55,12 @@ def boboTraverseAwareSimpleTraverse(object, path_items, econtext):
...
@@ -56,13 +55,12 @@ def boboTraverseAwareSimpleTraverse(object, path_items, econtext):
object
=
object
.
restrictedTraverse
(
name
)
object
=
object
.
restrictedTraverse
(
name
)
except
(
NotFound
,
Unauthorized
),
e
:
except
(
NotFound
,
Unauthorized
),
e
:
# OFS.Traversable.restrictedTraverse spits out
# OFS.Traversable.restrictedTraverse spits out
# NotFound or Unauthorized (the Zope 2 version) which
# NotFound or Unauthorized (the Zope 2 version
s
) which
# Zope 3's ZPT implementation obviously doesn't know
# Zope 3's ZPT implementation obviously doesn't know
# as an exception indicating failed traversal.
# as exceptions indicating failed traversal. Perhaps
# Perhaps Zope 2's NotFound should be made to extend
# the Zope 2's versions should be replaced with their
# LookupError at some point (or it should just be
# Zope 3 equivalent at some point. For the time
# replaced with Zope 3's version). For the time
# being, however, we simply convert them into
# being, however, we simply converting NotFounds into
# LookupErrors:
# LookupErrors:
raise
LookupError
(
*
e
.
args
)
raise
LookupError
(
*
e
.
args
)
else
:
else
:
...
@@ -71,7 +69,6 @@ def boboTraverseAwareSimpleTraverse(object, path_items, econtext):
...
@@ -71,7 +69,6 @@ def boboTraverseAwareSimpleTraverse(object, path_items, econtext):
return
object
return
object
class
ZopePathExpr
(
PathExpr
):
class
ZopePathExpr
(
PathExpr
):
"""Zope2-aware path expression implementation"""
def
__init__
(
self
,
name
,
expr
,
engine
):
def
__init__
(
self
,
name
,
expr
,
engine
):
super
(
ZopePathExpr
,
self
).
__init__
(
name
,
expr
,
engine
,
super
(
ZopePathExpr
,
self
).
__init__
(
name
,
expr
,
engine
,
...
@@ -79,15 +76,12 @@ class ZopePathExpr(PathExpr):
...
@@ -79,15 +76,12 @@ class ZopePathExpr(PathExpr):
class
ZopeContext
(
Context
):
class
ZopeContext
(
Context
):
def
translate
(
self
,
msgid
,
domain
,
mapping
=
None
,
def
translate
(
self
,
msgid
,
domain
=
None
,
mapping
=
None
,
default
=
None
):
context
=
None
,
target_language
=
None
,
default
=
None
):
context
=
self
.
contexts
.
get
(
'context'
)
if
context
is
None
:
context
=
self
.
contexts
.
get
(
'context'
)
return
getGlobalTranslationService
().
translate
(
return
getGlobalTranslationService
().
translate
(
domain
,
msgid
,
mapping
=
mapping
,
domain
,
msgid
,
mapping
=
mapping
,
context
=
context
,
context
=
context
,
default
=
default
,
default
=
default
)
target_language
=
target_language
)
class
ZopeEngine
(
ExpressionEngine
):
class
ZopeEngine
(
ExpressionEngine
):
...
...
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