summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/build/content/document_base.myt2
-rw-r--r--lib/sqlalchemy/engine/threadlocal.py5
-rw-r--r--lib/sqlalchemy/types.py8
-rw-r--r--setup.py2
-rw-r--r--test/sql/testtypes.py12
5 files changed, 12 insertions, 17 deletions
diff --git a/doc/build/content/document_base.myt b/doc/build/content/document_base.myt
index db17987d7..f88a836ff 100644
--- a/doc/build/content/document_base.myt
+++ b/doc/build/content/document_base.myt
@@ -24,7 +24,7 @@
onepage='documentation'
index='index'
title='SQLAlchemy 0.2 Documentation'
- version = '0.2.0'
+ version = '0.2.2'
</%attr>
<%method title>
diff --git a/lib/sqlalchemy/engine/threadlocal.py b/lib/sqlalchemy/engine/threadlocal.py
index 1d99f9ce8..913c6425a 100644
--- a/lib/sqlalchemy/engine/threadlocal.py
+++ b/lib/sqlalchemy/engine/threadlocal.py
@@ -15,11 +15,6 @@ class TLSession(object):
return self.__transaction._increment_connect()
except AttributeError:
return TLConnection(self, close_with_result=close_with_result)
- def set_transaction(self, tlconnection, trans):
- if self.__tcount == 0:
- self.__transaction = tlconnection
- self.__trans = trans
- self.__tcount += 1
def reset(self):
try:
self.__transaction._force_close()
diff --git a/lib/sqlalchemy/types.py b/lib/sqlalchemy/types.py
index 65b5d14fa..5fc75678d 100644
--- a/lib/sqlalchemy/types.py
+++ b/lib/sqlalchemy/types.py
@@ -199,19 +199,19 @@ class Binary(TypeEngine):
class PickleType(TypeDecorator):
impl = Binary
- def __init__(self, protocol=pickle.HIGHEST_PROTOCOL):
- """allows the pickle protocol to be specified"""
+ def __init__(self, protocol=pickle.HIGHEST_PROTOCOL, pickler=None):
self.protocol = protocol
+ self.pickler = pickler or pickle
super(PickleType, self).__init__()
def convert_result_value(self, value, dialect):
if value is None:
return None
buf = self.impl.convert_result_value(value, dialect)
- return pickle.loads(str(buf))
+ return self.pickler.loads(str(buf))
def convert_bind_param(self, value, dialect):
if value is None:
return None
- return self.impl.convert_bind_param(pickle.dumps(value, self.protocol), dialect)
+ return self.impl.convert_bind_param(self.pickler.dumps(value, self.protocol), dialect)
class Boolean(TypeEngine):
pass
diff --git a/setup.py b/setup.py
index 9baf484b2..292ce5528 100644
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@ use_setuptools()
from setuptools import setup, find_packages
setup(name = "SQLAlchemy",
- version = "0.2.1",
+ version = "0.2.2",
description = "Database Abstraction Library",
author = "Mike Bayer",
author_email = "mike_mp@zzzcomputing.com",
diff --git a/test/sql/testtypes.py b/test/sql/testtypes.py
index f369bd384..2ec1fe795 100644
--- a/test/sql/testtypes.py
+++ b/test/sql/testtypes.py
@@ -6,11 +6,6 @@ import sqlalchemy.engine.url as url
import sqlalchemy.types
-# TODO: cant get cPickle to pickle the "Foo" class from this module,
-# now that its moved
-import pickle
-sqlalchemy.types.pickle = pickle
-
db = testbase.db
@@ -177,6 +172,8 @@ class Foo(object):
def __eq__(self, other):
return other.data == self.data and other.stuff == self.stuff and other.moredata==self.moredata
+import pickle
+
class BinaryTest(AssertMixin):
def setUpAll(self):
global binary_table
@@ -185,7 +182,10 @@ class BinaryTest(AssertMixin):
Column('data', Binary),
Column('data_slice', Binary(100)),
Column('misc', String(30)),
- Column('pickled', PickleType)
+ # construct PickleType with non-native pickle module, since cPickle uses relative module
+ # loading and confuses this test's parent package 'sql' with the 'sqlalchemy.sql' package relative
+ # to the 'types' module
+ Column('pickled', PickleType(pickler=pickle))
)
binary_table.create()
def tearDownAll(self):