[Python-modules-commits] r5320 - in packages/psycopg2/trunk (ZPsycopgDA/DA.py debian/changelog)
kobold at users.alioth.debian.org
kobold at users.alioth.debian.org
Tue May 13 15:24:12 UTC 2008
Date: Tuesday, May 13, 2008 @ 15:24:10
Author: kobold
Revision: 5320
ZPsycopgDA/DA.py: updated the patch, which was out of sync with the
upstream tarball.
Modified:
packages/psycopg2/trunk/ZPsycopgDA/DA.py
packages/psycopg2/trunk/debian/changelog
Modified: packages/psycopg2/trunk/ZPsycopgDA/DA.py
===================================================================
--- packages/psycopg2/trunk/ZPsycopgDA/DA.py 2008-05-13 11:58:08 UTC (rev 5319)
+++ packages/psycopg2/trunk/ZPsycopgDA/DA.py 2008-05-13 15:24:10 UTC (rev 5320)
@@ -34,16 +34,13 @@
from App.Dialogs import MessageDialog
from DateTime import DateTime
-# Build Zope version in a float for later cheks
-import App
-zope_version = App.version_txt.getZopeVersion()
-zope_version = float("%s.%s" %(zope_version[:2]))
-
# ImageFile is deprecated in Zope >= 2.9
-if zope_version < 2.9:
- from ImageFile import ImageFile
-else:
- from App.ImageFile import ImageFile
+try:
+ from App.ImageFile import ImageFile
+except ImportError:
+ # Zope < 2.9. If PIL's installed with a .pth file, we're probably
+ # hosed.
+ from ImageFile import ImageFile
# import psycopg and functions/singletons needed for date/time conversions
@@ -79,7 +76,7 @@
icon = 'misc_/conn'
def __init__(self, id, title, connection_string,
- zdatetime, check=None, tilevel=2, encoding=''):
+ zdatetime, check=None, tilevel=2, encoding='UTF-8'):
self.zdatetime = zdatetime
self.id = str(id)
self.edit(title, connection_string, zdatetime,
@@ -91,14 +88,12 @@
## connection parameters editing ##
def edit(self, title, connection_string,
- zdatetime, check=None, tilevel=2, encoding=''):
+ zdatetime, check=None, tilevel=2, encoding='UTF-8'):
self.title = title
self.connection_string = connection_string
self.zdatetime = zdatetime
self.tilevel = tilevel
self.encoding = encoding
-
- self.set_type_casts()
if check: self.connect(self.connection_string)
@@ -125,30 +120,23 @@
raise ImportError("psycopg version mismatch (imported %s)" %
psycopg2.__version__)
- self.set_type_casts()
self._v_connected = ''
dbf = self.factory()
# TODO: let the psycopg exception propagate, or not?
self._v_database_connection = dbf(
- self.connection_string, self.tilevel, self.encoding)
+ self.connection_string, self.tilevel, self.get_type_casts(), self.encoding)
self._v_database_connection.open()
self._v_connected = DateTime()
return self
- def set_type_casts(self):
+ def get_type_casts(self):
# note that in both cases order *is* important
if self.zdatetime:
- # use zope internal datetime routines
- register_type(ZDATETIME)
- register_type(ZDATE)
- register_type(ZTIME)
+ return ZDATETIME, ZDATE, ZTIME
else:
- # use the standard
- register_type(DATETIME)
- register_type(DATE)
- register_type(TIME)
+ return DATETIME, DATE, TIME
## browsing and table/column management ##
@@ -223,17 +211,7 @@
if iso in ['-infinity', 'infinity']:
return iso
else:
- return DateTime(re.split("GMT\+?|GMT-?|\+|-", iso)[0])
-
- # this will split us into [date, time, GMT/AM/PM(if there)]
- # dt = str.split(' ')
- # if len(dt) > 1:
- # # we now should split out any timezone info
- # dt[1] = dt[1].split('-')[0]
- # dt[1] = dt[1].split('+')[0]
- # return DateTime(' '.join(dt[:2]))
- # else:
- # return DateTime(dt[0])
+ return DateTime(iso)
# convert an ISO date string from postgres to a Zope DateTime object
def _cast_Date(iso, curs):
Modified: packages/psycopg2/trunk/debian/changelog
===================================================================
--- packages/psycopg2/trunk/debian/changelog 2008-05-13 11:58:08 UTC (rev 5319)
+++ packages/psycopg2/trunk/debian/changelog 2008-05-13 15:24:10 UTC (rev 5320)
@@ -1,3 +1,10 @@
+psycopg2 (2.0.7-3) unstable; urgency=low
+
+ * ZPsycopgDA/DA.py: updated the patch, which was out of sync with the
+ upstream tarball.
+
+ -- Fabio Tranchitella <kobold at debian.org> Tue, 13 May 2008 17:22:30 +0200
+
psycopg2 (2.0.7-2) unstable; urgency=medium
* ZPsycopgDA/DA.py: updated the patch. (Closes: #478860)
More information about the Python-modules-commits
mailing list