Commit 7d89665a authored by Jérome Perrin's avatar Jérome Perrin

deprecate accessors for getting the translated workflow state ID.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24769 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6b41cddc
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.ERP5Type.PsycoWrapper import psyco from Products.ERP5Type.PsycoWrapper import psyco
from Base import Getter as BaseGetter, Setter as BaseSetter from Base import Getter as BaseGetter, Setter as BaseSetter
from warnings import warn
# Creation of default constructor # Creation of default constructor
class func_code: pass class func_code: pass
...@@ -84,9 +86,7 @@ class TitleGetter(BaseGetter): ...@@ -84,9 +86,7 @@ class TitleGetter(BaseGetter):
psyco.bind(__call__) psyco.bind(__call__)
class TranslatedGetter(Getter): class TranslatedGetter(Getter):
""" """ returns the workflow state ID transated. DEPRECATED
Gets a translated attribute value. A default value can be
provided if needed
""" """
def __call__(self, instance): def __call__(self, instance):
...@@ -94,6 +94,8 @@ class TranslatedGetter(Getter): ...@@ -94,6 +94,8 @@ class TranslatedGetter(Getter):
localizer = getToolByName(instance, 'Localizer') localizer = getToolByName(instance, 'Localizer')
wf = portal_workflow.getWorkflowById(self._key) wf = portal_workflow.getWorkflowById(self._key)
state_id = wf._getWorkflowStateOf(instance, id_only=1) state_id = wf._getWorkflowStateOf(instance, id_only=1)
warn('Translated workflow state getters, such as %s are deprecated' %
self._id, DeprecationWarning)
return localizer.erp5_ui.gettext(state_id).encode('utf8') return localizer.erp5_ui.gettext(state_id).encode('utf8')
psyco.bind(__call__) psyco.bind(__call__)
......
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