Renamed ScalarList and Email types
This commit is contained in:
@@ -4,6 +4,12 @@ Changelog
|
||||
Here you can see the full list of changes between each SQLAlchemy-Utils release.
|
||||
|
||||
|
||||
0.9.1 (2013-04-15)
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
- Renamed Email to EmailType and ScalarList to ScalarListType (unified type class naming convention)
|
||||
|
||||
|
||||
0.9.0 (2013-04-11)
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
2
setup.py
2
setup.py
@@ -24,7 +24,7 @@ class PyTest(Command):
|
||||
|
||||
setup(
|
||||
name='SQLAlchemy-Utils',
|
||||
version='0.9',
|
||||
version='0.9.1',
|
||||
url='https://github.com/kvesteri/sqlalchemy-utils',
|
||||
license='BSD',
|
||||
author='Konsta Vesterinen',
|
||||
|
@@ -1,7 +1,7 @@
|
||||
from .functions import sort_query, defer_except, escape_like
|
||||
from .merge import merge, Merger
|
||||
from .types import (
|
||||
Email,
|
||||
EmailType,
|
||||
instrumented_list,
|
||||
InstrumentedList,
|
||||
PhoneNumber,
|
||||
@@ -10,7 +10,7 @@ from .types import (
|
||||
NumberRangeException,
|
||||
NumberRangeRawType,
|
||||
NumberRangeType,
|
||||
ScalarList,
|
||||
ScalarListType,
|
||||
ScalarListException,
|
||||
)
|
||||
|
||||
@@ -21,7 +21,7 @@ __all__ = (
|
||||
escape_like,
|
||||
instrumented_list,
|
||||
merge,
|
||||
Email,
|
||||
EmailType,
|
||||
InstrumentedList,
|
||||
Merger,
|
||||
NumberRange,
|
||||
@@ -30,6 +30,6 @@ __all__ = (
|
||||
NumberRangeType,
|
||||
PhoneNumber,
|
||||
PhoneNumberType,
|
||||
ScalarList,
|
||||
ScalarListType,
|
||||
ScalarListException,
|
||||
)
|
||||
|
@@ -88,7 +88,7 @@ class ScalarListException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class ScalarList(types.TypeDecorator):
|
||||
class ScalarListType(types.TypeDecorator):
|
||||
impl = sa.UnicodeText()
|
||||
|
||||
def __init__(self, coerce_func=unicode, separator=u','):
|
||||
@@ -119,7 +119,7 @@ class ScalarList(types.TypeDecorator):
|
||||
)
|
||||
|
||||
|
||||
class Email(sa.types.TypeDecorator):
|
||||
class EmailType(sa.types.TypeDecorator):
|
||||
impl = sa.Unicode(255)
|
||||
comparator_factory = CaseInsensitiveComparator
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy_utils import Email
|
||||
from sqlalchemy_utils import EmailType
|
||||
from tests import DatabaseTestCase
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ class TestCaseInsensitiveComparator(DatabaseTestCase):
|
||||
class User(self.Base):
|
||||
__tablename__ = 'user'
|
||||
id = sa.Column(sa.Integer, primary_key=True)
|
||||
email = sa.Column(Email)
|
||||
email = sa.Column(EmailType)
|
||||
|
||||
def __repr__(self):
|
||||
return 'Building(%r)' % self.id
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy_utils import Email
|
||||
from sqlalchemy_utils import EmailType
|
||||
from tests import DatabaseTestCase
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ class TestEmailType(DatabaseTestCase):
|
||||
class User(self.Base):
|
||||
__tablename__ = 'user'
|
||||
id = sa.Column(sa.Integer, primary_key=True)
|
||||
email = sa.Column(Email)
|
||||
email = sa.Column(EmailType)
|
||||
|
||||
def __repr__(self):
|
||||
return 'Building(%r)' % self.id
|
||||
|
@@ -69,3 +69,9 @@ class TestNumberRange(object):
|
||||
assert str(NumberRange.from_normalized_str('[1,2]')) == '1 - 2'
|
||||
assert str(NumberRange.from_normalized_str('[1,3)')) == '1 - 2'
|
||||
assert str(NumberRange.from_normalized_str('(1,3)')) == '2'
|
||||
|
||||
def test_add_operator(self):
|
||||
assert NumberRange(1, 2) + NumberRange(1, 2) == NumberRange(2, 4)
|
||||
|
||||
def test_sub_operator(self):
|
||||
assert NumberRange(1, 3) - NumberRange(1, 2) == NumberRange(0, 1)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy_utils import ScalarList
|
||||
from sqlalchemy_utils import ScalarListType
|
||||
from pytest import raises
|
||||
from tests import DatabaseTestCase
|
||||
|
||||
@@ -9,7 +9,7 @@ class TestScalarIntegerList(DatabaseTestCase):
|
||||
class User(self.Base):
|
||||
__tablename__ = 'user'
|
||||
id = sa.Column(sa.Integer, primary_key=True)
|
||||
some_list = sa.Column(ScalarList(int))
|
||||
some_list = sa.Column(ScalarListType(int))
|
||||
|
||||
def __repr__(self):
|
||||
return 'User(%r)' % self.id
|
||||
@@ -33,7 +33,7 @@ class TestScalarUnicodeList(DatabaseTestCase):
|
||||
class User(self.Base):
|
||||
__tablename__ = 'user'
|
||||
id = sa.Column(sa.Integer, primary_key=True)
|
||||
some_list = sa.Column(ScalarList(unicode))
|
||||
some_list = sa.Column(ScalarListType(unicode))
|
||||
|
||||
def __repr__(self):
|
||||
return 'User(%r)' % self.id
|
||||
|
Reference in New Issue
Block a user