head	1.4;
access;
symbols
	RELEASE_8_3_0:1.3
	RELEASE_9_0_0:1.3
	RELEASE_7_4_0:1.3
	RELEASE_8_2_0:1.3
	RELEASE_6_EOL:1.3
	RELEASE_8_1_0:1.3
	RELEASE_7_3_0:1.3
	RELEASE_8_0_0:1.3
	RELEASE_7_2_0:1.1;
locks; strict;
comment	@# @;


1.4
date	2012.07.16.17.04.29;	author rm;	state dead;
branches;
next	1.3;

1.3
date	2009.06.22.18.09.48;	author wxs;	state Exp;
branches;
next	1.2;

1.2
date	2009.05.04.21.16.54;	author dhn;	state dead;
branches;
next	1.1;

1.1
date	2009.03.30.19.08.58;	author pav;	state Exp;
branches;
next	;


desc
@@


1.4
log
@SVN rev 300956 on 2012-07-16 17:04:29Z by rm

- remove expired ports
  * lang/python24 and lang/python25: unmaintained upstream
  * www/zope and www/zope211: unmaintained upstream (the only
    consumers of python24)
- clean-up python versions < 2.6 from lang/python-doc-html
- clean-up python24/25 from Mk/bsd.ports.mk
- add www/zope213 glue to bsd.python.mk
- clean-up zope versions != 2.13 from bsd.python.mk

Submitted by:	miwi (based on)
Approved by:	portmgr (miwi)
@
text
@--- lib/python/Zope2/Startup/zopeschema.xml.orig	2009-05-20 10:09:56.000000000 +0200
+++ lib/python/Zope2/Startup/zopeschema.xml	2009-05-20 09:02:27.000000000 +0200
@@@@ -444,6 +444,14 @@@@
     <metadefault>us</metadefault>
   </key>
 
+  <key name="datetime-default-localtimezone" datatype="boolean" default="off">
+    <description>
+     By default datetime uses the UTC timezone if no timezone is given. 
+     Set this option to on to use system local time zone as default time zone. 
+    </description>
+    <metadefault>off</metadefault>
+  </key>
+
   <key name="zserver-threads" datatype="integer" default="4">
      <description>
      Specify the number of threads that Zope's ZServer web server will use
--- lib/python/DateTime/DateTime.py.orig	2009-05-20 09:09:32.000000000 +0200
+++ lib/python/DateTime/DateTime.py	2009-05-20 10:12:07.000000000 +0200
@@@@ -16,13 +16,14 @@@@
 
 
 import re, math,  DateTimeZone
-from time import time, gmtime, localtime
+from time import time, gmtime, localtime, strptime, mktime
 from time import daylight, timezone, altzone, strftime
 from datetime import datetime
 from interfaces import IDateTime
 from interfaces import DateTimeError, SyntaxError, DateError, TimeError
 from zope.interface import implements
 from pytz_support import PytzCache
+from App.config import getConfiguration
 _cache = PytzCache
 
 default_datefmt = None
@@@@ -31,7 +32,6 @@@@
     global default_datefmt
     if default_datefmt is None:
         try:
-            from App.config import getConfiguration
             default_datefmt = getConfiguration().datetime_format
             return default_datefmt
         except:
@@@@ -1805,10 +1805,14 @@@@
         if fields['signal'] or fields['Z']:
             tznaive = False
         else:
-            tznaive = True
+            if getConfiguration().datetime_default_localtimezone :
+                dtstr = "%04.4d-%02.2d-%02.2d %02.2d:%02.2d:%02.2d" % (year, month, day, hour, minute, seconds)
+                dsttime = strptime(dtstr, "%Y-%m-%d %H:%M:%S")
+                dsdtime = localtime(mktime(dsttime))
+                ltzoff =  _tzoffset(self.localZone(dsdtime), None)
+                hour_off = ltzoff / 3600
+                min_off = (ltzoff % 3600) / 60
         
-        # Differ from the specification here. To preserve backwards
-        # compatibility assume a default timezone == UTC.
         tz = 'GMT%+03d%02d' % (hour_off, min_off)
 
         return year, month, day, hour, minute, seconds, tz, tznaive
--- skel/etc/zope.conf.in.orig	2009-06-22 08:30:40.000000000 +0200
+++ skel/etc/zope.conf.in	2009-06-22 08:31:15.000000000 +0200
@@@@ -204,6 +204,19 @@@@
 #    datetime-format international
 
 
+# Directive: datetime-default-localtimezone
+#
+# Description:
+#     By default datetime uses the UTC timezone if no timezone is given.
+#     Set this option to on to use system local time zone as default time zone.
+#     
+# Default: off
+#     
+# Example:
+#     
+#    datetime-default-localtimezone on
+
+
 # Directive: zserver-threads
 #
 # Description:
@


1.3
log
@- Fix a minor problem with Zope DateTime and Timezones

PR:		ports/135910
Submitted by:	Gerhard Schmidt <estartu@@augusta.de> (maintainer)
@
text
@@


1.2
log
@- Update to 2.11.3

PR:		ports/134208
Submitted by:	Gerhard Schmidt <estartu@@augusta.de> (maintainer)
Approved by:	miwi (mentor implicit)
@
text
@d1 42
a42 6
# Patch for Problems with old Datetime objects from ZODB 
# Reomve when Zope2.11.3 is released
#
--- lib/python/DateTime/DateTime.py	2008/12/05 20:29:37	93698
+++ lib/python/DateTime/DateTime.py	2009/03/04 16:44:48	97471
@@@@ -353,6 +353,10 @@@@
d44 16
a59 1
             raise SyntaxError('Unable to parse %s, %s' % (args, kw))
d61 23
a83 73
+    def __setstate__(self, state):
+        self.__dict__.clear()  # why doesn't Python's unpickler do this?
+        self.__dict__.update(state)
+
     def _parse_args(self, *args, **kw):
         """Return a new date-time object.

--- lib/python/DateTime/tests/testDateTime.py	2008/09/07 19:51:10	90921
+++ lib/python/DateTime/tests/testDateTime.py	2009/03/04 16:44:48	97471
@@@@ -211,14 +211,61 @@@@
         self.failUnless(dt != dt1)
         self.failUnless(not (dt == dt1))
 
-    def testUpgradeOldInstances(self):
+    def test_compare_old_instances(self):
         # Compare dates that don't have the _micros attribute yet
+        # (e.g., from old pickles).
         dt = DateTime('1997/1/1')
         dt1 = DateTime('1997/2/2')
+        dt._millis = dt._micros / 1000
         del dt._micros
+        dt1._millis = dt1._micros / 1000
         del dt1._micros
         self.testCompareOperations(dt, dt1)
 
+    def test_compare_old_new_instances(self):
+        # Compare a date without _micros attribute (e.g., from an old
+        # pickle) with one that does.
+        dt = DateTime('1997/1/1')
+        dt1 = DateTime('1997/2/2')
+        dt._millis = dt._micros / 1000
+        del dt._micros
+        self.testCompareOperations(dt, dt1)
+
+    def test_compare_new_old_instances(self):
+        # Compare a date with _micros attribute with one that does not
+        # (e.g., from an old pickle).
+        dt = DateTime('1997/1/1')
+        dt1 = DateTime('1997/2/2')
+        dt1._millis = dt._micros / 1000
+        del dt1._micros
+        self.testCompareOperations(dt, dt1)
+
+    def test_strftime_old_instance(self):
+        # https://bugs.launchpad.net/zope2/+bug/290254
+        # Ensure that dates without _micros attribute (e.g., from old
+        # pickles) still render correctly in strftime.
+        ISO = '2001-10-10T00:00:00+02:00'
+        dt = DateTime(ISO)
+        dt._millis = dt._micros / 1000
+        del dt._micros
+        self.assertEqual(dt.strftime('%Y'), '2001')
+
+        # Now, create one via pickling / unpickling.
+        from cPickle import dumps, loads
+        self.assertEqual(loads(dumps(dt)).strftime('%Y'), '2001')
+
+    def test___setstate___without_micros(self):
+        ISO = '2001-10-10T00:00:00+02:00'
+        dt = DateTime(ISO)
+        micros = dt._micros
+        dt._millis = dt._micros / 1000
+        del dt._micros
+        state = dt.__dict__
+
+        dt1 = DateTime()
+        dt1.__setstate__(state)
+        self.assertEqual(dt1._micros, micros)
+
     def testTZ2(self):
         # Time zone manipulation test 2
         dt = DateTime()

@


1.1
log
@Add zope 2.11, a new stable branch of Zope

PR:		ports/132981
Submitted by:	Gerhard Schmidt <estartu@@augusta.de>
@
text
@@

