Skip to content

Commit e3b0789

Browse files
committed
Merge branch 'db-session-is-none' of git://github.com/timheap/wtforms-sqlalchemy
2 parents fa2d541 + 5a18ee7 commit e3b0789

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

.travis.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,19 @@ python:
1212

1313
env:
1414
global:
15-
- WTFORMS="<=2.2.1"
15+
- WTFORMS="<3"
1616
matrix:
17-
- SQLALCHEMY=1.2.9
18-
- SQLALCHEMY=1.3.5
17+
- SQLALCHEMY="==0.7.10"
18+
- SQLALCHEMY="~=0.8.6"
19+
- SQLALCHEMY="==0.8.6" WTFORMS="==1.0.5"
20+
- SQLALCHEMY="~=0.9.6"
21+
- SQLALCHEMY="==0.9.8" WTFORMS="==1.0.5"
22+
- SQLALCHEMY=""
1923

2024

2125
# command to install dependencies
2226
install:
23-
- "pip install WTForms$WTFORMS SQLAlchemy==$SQLALCHEMY"
27+
- "pip install WTForms$WTFORMS SQLAlchemy$SQLALCHEMY"
2428
- "pip install ."
2529
- "pip install -r tests/requirements.txt"
2630

wtforms_sqlalchemy/orm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def get_converter(self, column):
6767
if col_type.__name__ in self.converters:
6868
return self.converters[col_type.__name__]
6969

70-
raise ModelConversionError('Could not find field converter for column %s (%r).' % (column.name, types[0]))
70+
raise ModelConversionError('Could not find field converter for %s (%r).' % (column.key, types[0]))
7171

7272
def convert(self, model, mapper, prop, field_args, db_session=None):
7373
if not hasattr(prop, 'columns') and not hasattr(prop, 'direction'):
@@ -120,7 +120,7 @@ def convert(self, model, mapper, prop, field_args, db_session=None):
120120
converter = self.get_converter(column)
121121
else:
122122
# We have a property with a direction.
123-
if not db_session:
123+
if db_session is None:
124124
raise ModelConversionError("Cannot convert field %s, need DB session." % prop.key)
125125

126126
foreign_model = prop.mapper.class_
@@ -195,7 +195,7 @@ def handle_decimal_types(self, column, field_args, **extra):
195195
field_args.setdefault('places', None)
196196
return wtforms_fields.DecimalField(**field_args)
197197

198-
@converts('dialects.mysql.types.YEAR')
198+
@converts('dialects.mysql.types.YEAR', 'dialects.mysql.base.YEAR')
199199
def conv_MSYear(self, field_args, **extra):
200200
field_args['validators'].append(validators.NumberRange(min=1901, max=2155))
201201
return wtforms_fields.StringField(**field_args)

0 commit comments

Comments
 (0)