[Checkins] SVN: zope.psycopgda/trunk/ Refactored to reference zope.
namespace now.
Stephan Richter
srichter at cosmos.phy.tufts.edu
Wed Feb 27 02:15:05 EST 2008
Log message for revision 84316:
Refactored to reference zope. namespace now.
Cleaned up code a bit.
Get ready for release.
Changed:
_U zope.psycopgda/trunk/
U zope.psycopgda/trunk/CHANGES.txt
U zope.psycopgda/trunk/README.txt
A zope.psycopgda/trunk/bootstrap.py
A zope.psycopgda/trunk/buildout.cfg
D zope.psycopgda/trunk/psycopgda/
D zope.psycopgda/trunk/psycopgda-configure.zcml
U zope.psycopgda/trunk/setup.py
A zope.psycopgda/trunk/src/
A zope.psycopgda/trunk/src/zope/
A zope.psycopgda/trunk/src/zope/__init__.py
A zope.psycopgda/trunk/src/zope/psycopgda/
U zope.psycopgda/trunk/src/zope/psycopgda/adapter.py
U zope.psycopgda/trunk/src/zope/psycopgda/tests.py
D zope.psycopgda/trunk/version.txt
-=-
Property changes on: zope.psycopgda/trunk
___________________________________________________________________
Name: svn:ignore
- psycopgda.egg-info
+ .installed.cfg
bin
develop-eggs
parts
Modified: zope.psycopgda/trunk/CHANGES.txt
===================================================================
--- zope.psycopgda/trunk/CHANGES.txt 2008-02-27 04:11:56 UTC (rev 84315)
+++ zope.psycopgda/trunk/CHANGES.txt 2008-02-27 07:15:04 UTC (rev 84316)
@@ -1,13 +1,12 @@
-PsycopgDA Changes
+=======
+CHANGES
+=======
- This file contains change information for the current PsycopgDA release.
+1.1.0 (2008/01/26)
+------------------
- After PsycopgDA 1.0 (trunk only)
+- Feature: Produced a real egg.
- New features
+- Restructuring: Moved from ``psycopgda`` to ``zope.psycopgda``.
- Restructuring
-
- Bug Fixes
-
- - Fixed issue 561: PsycopgDA ForbiddenAttribute exception;
+- Bug: Fixed issue 561: PsycopgDA ForbiddenAttribute exception.
Modified: zope.psycopgda/trunk/README.txt
===================================================================
--- zope.psycopgda/trunk/README.txt 2008-02-27 04:11:56 UTC (rev 84315)
+++ zope.psycopgda/trunk/README.txt 2008-02-27 07:15:04 UTC (rev 84316)
@@ -10,7 +10,7 @@
1. Check out the psycopgda package into a directory in your
PYTHONPATH. INSTANCE_HOME/lib/python or Zope3/src is usually the
most convenient place:
-
+
svn co svn://svn.zope.org/repos/main/psycopgda/trunk/psycopgda psycopgda
2. Copy `psycopg-configure.zcml` to the `package-includes` directory
Added: zope.psycopgda/trunk/bootstrap.py
===================================================================
--- zope.psycopgda/trunk/bootstrap.py (rev 0)
+++ zope.psycopgda/trunk/bootstrap.py 2008-02-27 07:15:04 UTC (rev 84316)
@@ -0,0 +1,52 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+"""Bootstrap a buildout-based project
+
+Simply run this script in a directory containing a buildout.cfg.
+The script accepts buildout command-line options, so you can
+use the -c option to specify an alternate configuration file.
+
+$Id$
+"""
+
+import os, shutil, sys, tempfile, urllib2
+
+tmpeggs = tempfile.mkdtemp()
+
+ez = {}
+exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
+ ).read() in ez
+ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
+
+import pkg_resources
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+if sys.platform == 'win32':
+ cmd = '"%s"' % cmd # work around spawn lamosity on windows
+
+ws = pkg_resources.working_set
+assert os.spawnle(
+ os.P_WAIT, sys.executable, sys.executable,
+ '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout',
+ dict(os.environ,
+ PYTHONPATH=
+ ws.find(pkg_resources.Requirement.parse('setuptools')).location
+ ),
+ ) == 0
+
+ws.add_entry(tmpeggs)
+ws.require('zc.buildout')
+import zc.buildout.buildout
+zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
+shutil.rmtree(tmpeggs)
Property changes on: zope.psycopgda/trunk/bootstrap.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added: zope.psycopgda/trunk/buildout.cfg
===================================================================
--- zope.psycopgda/trunk/buildout.cfg (rev 0)
+++ zope.psycopgda/trunk/buildout.cfg 2008-02-27 07:15:04 UTC (rev 84316)
@@ -0,0 +1,7 @@
+[buildout]
+develop = .
+parts = test
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = zope.psycopgda [test]
Deleted: zope.psycopgda/trunk/psycopgda-configure.zcml
===================================================================
--- zope.psycopgda/trunk/psycopgda-configure.zcml 2008-02-27 04:11:56 UTC (rev 84315)
+++ zope.psycopgda/trunk/psycopgda-configure.zcml 2008-02-27 07:15:04 UTC (rev 84316)
@@ -1 +0,0 @@
-<include package="psycopgda" />
Modified: zope.psycopgda/trunk/setup.py
===================================================================
--- zope.psycopgda/trunk/setup.py 2008-02-27 04:11:56 UTC (rev 84315)
+++ zope.psycopgda/trunk/setup.py 2008-02-27 07:15:04 UTC (rev 84316)
@@ -1,3 +1,16 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
"""Psycopg Database Adapter for Zope 3
This package allows Zope 3 to connect to any PostGreSQL database via
@@ -2,19 +15,51 @@
the common Zope 3 RDB connection facilities.
+
+$Id: setup.py 83394 2008-02-01 19:51:10Z srichter $
"""
-
+import os
from setuptools import setup, find_packages
-# We're using the module docstring as the distutils descriptions.
-doclines = __doc__.split("\n")
-VERSION = open('version.txt', 'rb').read().strip()
+def read(*rnames):
+ return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
-setup(name="psycopgda",
- version=VERSION,
- author="Zope Corporation and Contributors",
- author_email="zope3-dev at zope.org",
- license = "ZPL 2.1",
- platforms = ["any"],
- description = doclines[0],
- long_description = "\n".join(doclines[2:]),
- packages = find_packages(),
+setup(name='zope.psycopgda',
+ version = '1.1.0',
+ author='Zope Corporation and Contributors',
+ author_email='zope3-dev at zope.org',
+ description='Psycopg Database Adapter for Zope 3',
+ long_description=(
+ read('README.txt')
+ + '\n\n' +
+ read('CHANGES.txt')
+ ),
+ keywords = "zope3 rdn postgresql psycopg",
+ 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'],
+ url='http://pypi.python.org/pypi/zope.psycopgda',
+ license='ZPL 2.1',
+ packages=find_packages('src'),
+ package_dir = {'': 'src'},
+ namespace_packages=['zope'],
+ extras_require = dict(
+ test=['zope.testing',
+ ]),
+ install_requires = [
+ # Versions 1.x is not a proper egg.
+ #'psycopgda',
+ 'setuptools',
+ 'zope.component',
+ 'zope.interface',
+ 'zope.rdb',
+ 'zope.app.form',
+ ],
+ include_package_data = True,
+ zip_safe = False,
)
Added: zope.psycopgda/trunk/src/zope/__init__.py
===================================================================
--- zope.psycopgda/trunk/src/zope/__init__.py (rev 0)
+++ zope.psycopgda/trunk/src/zope/__init__.py 2008-02-27 07:15:04 UTC (rev 84316)
@@ -0,0 +1,7 @@
+try:
+ # Declare this a namespace package if pkg_resources is available.
+ import pkg_resources
+ pkg_resources.declare_namespace(__name__)
+except ImportError:
+ pass
+
Property changes on: zope.psycopgda/trunk/src/zope/__init__.py
___________________________________________________________________
Name: svn:keywords
+ Id
Copied: zope.psycopgda/trunk/src/zope/psycopgda (from rev 84276, zope.psycopgda/trunk/psycopgda)
Modified: zope.psycopgda/trunk/src/zope/psycopgda/adapter.py
===================================================================
--- zope.psycopgda/trunk/psycopgda/adapter.py 2008-02-26 17:27:58 UTC (rev 84276)
+++ zope.psycopgda/trunk/src/zope/psycopgda/adapter.py 2008-02-27 07:15:04 UTC (rev 84316)
@@ -15,20 +15,19 @@
$Id$
"""
-
-from zope.interface import implements
-from zope.rdb import (
- ZopeDatabaseAdapter, parseDSN, ZopeConnection, ZopeCursor
- )
-from zope.rdb.interfaces import DatabaseException, IZopeConnection
-from zope.publisher.interfaces import Retry
-
-from datetime import date, time, datetime, timedelta
+import datetime
import psycopg
import re
import sys
+import zope.interface
+import zope.rdb
+from zope.datetime import tzinfo
+from zope.interface import implements
+from zope.rdb.interfaces import DatabaseException, IZopeConnection
+from zope.publisher.interfaces import Retry
+
# These OIDs are taken from include/server/pg_type.h from PostgreSQL headers.
# Unfortunatelly psycopg does not export them as constants, and
# we cannot use psycopg.FOO.values because they overlap.
@@ -190,7 +189,7 @@
date_comp ::= 1 'day'
| number 'days'
| 1 'month'
- | 1 'mon'
+\ | 1 'mon'
| number 'months'
| number 'mons'
| 1 'year'
@@ -234,39 +233,39 @@
# Type conversions
def _conv_date(s):
if s:
- return date(*parse_date(s))
+ return datetime.date(*parse_date(s))
def _conv_time(s):
if s:
hr, mn, sc = parse_time(s)
sc, micro = divmod(sc, 1.0)
micro = round(micro * 1000000)
- return time(hr, mn, int(sc), int(micro))
+ return datetime.time(hr, mn, int(sc), int(micro))
def _conv_timetz(s):
if s:
- from zope.datetime import tzinfo
hr, mn, sc, tz = parse_timetz(s)
sc, micro = divmod(sc, 1.0)
micro = round(micro * 1000000)
- if tz: tz = tzinfo(tz)
- return time(hr, mn, int(sc), int(micro), tz)
+ if tz:
+ tz = tzinfo(tz)
+ return datetime.time(hr, mn, int(sc), int(micro), tz)
def _conv_timestamp(s):
if s:
y, m, d, hr, mn, sc = parse_datetime(s)
sc, micro = divmod(sc, 1.0)
micro = round(micro * 1000000)
- return datetime(y, m, d, hr, mn, int(sc), int(micro))
+ return datetime.datetime(y, m, d, hr, mn, int(sc), int(micro))
def _conv_timestamptz(s):
if s:
- from zope.datetime import tzinfo
y, m, d, hr, mn, sc, tz = parse_datetimetz(s)
sc, micro = divmod(sc, 1.0)
micro = round(micro * 1000000)
- if tz: tz = tzinfo(tz)
- return datetime(y, m, d, hr, mn, int(sc), int(micro), tz)
+ if tz:
+ tz = tzinfo(tz)
+ return datetime.datetime(y, m, d, hr, mn, int(sc), int(micro), tz)
def _conv_interval(s):
if s:
@@ -276,7 +275,7 @@
# timedeltas
return s
else:
- return timedelta(days=d, hours=hr, minutes=mn, seconds=sc)
+ return datetime.timedelta(days=d, hours=hr, minutes=mn, seconds=sc)
def _get_string_conv(encoding):
def _conv_string(s):
@@ -313,7 +312,7 @@
"ZSTRING", _get_string_conv(encoding))
psycopg.register_type(STRING)
-class PsycopgAdapter(ZopeDatabaseAdapter):
+class PsycopgAdapter(zope.rdb.ZopeDatabaseAdapter):
"""A PsycoPG adapter for Zope3.
The following type conversions are performed:
@@ -343,7 +342,7 @@
def _connection_factory(self):
"""Create a Psycopg DBI connection based on the DSN"""
self.registerTypes()
- conn_info = parseDSN(self.dsn)
+ conn_info = zope.rdb.parseDSN(self.dsn)
conn_list = []
for dsnname, optname in dsn2option_mapping.iteritems():
if conn_info[dsnname]:
@@ -386,10 +385,9 @@
"""A marker interface stating that this connection uses PostgreSQL."""
-class PsycopgConnection(ZopeConnection):
+class PsycopgConnection(zope.rdb.ZopeConnection):
+ zope.interface.implements(IPsycopgZopeConnection)
- implements(IPsycopgZopeConnection)
-
def cursor(self):
"""See IZopeConnection"""
return PsycopgCursor(self.conn.cursor(), self)
@@ -401,7 +399,7 @@
_handle_psycopg_exception(error)
-class PsycopgCursor(ZopeCursor):
+class PsycopgCursor(zope.rdb.ZopeCursor):
def execute(self, operation, parameters=None):
"""See IZopeCursor"""
Modified: zope.psycopgda/trunk/src/zope/psycopgda/tests.py
===================================================================
--- zope.psycopgda/trunk/psycopgda/tests.py 2008-02-26 17:27:58 UTC (rev 84276)
+++ zope.psycopgda/trunk/src/zope/psycopgda/tests.py 2008-02-27 07:15:04 UTC (rev 84316)
@@ -15,22 +15,28 @@
$Id$
"""
+import datetime
+import psycopg
+import zope.psycopgda.adapter as adapter
from unittest import TestCase, TestSuite, main, makeSuite
-from datetime import tzinfo, timedelta
-import psycopg
+from zope.psycopgda.adapter import _conv_date, _conv_time, _conv_timestamp
+from zope.psycopgda.adapter import _conv_timetz, _conv_timestamptz
+from zope.psycopgda.adapter import _conv_interval, _get_string_conv
+from zope.psycopgda.adapter import parse_date, parse_time, parse_timetz
+from zope.psycopgda.adapter import parse_datetime, parse_datetimetz
class Stub(object):
def __init__(self, **kw):
self.__dict__.update(kw)
-class TZStub(tzinfo):
+class TZStub(datetime.tzinfo):
def __init__(self, h, m):
self.offset = h * 60 + m
def utcoffset(self, dt):
- return timedelta(minutes=self.offset)
+ return datetime.timedelta(minutes=self.offset)
def dst(self, dt):
return 0
@@ -39,7 +45,7 @@
return ''
def __repr__(self):
- return 'tzinfo(%d)' % self.offset
+ return 'datetime.tzinfo(%d)' % self.offset
def __reduce__(self):
return type(self), (), self.__dict__
@@ -77,89 +83,92 @@
class TestPsycopgTypeConversion(TestCase):
def test_conv_date(self):
- from psycopgda.adapter import _conv_date
- from datetime import date
self.assertEquals(_conv_date(''), None)
- self.assertEquals(_conv_date('2001-03-02'), date(2001, 3, 2))
+ self.assertEquals(_conv_date('2001-03-02'), datetime.date(2001, 3, 2))
def test_conv_time(self):
- from psycopgda.adapter import _conv_time
- from datetime import time
self.assertEquals(_conv_time(''), None)
self.assertEquals(_conv_time('23:17:57'),
- time(23, 17, 57))
+ datetime.time(23, 17, 57))
self.assertEquals(_conv_time('23:17:57.037'),
- time(23, 17, 57, 37000))
+ datetime.time(23, 17, 57, 37000))
def test_conv_timetz(self):
- from psycopgda.adapter import _conv_timetz
- from datetime import time
self.assertEquals(_conv_timetz(''), None)
self.assertEquals(_conv_timetz('12:44:01+01:00'),
- time(12, 44, 01, 0, TZStub(1,0)))
+ datetime.time(12, 44, 01, 0, TZStub(1,0)))
self.assertEquals(_conv_timetz('12:44:01.037-00:30'),
- time(12, 44, 01, 37000, TZStub(0,-30)))
+ datetime.time(12, 44, 01, 37000, TZStub(0,-30)))
def test_conv_timestamp(self):
- from psycopgda.adapter import _conv_timestamp
- from datetime import datetime
self.assertEquals(_conv_timestamp(''), None)
self.assertEquals(_conv_timestamp('2001-03-02 12:44:01'),
- datetime(2001, 3, 2, 12, 44, 01))
+ datetime.datetime(2001, 3, 2, 12, 44, 01))
self.assertEquals(_conv_timestamp('2001-03-02 12:44:01.037'),
- datetime(2001, 3, 2, 12, 44, 01, 37000))
+ datetime.datetime(2001, 3, 2, 12, 44, 01, 37000))
self.assertEquals(_conv_timestamp('2001-03-02 12:44:01.000001'),
- datetime(2001, 3, 2, 12, 44, 01, 1))
+ datetime.datetime(2001, 3, 2, 12, 44, 01, 1))
def test_conv_timestamptz(self):
- from psycopgda.adapter import _conv_timestamptz as c
- from datetime import datetime
- self.assertEquals(c(''), None)
+ self.assertEquals(_conv_timestamptz(''), None)
- self.assertEquals(c('2001-03-02 12:44:01+01:00'),
- datetime(2001, 3, 2, 12, 44, 01, 0, TZStub(1,0)))
- self.assertEquals(c('2001-03-02 12:44:01.037-00:30'),
- datetime(2001, 3, 2, 12, 44, 01, 37000, TZStub(0,-30)))
- self.assertEquals(c('2001-03-02 12:44:01.000001+12:00'),
- datetime(2001, 3, 2, 12, 44, 01, 1, TZStub(12,0)))
- self.assertEquals(c('2001-06-25 12:14:00-07'),
- datetime(2001, 6, 25, 12, 14, 00, 0, TZStub(-7,0)))
+ self.assertEquals(
+ _conv_timestamptz('2001-03-02 12:44:01+01:00'),
+ datetime.datetime(2001, 3, 2, 12, 44, 01, 0, TZStub(1,0)))
+ self.assertEquals(
+ _conv_timestamptz('2001-03-02 12:44:01.037-00:30'),
+ datetime.datetime(2001, 3, 2, 12, 44, 01, 37000, TZStub(0,-30)))
+ self.assertEquals(
+ _conv_timestamptz('2001-03-02 12:44:01.000001+12:00'),
+ datetime.datetime(2001, 3, 2, 12, 44, 01, 1, TZStub(12,0)))
+ self.assertEquals(
+ _conv_timestamptz('2001-06-25 12:14:00-07'),
+ datetime.datetime(2001, 6, 25, 12, 14, 00, 0, TZStub(-7,0)))
def test_conv_interval(self):
- from psycopgda.adapter import _conv_interval as c
- from datetime import timedelta
- self.assertEquals(c(''), None)
- self.assertEquals(c('01:00'), timedelta(hours=1))
- self.assertEquals(c('00:15'), timedelta(minutes=15))
- self.assertEquals(c('00:00:47'), timedelta(seconds=47))
- self.assertEquals(c('00:00:00.037'), timedelta(microseconds=37000))
- self.assertEquals(c('00:00:00.111111'), timedelta(microseconds=111111))
- self.assertEquals(c('1 day'), timedelta(days=1))
- self.assertEquals(c('2 days'), timedelta(days=2))
- self.assertEquals(c('374 days'), timedelta(days=374))
- self.assertEquals(c('2 days 03:20:15.123456'),
- timedelta(days=2, hours=3, minutes=20,
- seconds=15, microseconds=123456))
- # XXX There's a problem with years and months. Currently timedelta
+ self.assertEquals(_conv_interval(''), None)
+
+ self.assertEquals(
+ _conv_interval('01:00'), datetime.timedelta(hours=1))
+ self.assertEquals(
+ _conv_interval('00:15'), datetime.timedelta(minutes=15))
+ self.assertEquals(
+ _conv_interval('00:00:47'), datetime.timedelta(seconds=47))
+ self.assertEquals(
+ _conv_interval('00:00:00.037'),
+ datetime.timedelta(microseconds=37000))
+ self.assertEquals(
+ _conv_interval('00:00:00.111111'),
+ datetime.timedelta(microseconds=111111))
+ self.assertEquals(
+ _conv_interval('1 day'), datetime.timedelta(days=1))
+ self.assertEquals(
+ _conv_interval('2 days'), datetime.timedelta(days=2))
+ self.assertEquals(
+ _conv_interval('374 days'), datetime.timedelta(days=374))
+ self.assertEquals(
+ _conv_interval('2 days 03:20:15.123456'),
+ datetime.timedelta(days=2, hours=3, minutes=20,
+ seconds=15, microseconds=123456))
+ # XXX There's a problem with years and months. Currently datetime.timedelta
# cannot represent them accurately
- self.assertEquals(c('1 month'), '1 month')
- self.assertEquals(c('2 months'), '2 months')
- self.assertEquals(c('1 mon'), '1 mon')
- self.assertEquals(c('2 mons'), '2 mons')
- self.assertEquals(c('1 year'), '1 year')
- self.assertEquals(c('3 years'), '3 years')
+ self.assertEquals(_conv_interval('1 month'), '1 month')
+ self.assertEquals(_conv_interval('2 months'), '2 months')
+ self.assertEquals(_conv_interval('1 mon'), '1 mon')
+ self.assertEquals(_conv_interval('2 mons'), '2 mons')
+ self.assertEquals(_conv_interval('1 year'), '1 year')
+ self.assertEquals(_conv_interval('3 years'), '3 years')
# Later we might be able to use
- ## self.assertEquals(c('1 month'), timedelta(months=1))
- ## self.assertEquals(c('2 months'), timedelta(months=2))
- ## self.assertEquals(c('1 year'), timedelta(years=1))
- ## self.assertEquals(c('3 years'), timedelta(years=3))
+ ## self.assertEquals(c('1 month'), datetime.timedelta(months=1))
+ ## self.assertEquals(c('2 months'), datetime.timedelta(months=2))
+ ## self.assertEquals(c('1 year'), datetime.timedelta(years=1))
+ ## self.assertEquals(c('3 years'), datetime.timedelta(years=3))
- self.assertRaises(ValueError, c, '2 day')
- self.assertRaises(ValueError, c, '2days')
- self.assertRaises(ValueError, c, '123')
+ self.assertRaises(ValueError, _conv_interval, '2 day')
+ self.assertRaises(ValueError, _conv_interval, '2days')
+ self.assertRaises(ValueError, _conv_interval, '123')
def test_conv_string(self):
- from psycopgda.adapter import _get_string_conv
_conv_string = _get_string_conv("utf-8")
self.assertEquals(_conv_string(None), None)
self.assertEquals(_conv_string(''), u'')
@@ -170,17 +179,15 @@
class TestPsycopgAdapter(TestCase):
def setUp(self):
- import psycopgda.adapter as adapter
self.real_psycopg = adapter.psycopg
adapter.psycopg = self.psycopg_stub = PsycopgStub()
def tearDown(self):
- import psycopgda.adapter as adapter
adapter.psycopg = self.real_psycopg
def test_connection_factory(self):
- from psycopgda.adapter import PsycopgAdapter
- a = PsycopgAdapter('dbi://username:password@hostname:port/dbname;junk=ignored')
+ a = adapter.PsycopgAdapter(
+ 'dbi://username:password@hostname:port/dbname;junk=ignored')
c = a._connection_factory()
args = self.psycopg_stub.last_connection_string.split()
args.sort()
@@ -189,9 +196,7 @@
'user=username'])
def test_registerTypes(self):
- import psycopgda.adapter as adapter
- from psycopgda.adapter import PsycopgAdapter
- a = PsycopgAdapter('dbi://')
+ a = adapter.PsycopgAdapter('dbi://')
a.registerTypes()
for typename in ('DATE', 'TIME', 'TIMETZ', 'TIMESTAMP',
'TIMESTAMPTZ', 'INTERVAL'):
@@ -274,8 +279,6 @@
# tzoffset is offset in minutes east of UTC
def setUp(self):
- from psycopgda.adapter import parse_date, parse_time, \
- parse_timetz, parse_datetime, parse_datetimetz
self.parse_date = parse_date
self.parse_time = parse_time
self.parse_timetz = parse_timetz
Deleted: zope.psycopgda/trunk/version.txt
===================================================================
--- zope.psycopgda/trunk/version.txt 2008-02-27 04:11:56 UTC (rev 84315)
+++ zope.psycopgda/trunk/version.txt 2008-02-27 07:15:04 UTC (rev 84316)
@@ -1 +0,0 @@
-1.0
More information about the Checkins
mailing list