Paste number 32286: dateformatter.py in schooltool/skin

Paste number 32286: dateformatter.py in schooltool/skin
Pasted by: jfroche
When:14 years, 9 months ago
Share:Tweet this! | http://paste.lisp.org/+OWU
Channel:#schooltool
Paste contents:
Raw Source | XML | Display As
cat dateformatter.py                                                                                     

from datetime import datetime
from zope.publisher.interfaces import IRequest
from zope.publisher.browser import BrowserView
import zope.component

class DateFormatterFullView( BrowserView ):
    zope.component.adapts(datetime.date, IRequest )

    def __call__(self):
        formatter = self.request.locale.dates.getFormatter('date', 'full')
        return formatter.format(self.context)

class DateFormatterMediumView( BrowserView ):
    zope.component.adapts(datetime.date, IRequest )

    def __call__(self):
        formatter = self.request.locale.dates.getFormatter('date', 'medium')
        return formatter.format(self.context)

class DateFormatterShortView( BrowserView ):
    zope.component.adapts(datetime.date, IRequest )

    def __call__(self):
        formatter = self.request.locale.dates.getFormatter('date', 'short')
        return formatter.format(self.context)

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.