Commit 92c6f1f0 authored by Kevin Deldycke's avatar Kevin Deldycke

Make Template() method working with python 2.3


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5274 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a15ab206
...@@ -546,8 +546,17 @@ class ListBoxWidget(Widget.Widget): ...@@ -546,8 +546,17 @@ class ListBoxWidget(Widget.Widget):
list_action += '&reset=1' list_action += '&reset=1'
object_list = [] object_list = []
# This translate() method has the same prototype as the one defined ##################
# in Translation Service, but use Localizer. # This translate() method is a binding between Translation Service product
# and Localizer. It has the same prototype as the one defined in Translation
# Service, but use Localizer.
##################
# Template() is a new method of python 2.4, that's why we have the string.py
# file in ERP5Form.
try:
from string import Template
except ImportError:
from Products.ERP5Form.string import Template
global localizer, msg_catalog_binding global localizer, msg_catalog_binding
localizer = portal_object.Localizer localizer = portal_object.Localizer
msg_catalog_binding = { "ui" : "erp5_ui" msg_catalog_binding = { "ui" : "erp5_ui"
...@@ -570,7 +579,7 @@ class ListBoxWidget(Widget.Widget): ...@@ -570,7 +579,7 @@ class ListBoxWidget(Widget.Widget):
, default = default , default = default
) )
if type(mapping) is type({}): if type(mapping) is type({}):
return string.Template(translated_str).substitute(mapping) return Template(translated_str).substitute(mapping)
return translated_str return translated_str
# Make sure list_result_item is defined # Make sure list_result_item is defined
......
This diff is collapsed.
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