Add compat.py and fix Python 3 error

master
sloria 11 years ago
parent e335c35548
commit 8412376285
  1. 1
      {{cookiecutter.app_name}}/requirements/prod.txt
  2. 20
      {{cookiecutter.app_name}}/{{cookiecutter.app_name}}/compat.py
  3. 1
      {{cookiecutter.app_name}}/{{cookiecutter.app_name}}/database.py

@ -20,7 +20,6 @@ WTForms==2.0
# Deployment
gunicorn>=17.5
wsgiref>=0.1.2
# Assets
Flask-Assets==0.10

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
"""Python 2/3 compatibility module."""
import sys
PY2 = int(sys.version[0]) == 2
if PY2:
text_type = unicode
binary_type = str
string_types = (str, unicode)
unicode = unicode
basestring = basestring
else:
text_type = str
binary_type = bytes
string_types = (str,)
unicode = str
basestring = (str, bytes)

@ -5,6 +5,7 @@ utilities.
from sqlalchemy.orm import relationship
from .extensions import db
from .compat import basestring
# Alias common SQLAlchemy names
Column = db.Column

Loading…
Cancel
Save