Skip to content

Commit b56ad85

Browse files
committed
Add comments to more explicitly state the process in cql_quote
1 parent 36bdd89 commit b56ad85

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

cassandra/encoder.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@
1313

1414

1515
def cql_quote(term):
16+
# The ordering of this method is important for the result of this method to
17+
# be a native str type (for both Python 2 and 3)
18+
19+
# Handle quoting of native str and bool types
1620
if isinstance(term, (str, bool)):
1721
return "'%s'" % str(term).replace("'", "''")
22+
# This branch of the if statement will only be used by Python 2 to catch
23+
# unicode strings, text_type is used to prevent type errors with Python 3.
1824
elif isinstance(term, six.text_type):
1925
return "'%s'" % term.encode('utf8').replace("'", "''")
2026
else:

0 commit comments

Comments
 (0)