Mercurial > hg > MPIWGWeb
changeset 126:2e2dd6a5ab26
cleanups and fixed getDateString.
author | casties |
---|---|
date | Thu, 30 May 2013 18:44:55 +0200 |
parents | 06d7a5859a20 |
children | 741ddaf604b1 06020bd06a7d |
files | MPIWGRoot.py SrvTxtUtils.py css/mpiwg.css |
diffstat | 3 files changed, 19 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/MPIWGRoot.py Thu May 30 16:12:14 2013 +0200 +++ b/MPIWGRoot.py Thu May 30 18:44:55 2013 +0200 @@ -1,12 +1,10 @@ from Products.PageTemplates.PageTemplateFile import PageTemplateFile from App.ImageFile import ImageFile -from OFS.Image import Image from Globals import package_home import string import os import logging from OFS.Folder import Folder -from AccessControl import ClassSecurityInfo import sys from Products.ZSQLExtend.ZSQLExtend import ZSQLExtendFolder @@ -146,7 +144,7 @@ def getSections(self): """returns a list of all sections i.e. top-level MPIWGFolders""" - items = self.objectValues(spec='MPIWGFolder')[:] + items = self.objectValues(spec='MPIWGFolder') items.sort(key=lambda x:getInt(getattr(x, 'weight', '0'))) return items
--- a/SrvTxtUtils.py Thu May 30 16:12:14 2013 +0200 +++ b/SrvTxtUtils.py Thu May 30 18:44:55 2013 +0200 @@ -13,7 +13,7 @@ import xml.etree.ElementTree as ET -srvTxtUtilsVersion = "1.9" +srvTxtUtilsVersion = "1.9.1" map_months = {'en': [u"", u"January", @@ -122,15 +122,26 @@ def getDateString(date=None, lang='en', withYear=True, abbrev=False): """Return formatted date string.""" ds = None + if callable(date.day): + # callable members + day = date.day() + month = date.month() + year = date.year() + else: + # data members + day = date.day + month = date.month + year = date.year + if lang.lower() == 'en': - ds = "%s, %s"%(getMonthName(date.month(), lang), date.day()) + ds = "%s, %s"%(getMonthName(month, lang), day) if withYear: - ds += " %s"%date.year() + ds += " %s"%year elif lang.lower() == 'de': - ds = "%s.%s."%(date.day(), date.month()) + ds = "%s.%s."%(day, month) if withYear: - ds += " %s"%date.year() + ds += " %s"%year return ds