:version: 0.9.7
:released:
+ .. change::
+ :tags: bug, sql
+ :tickets: 3123
+ :versions: 1.0.0
+
+ Added a "str()" step to the dialect_kwargs iteration for
+ Python version < 2.6.5, working around the
+ "no unicode keyword arg" bug as these args are passed along as
+ keyword args within some reflection processes.
+
.. change::
:tags: bug, sql
:tickets: 3122
def __iter__(self):
return (
- "%s_%s" % (dialect_name, value_name)
+ util.safe_kwarg("%s_%s" % (dialect_name, value_name))
for dialect_name in self.obj.dialect_options
for value_name in self.obj.dialect_options[dialect_name]._non_defaults
)
from .compat import callable, cmp, reduce, \
threading, py3k, py33, py2k, jython, pypy, cpython, win32, \
pickle, dottedgetter, parse_qsl, namedtuple, next, reraise, \
- raise_from_cause, text_type, string_types, int_types, binary_type, \
+ raise_from_cause, text_type, safe_kwarg, string_types, int_types, \
+ binary_type, \
quote_plus, with_metaclass, print_, itertools_filterfalse, u, ue, b,\
unquote_plus, unquote, b64decode, b64encode, byte_buffer, itertools_filter,\
iterbytes, StringIO, inspect_getargspec, zip_longest
py32 = sys.version_info >= (3, 2)
py3k = sys.version_info >= (3, 0)
py2k = sys.version_info < (3, 0)
+py265 = sys.version_info >= (2, 6, 5)
jython = sys.platform.startswith('java')
pypy = hasattr(sys, 'pypy_version_info')
win32 = sys.platform.startswith('win')
except ImportError:
import pickle
+# work around http://bugs.python.org/issue2646
+if py265:
+ safe_kwarg = lambda arg: arg
+else:
+ safe_kwarg = str
+
ArgSpec = collections.namedtuple("ArgSpec",
["args", "varargs", "keywords", "defaults"])
'otherunknown_foo': 'bar'}
) # still populates
+ def test_runs_safekwarg(self):
+
+ with mock.patch("sqlalchemy.util.safe_kwarg",
+ lambda arg: "goofy_%s" % arg):
+ with self._fixture():
+ idx = Index('a', 'b')
+ idx.kwargs[u'participating_x'] = 7
+
+ eq_(
+ list(idx.dialect_kwargs),
+ ['goofy_participating_x']
+ )
+
def test_combined(self):
with self._fixture():
idx = Index('a', 'b', 'c', participating_x=7,