Commit 70e62e98 authored by Romain Courteaud's avatar Romain Courteaud

Add some helper method in order to display in the UI.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12501 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 24ef9034
...@@ -34,6 +34,7 @@ from Acquisition import aq_base, aq_parent, aq_inner, aq_acquire ...@@ -34,6 +34,7 @@ from Acquisition import aq_base, aq_parent, aq_inner, aq_acquire
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from DateTime import DateTime from DateTime import DateTime
from Products.ERP5Type.DateUtils import addToDate from Products.ERP5Type.DateUtils import addToDate
from Products.ERP5Type.Message import Message
from zLOG import LOG from zLOG import LOG
...@@ -225,9 +226,25 @@ class Periodicity(Base): ...@@ -225,9 +226,25 @@ class Periodicity(Base):
""" """
returns something like ['Sunday','Monday',...] returns something like ['Sunday','Monday',...]
""" """
# XXX Currently, it's not translated in the UI
return DateTime._days return DateTime._days
security.declareProtected(Permissions.View, 'getWeekDayItemList')
def getWeekDayItemList(self):
"""
returns something like [('Sunday', 'Sunday'), ('Monday', 'Monday'),...]
"""
return [(Message(domain='erp5_ui', message=x), x) \
for x in self.getWeekDayList()]
security.declareProtected(Permissions.View, 'getWeekDayItemList')
def getMonthItemList(self):
"""
returns something like [('January', 1), ('February', 2),...]
"""
# DateTime._months return '' as first item
return [(Message(domain='erp5_ui', message=DateTime._months[i]), i) \
for i in range(1, len(DateTime._months))]
# XXX This look like to not works, so override the getter # XXX This look like to not works, so override the getter
# security.declarePrivate('_setPeriodicityWeekDayList') # security.declarePrivate('_setPeriodicityWeekDayList')
# def _setPeriodicityWeekDayList(self,value): # def _setPeriodicityWeekDayList(self,value):
......
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