Skip to content

Commit

Permalink
Add a trailing **kwargs parameter to the constructor of the Database …
Browse files Browse the repository at this point in the history
…class
  • Loading branch information
tylerlong committed Feb 26, 2013
1 parent e34af31 commit 4c5ac60
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions quick_orm/core.py
Expand Up @@ -53,7 +53,7 @@ def register():
if getattr(self, parent._readable_name).real_type == model._readable_name else None))(parent, model))
models[:] = []

def __init__(self, connection_string):
def __init__(self, connection_string, **kwargs):
"""Initiate a database engine which is very low level, and a database session which deals with orm."""

# Solve an issue with mysql character encoding(maybe it's a bug of MySQLdb)
Expand All @@ -62,7 +62,7 @@ def __init__(self, connection_string):
raise ValueError("""No charset was specified for a mysql connection string.
Please specify something like '?charset=utf8' explicitly.""")

self.engine = create_engine(connection_string, convert_unicode = True, encoding = 'utf-8')
self.engine = create_engine(connection_string, convert_unicode = True, encoding = 'utf-8', **kwargs)
self.session = SessionExtension.extend(scoped_session(sessionmaker(autocommit = False, autoflush = False, bind = self.engine)))

@staticmethod
Expand Down Expand Up @@ -214,4 +214,4 @@ def __new__(cls, name, bases, attrs):
seen = set()
bases = tuple(base for base in bases if not base in seen and not seen.add(base))
return Database.DefaultMeta.__new__(cls, name, bases, attrs)
return InnerMeta
return InnerMeta
2 changes: 1 addition & 1 deletion requires.txt
@@ -1,2 +1,2 @@
SQLAlchemy>=0.7.3
SQLAlchemy==0.7.10
toolkit_library>=0.4.0

0 comments on commit 4c5ac60

Please sign in to comment.