[Checkins] SVN: z3ext.formatter/trunk/ update tests
Nikolay Kim
fafhrd at datacom.kz
Sat Nov 22 14:16:07 EST 2008
Log message for revision 93261:
update tests
Changed:
U z3ext.formatter/trunk/CHANGES.txt
U z3ext.formatter/trunk/src/z3ext/formatter/README.txt
-=-
Modified: z3ext.formatter/trunk/CHANGES.txt
===================================================================
--- z3ext.formatter/trunk/CHANGES.txt 2008-11-22 13:41:02 UTC (rev 93260)
+++ z3ext.formatter/trunk/CHANGES.txt 2008-11-22 19:16:07 UTC (rev 93261)
@@ -2,7 +2,7 @@
CHANGES
=======
-1.2.5 (2008-??-??)
+1.2.5 (2008-11-??)
------------------
- z3ext.controlpanel is optional
Modified: z3ext.formatter/trunk/src/z3ext/formatter/README.txt
===================================================================
--- z3ext.formatter/trunk/src/z3ext/formatter/README.txt 2008-11-22 13:41:02 UTC (rev 93260)
+++ z3ext.formatter/trunk/src/z3ext/formatter/README.txt 2008-11-22 19:16:07 UTC (rev 93261)
@@ -93,7 +93,6 @@
By default we use UTC timezone for output:
>>> print page.render(request, now=dt)
- <BLANKLINE>
<html>
<body>
1/1/07 12:00 AM
@@ -103,12 +102,11 @@
Jan 1, 2007 12:00:00 AM
</body>
</html>
- <BLANKLINE>
+
If datetime object doesn't contain timezone information, UTC is used
>>> print page.render(request, now=datetime(2007, 1, 1, 0, 0))
- <BLANKLINE>
<html>
<body>
1/1/07 12:00 AM
@@ -118,7 +116,6 @@
Jan 1, 2007 12:00:00 AM
</body>
</html>
- <BLANKLINE>
Now let's chane timezone to US/Pacific, we change only time zone
@@ -127,7 +124,6 @@
>>> configlet.timezone = 'US/Pacific'
>>> print page.render(request, now=dt)
- <BLANKLINE>
<html>
<body>
12/31/06 4:00 PM
@@ -137,14 +133,13 @@
Dec 31, 2006 4:00:00 PM
</body>
</html>
- <BLANKLINE>
+
Now we can change timezone format to 3 (Timezone name)
>>> configlet.timezoneFormat = 3
>>> print page.render(request, now=dt)
- <BLANKLINE>
<html>
<body>
12/31/06 4:00 PM
@@ -154,8 +149,8 @@
Dec 31, 2006 4:00:00 PM US/Pacific
</body>
</html>
- <BLANKLINE>
+
We also can redefine timezone for principal if we use principalTimezone true
>>> from pytz import timezone
@@ -181,7 +176,6 @@
>>> request.setPrincipal(Principal('user1'))
>>> print page.render(request, now=dt)
- <BLANKLINE>
<html>
<body>
1/1/07 1:00 AM
@@ -191,11 +185,9 @@
Jan 1, 2007 1:00:00 AM Europe/Paris
</body>
</html>
- <BLANKLINE>
>>> request.setPrincipal(Principal('user2'))
>>> print page.render(request, now=dt)
- <BLANKLINE>
<html>
<body>
1/1/07 6:00 AM
@@ -205,7 +197,6 @@
Jan 1, 2007 6:00:00 AM Asia/Almaty
</body>
</html>
- <BLANKLINE>
>>> request.setPrincipal(None)
@@ -232,16 +223,14 @@
>>> today = now - timedelta(hours=1)
>>> print fpage.render(request, now=today)
- <BLANKLINE>
<html>
<body>
Today at ...
Today at ...
Today at ...
- Today at ... US/Pacific
+ Today at ...
</body>
</html>
- <BLANKLINE>
Yesterday's datetime
@@ -249,31 +238,28 @@
>>> yesterday = now - timedelta(hours=25)
>>> print fpage.render(request, now=yesterday)
- <BLANKLINE>
<html>
<body>
Yesterday at ...
Yesterday at ...
Yesterday at ...
- Yesterday at ... US/Pacific
+ Yesterday at ...
</body>
</html>
- <BLANKLINE>
+
Default timezone is UTC
- >>> now = datetime.now()
+ >>> now = datetime.now(UTC)
>>> print fpage.render(request, now=now)
- <BLANKLINE>
<html>
<body>
Today at ...
Today at ...
Today at ...
- Today at ... US/Pacific
+ Today at ...
</body>
</html>
- <BLANKLINE>
Date formatter
@@ -293,14 +279,12 @@
datetime.date(2007, 1, 1)
>>> print datepage.render(request, today=d)
- <BLANKLINE>
<html>
<body>
Jan 1, 2007
1/1/07
</body>
</html>
- <BLANKLINE>
Also you can get formatter from python code
@@ -392,7 +376,5 @@
... </tal:block>''')
>>> print page.render(request)
- <BLANKLINE>
121.04 $
121.04 Eur
- <BLANKLINE>
More information about the Checkins
mailing list