Skip to content
This repository was archived by the owner on Oct 19, 2023. It is now read-only.

Commit 6028b9d

Browse files
committed
Change 'collate' to 'collation' per request
1 parent c272111 commit 6028b9d

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

MySQLdb/connections.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class object, used to create cursors (keyword only)
100100
If omitted, empty string, or None, the default character set
101101
from the server will be used.
102102
103-
:param str collate:
103+
:param str collation:
104104
If ``charset`` and ``collation`` are both supplied, the
105105
character set and collation for the current conneciton
106106
will be set.
@@ -179,7 +179,7 @@ class object, used to create cursors (keyword only)
179179

180180
cursorclass = kwargs2.pop("cursorclass", self.default_cursor)
181181
charset = kwargs2.get("charset", "")
182-
collate = kwargs2.pop("collate", "")
182+
collation = kwargs2.pop("collation", "")
183183
use_unicode = kwargs2.pop("use_unicode", True)
184184
sql_mode = kwargs2.pop("sql_mode", "")
185185
self._binary_prefix = kwargs2.pop("binary_prefix", False)
@@ -204,8 +204,8 @@ class object, used to create cursors (keyword only)
204204

205205
self.encoding = "ascii" # overridden in set_character_set()
206206

207-
if charset and collate:
208-
self.set_character_set_collation(charset, collate)
207+
if charset and collation:
208+
self.set_character_set_collation(charset, collation)
209209
else:
210210
if not charset:
211211
charset = self.character_set_name()
@@ -313,11 +313,11 @@ def set_character_set(self, charset):
313313
super().set_character_set(charset)
314314
self.encoding = _charset_to_encoding.get(charset, charset)
315315

316-
def set_character_set_collation(self, charset, collate):
316+
def set_character_set_collation(self, charset, collation):
317317
"""Set the connection character set and collation. Use this as
318318
an alternative to ``set_character_set``.
319319
"""
320-
self.query("SET NAMES %s COLLATE %s" % (charset, collate))
320+
self.query("SET NAMES %s COLLATE %s" % (charset, collation))
321321
self.store_result()
322322
self.encoding = _charset_to_encoding.get(charset, charset)
323323

doc/user_guide.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,9 @@ connect(parameters...)
344344

345345
*This must be a keyword parameter.*
346346

347-
collate
347+
collation
348348

349-
If ``charset`` and ``collate`` are both supplied, the
349+
If ``charset`` and ``collation`` are both supplied, the
350350
character set and collation for the current conneciton
351351
will be set.
352352

tests/test_MySQLdb_nonstandard.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,13 @@ def setUp(self):
124124
# collation.
125125
self.conn = connection_factory(
126126
charset="utf8mb4",
127-
collate="utf8mb4_esperanto_ci",
127+
collation="utf8mb4_esperanto_ci",
128128
)
129129

130130
def tearDown(self):
131131
self.conn.close()
132132

133-
def test_charset_collate(self):
133+
def test_charset_collation(self):
134134
c = self.conn.cursor()
135135
c.execute(
136136
"""
@@ -141,6 +141,6 @@ def test_charset_collate(self):
141141
)
142142
row = c.fetchall()
143143
charset = row[0][1]
144-
collate = row[1][1]
144+
collation = row[1][1]
145145
self.assertEqual(charset, "utf8mb4")
146-
self.assertEqual(collate, "utf8mb4_esperanto_ci")
146+
self.assertEqual(collation, "utf8mb4_esperanto_ci")

0 commit comments

Comments
 (0)