[Checkins] SVN: z3ext.formatter/tags/1.2.2/ release tag
Nikolay Kim
fafhrd at datacom.kz
Fri Oct 10 05:26:08 EDT 2008
Log message for revision 91972:
release tag
Changed:
A z3ext.formatter/tags/1.2.2/
D z3ext.formatter/tags/1.2.2/CHANGES.txt
A z3ext.formatter/tags/1.2.2/CHANGES.txt
D z3ext.formatter/tags/1.2.2/buildout.cfg
A z3ext.formatter/tags/1.2.2/buildout.cfg
A z3ext.formatter/tags/1.2.2/i18ncheck.in
D z3ext.formatter/tags/1.2.2/setup.py
A z3ext.formatter/tags/1.2.2/setup.py
D z3ext.formatter/tags/1.2.2/src/z3ext/formatter/configure.zcml
A z3ext.formatter/tags/1.2.2/src/z3ext/formatter/configure.zcml
D z3ext.formatter/tags/1.2.2/src/z3ext/formatter/fancydatetime.py
A z3ext.formatter/tags/1.2.2/src/z3ext/formatter/fancydatetime.py
D z3ext.formatter/tags/1.2.2/src/z3ext/formatter/i18n.py
D z3ext.formatter/tags/1.2.2/src/z3ext/formatter/interfaces.py
A z3ext.formatter/tags/1.2.2/src/z3ext/formatter/interfaces.py
A z3ext.formatter/tags/1.2.2/src/z3ext/formatter/locales/
D z3ext.formatter/tags/1.2.2/src/z3ext/formatter/tests.py
A z3ext.formatter/tags/1.2.2/src/z3ext/formatter/tests.py
D z3ext.formatter/tags/1.2.2/src/z3ext/formatter/vocabulary.py
A z3ext.formatter/tags/1.2.2/src/z3ext/formatter/vocabulary.py
-=-
Copied: z3ext.formatter/tags/1.2.2 (from rev 91965, z3ext.formatter/trunk)
Deleted: z3ext.formatter/tags/1.2.2/CHANGES.txt
===================================================================
--- z3ext.formatter/trunk/CHANGES.txt 2008-10-10 04:08:09 UTC (rev 91965)
+++ z3ext.formatter/tags/1.2.2/CHANGES.txt 2008-10-10 09:26:07 UTC (rev 91972)
@@ -1,42 +0,0 @@
-=======
-CHANGES
-=======
-
-1.2.1 (2008-05-16)
-------------------
-
-- Replace 'autoinclude' with 'includeDependendcies'
-
-
-1.2.0 (2008-03-25)
-------------------
-
-- Use z3c.autoinclude
-
-- Code moved to svn.zope.org
-
-
-1.1.2 (2008-03-06)
-------------------
-
-- Fixed bug in fancyDatetime formatter
-
-
-1.1.1 (2008-02-05)
-------------------
-
-- Added 'Timezones' vocabulary
-
-- Cleanup code
-
-
-1.1.0 (2007-12-21)
-------------------
-
-- Added controlpanel configlet
-
-
-1.0.0 (2007-12-07)
-------------------
-
-- Initial release.
Copied: z3ext.formatter/tags/1.2.2/CHANGES.txt (from rev 91970, z3ext.formatter/trunk/CHANGES.txt)
===================================================================
--- z3ext.formatter/tags/1.2.2/CHANGES.txt (rev 0)
+++ z3ext.formatter/tags/1.2.2/CHANGES.txt 2008-10-10 09:26:07 UTC (rev 91972)
@@ -0,0 +1,48 @@
+=======
+CHANGES
+=======
+
+1.2.2 (2008-10-10)
+------------------
+
+- Use new i18n domain z3ext.formatter
+
+
+1.2.1 (2008-05-16)
+------------------
+
+- Replace 'autoinclude' with 'includeDependendcies'
+
+
+1.2.0 (2008-03-25)
+------------------
+
+- Use z3c.autoinclude
+
+- Code moved to svn.zope.org
+
+
+1.1.2 (2008-03-06)
+------------------
+
+- Fixed bug in fancyDatetime formatter
+
+
+1.1.1 (2008-02-05)
+------------------
+
+- Added 'Timezones' vocabulary
+
+- Cleanup code
+
+
+1.1.0 (2007-12-21)
+------------------
+
+- Added controlpanel configlet
+
+
+1.0.0 (2007-12-07)
+------------------
+
+- Initial release.
Deleted: z3ext.formatter/tags/1.2.2/buildout.cfg
===================================================================
--- z3ext.formatter/trunk/buildout.cfg 2008-10-10 04:08:09 UTC (rev 91965)
+++ z3ext.formatter/tags/1.2.2/buildout.cfg 2008-10-10 09:26:07 UTC (rev 91972)
@@ -1,20 +0,0 @@
-[buildout]
-develop = .
-parts = test coverage-test coverage-report
-
-[test]
-recipe = zc.recipe.testrunner
-eggs = z3ext.formatter [test]
-
-
-[coverage-test]
-recipe = zc.recipe.testrunner
-eggs = z3ext.formatter [test]
-defaults = ['--coverage', '../../coverage']
-
-
-[coverage-report]
-recipe = zc.recipe.egg
-eggs = z3c.coverage
-scripts = coverage=coverage-report
-arguments = ('coverage', 'coverage/report')
Copied: z3ext.formatter/tags/1.2.2/buildout.cfg (from rev 91970, z3ext.formatter/trunk/buildout.cfg)
===================================================================
--- z3ext.formatter/tags/1.2.2/buildout.cfg (rev 0)
+++ z3ext.formatter/tags/1.2.2/buildout.cfg 2008-10-10 09:26:07 UTC (rev 91972)
@@ -0,0 +1,55 @@
+[buildout]
+develop = .
+parts = test coverage-test coverage-report i18n i18ncheck i18ndude
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = z3ext.formatter [test]
+
+
+[coverage-test]
+recipe = zc.recipe.testrunner
+eggs = z3ext.formatter [test]
+defaults = ['--coverage', '../../coverage']
+
+
+[coverage-report]
+recipe = zc.recipe.egg
+eggs = z3c.coverage
+scripts = coverage=coverage-report
+arguments = ('coverage', 'coverage/report')
+
+[i18n]
+recipe = z3c.recipe.i18n:i18n
+packages = z3ext.formatter
+domain = z3ext.formatter
+output = ${buildout:directory}/src/z3ext/formatter/locales
+eggs = z3ext.formatter [test]
+zcml =
+ <configure i18n_domain="zope"
+ xmlns:zcml="http://namespaces.zope.org/zcml"
+ xmlns:browser="http://namespaces.zope.org/browser">
+ <include package="zope.component" file="meta.zcml" />
+ <include package="zope.securitypolicy" file="meta.zcml" />
+ <include package="zope.app.component" file="meta.zcml" />
+ <include package="zope.app.security" file="meta.zcml" />
+ <include package="zope.app.pagetemplate" file="meta.zcml" />
+
+ <include package="zope.securitypolicy" />
+ <include package="zope.app.security" />
+ <include package="zope.app.zcmlfiles" />
+ <include package="zope.app.authentication" />
+
+ <include package="z3c.autoinclude" file="meta.zcml" />
+ <include package="z3ext.formatter" />
+ </configure>
+
+[i18ncheck]
+recipe = buildout_script
+template_dir = ${buildout:directory}/
+template = i18ncheck.in
+
+[i18ndude]
+unzip = true
+recipe = zc.recipe.egg
+eggs = i18ndude
Copied: z3ext.formatter/tags/1.2.2/i18ncheck.in (from rev 91970, z3ext.formatter/trunk/i18ncheck.in)
===================================================================
--- z3ext.formatter/tags/1.2.2/i18ncheck.in (rev 0)
+++ z3ext.formatter/tags/1.2.2/i18ncheck.in 2008-10-10 09:26:07 UTC (rev 91972)
@@ -0,0 +1,4 @@
+#!/bin/sh
+# Startup or shutdown buildbot
+
+bin/i18ndude find-untranslated ./ | grep z3ext.persistentlayout | less
Deleted: z3ext.formatter/tags/1.2.2/setup.py
===================================================================
--- z3ext.formatter/trunk/setup.py 2008-10-10 04:08:09 UTC (rev 91965)
+++ z3ext.formatter/tags/1.2.2/setup.py 2008-10-10 09:26:07 UTC (rev 91972)
@@ -1,76 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2007 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Setup for z3ext.formatter package
-
-$Id$
-"""
-import sys, os
-from setuptools import setup, find_packages
-
-def read(*rnames):
- return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
-
-version = '1.2.2dev'
-
-
-setup(name='z3ext.formatter',
- version=version,
- description="Extensible TALES fomratter expression.",
- long_description=(
- 'Detailed Dcoumentation\n' +
- '======================\n'
- + '\n\n' +
- read('src', 'z3ext', 'formatter', 'README.txt')
- + '\n\n' +
- read('CHANGES.txt')
- ),
- classifiers=[
- 'Development Status :: 5 - Production/Stable',
- 'Environment :: Web Environment',
- 'Intended Audience :: Developers',
- 'License :: OSI Approved :: Zope Public License',
- 'Programming Language :: Python',
- 'Natural Language :: English',
- 'Operating System :: OS Independent',
- 'Topic :: Internet :: WWW/HTTP',
- 'Framework :: Zope3'],
- author='Nikolay Kim',
- author_email='fafhrd91 at gmail.com',
- url='http://z3ext.net/',
- license='ZPL 2.1',
- package_dir = {'':'src'},
- packages=find_packages('src'),
- namespace_packages=['z3ext'],
- install_requires = ['setuptools',
- 'pytz',
- 'zope.component',
- 'zope.interface',
- 'zope.publisher',
- 'zope.schema',
- 'zope.proxy',
- 'zope.tales',
- 'zope.i18nmessageid',
- 'zope.app.appsetup',
- 'zope.app.pagetemplate',
- 'zope.app.publisher',
- 'z3c.autoinclude',
- 'z3ext.controlpanel',
- ],
- extras_require = dict(test=['zope.app.zptpage',
- 'zope.app.testing',
- 'zope.testing',
- ]),
- include_package_data = True,
- zip_safe = False
- )
Copied: z3ext.formatter/tags/1.2.2/setup.py (from rev 91970, z3ext.formatter/trunk/setup.py)
===================================================================
--- z3ext.formatter/tags/1.2.2/setup.py (rev 0)
+++ z3ext.formatter/tags/1.2.2/setup.py 2008-10-10 09:26:07 UTC (rev 91972)
@@ -0,0 +1,78 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Setup for z3ext.formatter package
+
+$Id$
+"""
+import sys, os
+from setuptools import setup, find_packages
+
+def read(*rnames):
+ return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+
+version = '1.2.2'
+
+
+setup(name='z3ext.formatter',
+ version=version,
+ description="Extensible TALES fomratter expression.",
+ long_description=(
+ 'Detailed Dcoumentation\n' +
+ '======================\n'
+ + '\n\n' +
+ read('src', 'z3ext', 'formatter', 'README.txt')
+ + '\n\n' +
+ read('CHANGES.txt')
+ ),
+ classifiers=[
+ 'Development Status :: 5 - Production/Stable',
+ 'Environment :: Web Environment',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: Zope Public License',
+ 'Programming Language :: Python',
+ 'Natural Language :: English',
+ 'Operating System :: OS Independent',
+ 'Topic :: Internet :: WWW/HTTP',
+ 'Framework :: Zope3'],
+ author='Nikolay Kim',
+ author_email='fafhrd91 at gmail.com',
+ url='http://z3ext.net/',
+ license='ZPL 2.1',
+ package_dir = {'':'src'},
+ packages=find_packages('src'),
+ namespace_packages=['z3ext'],
+ install_requires = ['setuptools',
+ 'pytz',
+ 'zope.component',
+ 'zope.interface',
+ 'zope.publisher',
+ 'zope.schema',
+ 'zope.proxy',
+ 'zope.tales',
+ 'zope.i18n',
+ 'zope.i18nmessageid',
+ 'zope.app.appsetup',
+ 'zope.app.pagetemplate',
+ 'zope.app.publisher',
+ 'z3c.autoinclude',
+ 'z3ext.controlpanel',
+ ],
+ extras_require = dict(test=['zope.app.zptpage',
+ 'zope.app.testing',
+ 'zope.testing',
+ 'z3ext.controlpanel [test]',
+ ]),
+ include_package_data = True,
+ zip_safe = False
+ )
Deleted: z3ext.formatter/tags/1.2.2/src/z3ext/formatter/configure.zcml
===================================================================
--- z3ext.formatter/trunk/src/z3ext/formatter/configure.zcml 2008-10-10 04:08:09 UTC (rev 91965)
+++ z3ext.formatter/tags/1.2.2/src/z3ext/formatter/configure.zcml 2008-10-10 09:26:07 UTC (rev 91972)
@@ -1,57 +0,0 @@
-<configure
- xmlns="http://namespaces.zope.org/zope"
- xmlns:z3ext="http://namespaces.zope.org/z3ext"
- xmlns:tales="http://namespaces.zope.org/tales"
- xmlns:browser="http://namespaces.zope.org/browser"
- i18n_domain="z3ext">
-
- <includeDependencies package="z3ext.formatter" />
-
- <!-- zope.conf configuration -->
- <subscriber handler=".config.initFormatter" />
-
- <!-- formatter: tales expresison -->
- <tales:expressiontype
- name="formatter"
- handler=".expression.FormatterExpression" />
-
- <!-- formatters -->
- <adapter name="date" factory=".dformatter.DateFormatterFactory" />
- <adapter name="dateTime" factory=".dtformatter.DatetimeFormatterFactory" />
- <adapter name="fancyDatetime"
- factory=".fancydatetime.FancyDatetimeFormatterFactory" />
-
- <!-- formatter configlet -->
- <z3ext:configlet
- name="system.formatter"
- schema=".interfaces.IFormatterConfiglet"
- title="Portal formatters"
- description="Configure portal formatters.">
- <allow interface=".interfaces.IFormatterConfiglet" />
- </z3ext:configlet>
-
- <browser:icon
- name="zmi_icon"
- for=".interfaces.IFormatterConfiglet"
- file="preferences-formatter.png" />
-
- <!-- vocabularies -->
- <utility
- name="Timezones"
- factory=".vocabulary.Timezones" />
-
- <!-- Registering documentation with API doc -->
- <configure
- xmlns:apidoc="http://namespaces.zope.org/apidoc"
- xmlns:zcml="http://namespaces.zope.org/zcml"
- zcml:condition="have apidoc">
-
- <apidoc:bookchapter
- id="z3ext-formatter"
- title="z3ext.formatter - formatter TALES expression"
- doc_path="README.txt"
- parent="z3ext" />
-
- </configure>
-
-</configure>
Copied: z3ext.formatter/tags/1.2.2/src/z3ext/formatter/configure.zcml (from rev 91970, z3ext.formatter/trunk/src/z3ext/formatter/configure.zcml)
===================================================================
--- z3ext.formatter/tags/1.2.2/src/z3ext/formatter/configure.zcml (rev 0)
+++ z3ext.formatter/tags/1.2.2/src/z3ext/formatter/configure.zcml 2008-10-10 09:26:07 UTC (rev 91972)
@@ -0,0 +1,61 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:i18n="http://namespaces.zope.org/i18n"
+ xmlns:z3ext="http://namespaces.zope.org/z3ext"
+ xmlns:tales="http://namespaces.zope.org/tales"
+ xmlns:browser="http://namespaces.zope.org/browser"
+ i18n_domain="z3ext.formatter">
+
+ <includeDependencies package="z3ext.formatter" />
+
+ <!-- zope.conf configuration -->
+ <subscriber handler=".config.initFormatter" />
+
+ <!-- formatter: tales expresison -->
+ <tales:expressiontype
+ name="formatter"
+ handler=".expression.FormatterExpression" />
+
+ <!-- formatters -->
+ <adapter name="date" factory=".dformatter.DateFormatterFactory" />
+ <adapter name="dateTime" factory=".dtformatter.DatetimeFormatterFactory" />
+ <adapter name="fancyDatetime"
+ factory=".fancydatetime.FancyDatetimeFormatterFactory" />
+
+ <!-- formatter configlet -->
+ <z3ext:configlet
+ name="system.formatter"
+ schema=".interfaces.IFormatterConfiglet"
+ title="Portal formatters"
+ description="Configure portal formatters.">
+ <allow interface=".interfaces.IFormatterConfiglet" />
+ </z3ext:configlet>
+
+ <browser:icon
+ name="zmi_icon"
+ for=".interfaces.IFormatterConfiglet"
+ file="preferences-formatter.png" />
+
+ <!-- vocabularies -->
+ <utility
+ name="Timezones"
+ factory=".vocabulary.Timezones" />
+
+ <!-- Registering documentation with API doc -->
+ <configure
+ xmlns:apidoc="http://namespaces.zope.org/apidoc"
+ xmlns:zcml="http://namespaces.zope.org/zcml"
+ zcml:condition="have apidoc">
+
+ <apidoc:bookchapter
+ id="z3ext-formatter"
+ title="z3ext.formatter - formatter TALES expression"
+ doc_path="README.txt"
+ parent="z3ext" />
+
+ </configure>
+
+ <!-- translations -->
+ <i18n:registerTranslations directory="locales"/>
+
+</configure>
Deleted: z3ext.formatter/tags/1.2.2/src/z3ext/formatter/fancydatetime.py
===================================================================
--- z3ext.formatter/trunk/src/z3ext/formatter/fancydatetime.py 2008-10-10 04:08:09 UTC (rev 91965)
+++ z3ext.formatter/tags/1.2.2/src/z3ext/formatter/fancydatetime.py 2008-10-10 09:26:07 UTC (rev 91972)
@@ -1,100 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2007 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-""" ``fancyDatetime`` formatter implementation
-
-$Id$
-"""
-
-from pytz import utc, timezone
-from datetime import datetime
-from zope import interface, component
-from zope.component import getUtility
-from zope.interface.common.idatetime import ITZInfo
-from zope.publisher.interfaces.http import IHTTPRequest
-
-from i18n import _
-from interfaces import IFormatter, IFormatterFactory, IFormatterConfiglet
-
-
-class FancyDatetimeFormatter(object):
- interface.implements(IFormatter)
-
- def __init__(self, request, *args):
- try:
- self.tp = args[0]
- except:
- self.tp = 'medium'
-
- self.request = request
- self.formatter = request.locale.dates.getFormatter('dateTime', self.tp)
-
- def format(self, value):
- formatter = self.formatter
-
- configlet = getUtility(IFormatterConfiglet)
- tz = None
- if configlet.principalTimezone:
- tz = ITZInfo(self.request.principal, None)
-
- if tz is None:
- tz = timezone(configlet.timezone)
-
- if value.tzinfo is None:
- value = datetime(value.year, value.month, value.day, value.hour,
- value.minute, value.second, value.microsecond, utc)
-
- value = value.astimezone(tz)
-
- timezoneFormat = configlet.timezoneFormat
-
- d1 = datetime.now(utc).date()
- d2 = value.astimezone(utc).date()
-
- delta = d1 - d2
-
- if delta.days == 0:
- pattern = formatter.getPattern()
- pos = pattern.find('h')
- if pos < 0:
- pos = pattern.find('H')
-
- formatter.setPattern("'%s '"%_(u'Today at') + pattern[pos:])
-
- if delta.days == 1:
- pattern = formatter.getPattern()
- pos = pattern.find('h')
- if pos < 0:
- pos = pattern.find('H')
-
- formatter.setPattern("'%s '"%_(u'Yesterday at') + pattern[pos:])
-
- if timezoneFormat == 3:
- if self.tp in ('full',):
- formatter.setPattern(
- formatter.getPattern().replace('z', '').strip())
- formatted = formatter.format(value)
- return u'%s %s'%(formatted, tz.zone)
-
- return formatter.format(value)
-
-
-class FancyDatetimeFormatterFactory(object):
- component.adapts(IHTTPRequest)
- interface.implements(IFormatterFactory)
-
- def __init__(self, request):
- self.request = request
-
- def __call__(self, *args, **kw):
- return FancyDatetimeFormatter(self.request, *args)
Copied: z3ext.formatter/tags/1.2.2/src/z3ext/formatter/fancydatetime.py (from rev 91970, z3ext.formatter/trunk/src/z3ext/formatter/fancydatetime.py)
===================================================================
--- z3ext.formatter/tags/1.2.2/src/z3ext/formatter/fancydatetime.py (rev 0)
+++ z3ext.formatter/tags/1.2.2/src/z3ext/formatter/fancydatetime.py 2008-10-10 09:26:07 UTC (rev 91972)
@@ -0,0 +1,99 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" ``fancyDatetime`` formatter implementation
+
+$Id$
+"""
+
+from pytz import utc, timezone
+from datetime import datetime
+from zope import interface, component
+from zope.component import getUtility
+from zope.interface.common.idatetime import ITZInfo
+from zope.publisher.interfaces.http import IHTTPRequest
+
+from interfaces import _, IFormatter, IFormatterFactory, IFormatterConfiglet
+
+
+class FancyDatetimeFormatter(object):
+ interface.implements(IFormatter)
+
+ def __init__(self, request, *args):
+ try:
+ self.tp = args[0]
+ except:
+ self.tp = 'medium'
+
+ self.request = request
+ self.formatter = request.locale.dates.getFormatter('dateTime', self.tp)
+
+ def format(self, value):
+ formatter = self.formatter
+
+ configlet = getUtility(IFormatterConfiglet)
+ tz = None
+ if configlet.principalTimezone:
+ tz = ITZInfo(self.request.principal, None)
+
+ if tz is None:
+ tz = timezone(configlet.timezone)
+
+ if value.tzinfo is None:
+ value = datetime(value.year, value.month, value.day, value.hour,
+ value.minute, value.second, value.microsecond, utc)
+
+ value = value.astimezone(tz)
+
+ timezoneFormat = configlet.timezoneFormat
+
+ d1 = datetime.now(utc).date()
+ d2 = value.astimezone(utc).date()
+
+ delta = d1 - d2
+
+ if delta.days == 0:
+ pattern = formatter.getPattern()
+ pos = pattern.find('h')
+ if pos < 0:
+ pos = pattern.find('H')
+
+ formatter.setPattern("'%s '"%_(u'Today at') + pattern[pos:])
+
+ if delta.days == 1:
+ pattern = formatter.getPattern()
+ pos = pattern.find('h')
+ if pos < 0:
+ pos = pattern.find('H')
+
+ formatter.setPattern("'%s '"%_(u'Yesterday at') + pattern[pos:])
+
+ if timezoneFormat == 3:
+ if self.tp in ('full',):
+ formatter.setPattern(
+ formatter.getPattern().replace('z', '').strip())
+ formatted = formatter.format(value)
+ return u'%s %s'%(formatted, tz.zone)
+
+ return formatter.format(value)
+
+
+class FancyDatetimeFormatterFactory(object):
+ component.adapts(IHTTPRequest)
+ interface.implements(IFormatterFactory)
+
+ def __init__(self, request):
+ self.request = request
+
+ def __call__(self, *args, **kw):
+ return FancyDatetimeFormatter(self.request, *args)
Deleted: z3ext.formatter/tags/1.2.2/src/z3ext/formatter/i18n.py
===================================================================
--- z3ext.formatter/trunk/src/z3ext/formatter/i18n.py 2008-10-10 04:08:09 UTC (rev 91965)
+++ z3ext.formatter/tags/1.2.2/src/z3ext/formatter/i18n.py 2008-10-10 09:26:07 UTC (rev 91972)
@@ -1,19 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2007 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-""" i18n
-
-$Id$
-"""
-from zope.i18nmessageid import MessageFactory
-_ = MessageFactory('z3ext')
Deleted: z3ext.formatter/tags/1.2.2/src/z3ext/formatter/interfaces.py
===================================================================
--- z3ext.formatter/trunk/src/z3ext/formatter/interfaces.py 2008-10-10 04:08:09 UTC (rev 91965)
+++ z3ext.formatter/tags/1.2.2/src/z3ext/formatter/interfaces.py 2008-10-10 09:26:07 UTC (rev 91972)
@@ -1,65 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2007 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-""" z3ext.formatter interfaces
-
-$Id$
-"""
-import vocabulary
-from zope import schema, interface
-
-from i18n import _
-
-
-class FormatterNotDefined(Exception):
- """ """
-
-class FormatterExpressionError(Exception):
- """ """
-
-
-class IFormatterConfiglet(interface.Interface):
-
- timezone = schema.Choice(
- title = _(u'Timezone'),
- description = _(u'Portal timezone.'),
- default = 'US/Pacific',
- vocabulary = vocabulary.timezones,
- required = False)
-
- timezoneFormat = schema.Choice(
- title = _(u'Timezone format'),
- description = _(u'Timezone format'),
- default = 3,
- vocabulary = vocabulary.timezonesOptions,
- required = False)
-
- principalTimezone = schema.Bool(
- title = _(u'Use principal timezone'),
- description = _(u'Render datetime with user selected timezone.'),
- default = True,
- required = False)
-
-
-class IFormatterFactory(interface.Interface):
- """ formatter factory """
-
- def __call__(*args):
- """ create formatter """
-
-
-class IFormatter(interface.Interface):
- """ locale formatter """
-
- def format(value):
- """ format value """
Copied: z3ext.formatter/tags/1.2.2/src/z3ext/formatter/interfaces.py (from rev 91970, z3ext.formatter/trunk/src/z3ext/formatter/interfaces.py)
===================================================================
--- z3ext.formatter/tags/1.2.2/src/z3ext/formatter/interfaces.py (rev 0)
+++ z3ext.formatter/tags/1.2.2/src/z3ext/formatter/interfaces.py 2008-10-10 09:26:07 UTC (rev 91972)
@@ -0,0 +1,66 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" z3ext.formatter interfaces
+
+$Id$
+"""
+import vocabulary
+from zope import schema, interface
+from zope.i18nmessageid import MessageFactory
+
+_ = MessageFactory('z3ext.formatter')
+
+
+class FormatterNotDefined(Exception):
+ """ """
+
+class FormatterExpressionError(Exception):
+ """ """
+
+
+class IFormatterConfiglet(interface.Interface):
+
+ timezone = schema.Choice(
+ title = _(u'Timezone'),
+ description = _(u'Portal timezone.'),
+ default = 'US/Pacific',
+ vocabulary = vocabulary.timezones,
+ required = False)
+
+ timezoneFormat = schema.Choice(
+ title = _(u'Timezone format'),
+ description = _(u'Timezone format'),
+ default = 3,
+ vocabulary = vocabulary.timezonesOptions,
+ required = False)
+
+ principalTimezone = schema.Bool(
+ title = _(u'Use principal timezone'),
+ description = _(u'Render datetime with user selected timezone.'),
+ default = True,
+ required = False)
+
+
+class IFormatterFactory(interface.Interface):
+ """ formatter factory """
+
+ def __call__(*args):
+ """ create formatter """
+
+
+class IFormatter(interface.Interface):
+ """ locale formatter """
+
+ def format(value):
+ """ format value """
Copied: z3ext.formatter/tags/1.2.2/src/z3ext/formatter/locales (from rev 91970, z3ext.formatter/trunk/src/z3ext/formatter/locales)
Deleted: z3ext.formatter/tags/1.2.2/src/z3ext/formatter/tests.py
===================================================================
--- z3ext.formatter/trunk/src/z3ext/formatter/tests.py 2008-10-10 04:08:09 UTC (rev 91965)
+++ z3ext.formatter/tags/1.2.2/src/z3ext/formatter/tests.py 2008-10-10 09:26:07 UTC (rev 91972)
@@ -1,62 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2007 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-""" z3ext.formatter tests
-
-$Id$
-"""
-__docformat__ = "reStructuredText"
-
-import unittest, doctest
-from zope import interface, schema
-from zope.component import provideAdapter
-from zope.testing.cleanup import cleanUp
-from zope.app.testing import setup
-
-from zope.app.pagetemplate.engine import Engine, TrustedEngine
-from zope.app.pagetemplate.metaconfigure import clear
-
-from z3ext.controlpanel.testing import setUpControlPanel
-
-from z3ext.formatter import dformatter, dtformatter, fancydatetime
-from z3ext.formatter.expression import FormatterExpression
-
-
-def setUp(test):
- setup.placelessSetUp(True)
- setup.setUpTraversal()
- setUpControlPanel()
-
- Engine.registerType(u'formatter', FormatterExpression)
- TrustedEngine.registerType(u'formatter', FormatterExpression)
-
- provideAdapter(dformatter.DateFormatterFactory, name='date')
- provideAdapter(dtformatter.DatetimeFormatterFactory, name='dateTime')
- provideAdapter(
- fancydatetime.FancyDatetimeFormatterFactory, name='fancyDatetime')
-
-
-def tearDown(test):
- setup.placelessTearDown()
- clear()
-
-
-def test_suite():
- return unittest.TestSuite((
- doctest.DocFileSuite(
- 'README.txt',
- setUp=setUp, tearDown=tearDown,
- optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS),
- doctest.DocFileSuite(
- 'config.txt', setUp=setUp, tearDown=tearDown),
- ))
Copied: z3ext.formatter/tags/1.2.2/src/z3ext/formatter/tests.py (from rev 91970, z3ext.formatter/trunk/src/z3ext/formatter/tests.py)
===================================================================
--- z3ext.formatter/tags/1.2.2/src/z3ext/formatter/tests.py (rev 0)
+++ z3ext.formatter/tags/1.2.2/src/z3ext/formatter/tests.py 2008-10-10 09:26:07 UTC (rev 91972)
@@ -0,0 +1,62 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" z3ext.formatter tests
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+import unittest, doctest
+from zope import interface, schema
+from zope.component import provideAdapter
+from zope.testing.cleanup import cleanUp
+from zope.app.testing import setup
+
+from zope.app.pagetemplate.engine import Engine, TrustedEngine
+from zope.app.pagetemplate.metaconfigure import clear
+
+from z3ext.controlpanel.testing import setUpControlPanel
+
+from z3ext.formatter import dformatter, dtformatter, fancydatetime
+from z3ext.formatter.expression import FormatterExpression
+
+
+def setUp(test):
+ setup.placefulSetUp(True)
+ setup.setUpTraversal()
+ setUpControlPanel()
+
+ Engine.registerType(u'formatter', FormatterExpression)
+ TrustedEngine.registerType(u'formatter', FormatterExpression)
+
+ provideAdapter(dformatter.DateFormatterFactory, name='date')
+ provideAdapter(dtformatter.DatetimeFormatterFactory, name='dateTime')
+ provideAdapter(
+ fancydatetime.FancyDatetimeFormatterFactory, name='fancyDatetime')
+
+
+def tearDown(test):
+ setup.placelessTearDown()
+ clear()
+
+
+def test_suite():
+ return unittest.TestSuite((
+ doctest.DocFileSuite(
+ 'README.txt',
+ setUp=setUp, tearDown=tearDown,
+ optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS),
+ doctest.DocFileSuite(
+ 'config.txt', setUp=setUp, tearDown=tearDown),
+ ))
Deleted: z3ext.formatter/tags/1.2.2/src/z3ext/formatter/vocabulary.py
===================================================================
--- z3ext.formatter/trunk/src/z3ext/formatter/vocabulary.py 2008-10-10 04:08:09 UTC (rev 91965)
+++ z3ext.formatter/tags/1.2.2/src/z3ext/formatter/vocabulary.py 2008-10-10 09:26:07 UTC (rev 91972)
@@ -1,39 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2007 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-""" vocabularies
-
-$Id$
-"""
-import pytz
-from zope import interface
-from zope.schema.interfaces import IVocabularyFactory
-from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary
-
-from i18n import _
-
-
-timezonesOptions = SimpleVocabulary(
- [SimpleTerm(1, '1', _(u'No timezone')),
- SimpleTerm(2, '2', _(u'Number of hours')),
- SimpleTerm(3, '3', _(u'Timezone name'))])
-
-timezones = SimpleVocabulary(
- [SimpleTerm(unicode(tz), tz, unicode(tz)) for tz in pytz.common_timezones])
-
-
-class Timezones(object):
- interface.implements(IVocabularyFactory)
-
- def __call__(self, context):
- return timezones
Copied: z3ext.formatter/tags/1.2.2/src/z3ext/formatter/vocabulary.py (from rev 91970, z3ext.formatter/trunk/src/z3ext/formatter/vocabulary.py)
===================================================================
--- z3ext.formatter/tags/1.2.2/src/z3ext/formatter/vocabulary.py (rev 0)
+++ z3ext.formatter/tags/1.2.2/src/z3ext/formatter/vocabulary.py 2008-10-10 09:26:07 UTC (rev 91972)
@@ -0,0 +1,40 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" vocabularies
+
+$Id$
+"""
+import pytz
+from zope import interface
+from zope.schema.interfaces import IVocabularyFactory
+from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary
+from zope.i18nmessageid import MessageFactory
+
+_ = MessageFactory('z3ext.formatter')
+
+
+timezonesOptions = SimpleVocabulary(
+ [SimpleTerm(1, '1', _(u'No timezone')),
+ SimpleTerm(2, '2', _(u'Number of hours')),
+ SimpleTerm(3, '3', _(u'Timezone name'))])
+
+timezones = SimpleVocabulary(
+ [SimpleTerm(unicode(tz), tz, unicode(tz)) for tz in pytz.common_timezones])
+
+
+class Timezones(object):
+ interface.implements(IVocabularyFactory)
+
+ def __call__(self, context):
+ return timezones
More information about the Checkins
mailing list