← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:remove-quoteIdentifier into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:remove-quoteIdentifier into launchpad:master.

Commit message:
Remove backward-compatibility "quoteIdentifier" alias

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/451726
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:remove-quoteIdentifier into launchpad:master.
diff --git a/lib/lp/services/database/multitablecopy.py b/lib/lp/services/database/multitablecopy.py
index 1865206..de07713 100644
--- a/lib/lp/services/database/multitablecopy.py
+++ b/lib/lp/services/database/multitablecopy.py
@@ -10,7 +10,7 @@ import time
 from zope.interface import implementer
 
 from lp.services.database import postgresql
-from lp.services.database.sqlbase import cursor, quote, quoteIdentifier
+from lp.services.database.sqlbase import cursor, quote, quote_identifier
 from lp.services.looptuner import DBLoopTuner, ITunableLoop
 
 
@@ -295,7 +295,7 @@ class MultiTableCopy:
         Return value is properly quoted for use as an SQL identifier.
         """
         raw_name = self.getRawHoldingTableName(tablename, suffix)
-        return quoteIdentifier(raw_name)
+        return quote_identifier(raw_name)
 
     def _pointsToTable(self, source_table, foreign_key):
         """Name of table that source_table.foreign_key refers to.
diff --git a/lib/lp/services/database/postgresql.py b/lib/lp/services/database/postgresql.py
index 8ba5252..afbfcb0 100644
--- a/lib/lp/services/database/postgresql.py
+++ b/lib/lp/services/database/postgresql.py
@@ -8,7 +8,7 @@ and table manipulation
 
 import re
 
-from lp.services.database.sqlbase import quote, quoteIdentifier, sqlvalues
+from lp.services.database.sqlbase import quote, quote_identifier, sqlvalues
 
 
 def listReferences(cur, table, column, indirect=True, _state=None):
@@ -308,8 +308,8 @@ def generateResetSequencesSQL(cur):
         if table is None or column is None:
             continue
         sql = "SELECT max(%s) FROM %s" % (
-            quoteIdentifier(column),
-            quoteIdentifier(table),
+            quote_identifier(column),
+            quote_identifier(table),
         )
         cur.execute(sql)
         last_value = cur.fetchone()[0]
diff --git a/lib/lp/services/database/sqlbase.py b/lib/lp/services/database/sqlbase.py
index ebbc1d9..9cb0d1d 100644
--- a/lib/lp/services/database/sqlbase.py
+++ b/lib/lp/services/database/sqlbase.py
@@ -16,7 +16,6 @@ __all__ = [
     "ISOLATION_LEVEL_REPEATABLE_READ",
     "ISOLATION_LEVEL_SERIALIZABLE",
     "quote",
-    "quoteIdentifier",
     "quote_identifier",
     "reset_store",
     "session_store",
@@ -407,23 +406,20 @@ def quote_identifier(identifier):
     In SQL, identifiers are quoted using " rather than ' which is reserved
     for strings.
 
-    >>> print(quoteIdentifier("hello"))
+    >>> print(quote_identifier("hello"))
     "hello"
-    >>> print(quoteIdentifier("'"))
+    >>> print(quote_identifier("'"))
     "'"
-    >>> print(quoteIdentifier('"'))
+    >>> print(quote_identifier('"'))
     """"
-    >>> print(quoteIdentifier("\\"))
+    >>> print(quote_identifier("\\"))
     "\"
-    >>> print(quoteIdentifier('\\"'))
+    >>> print(quote_identifier('\\"'))
     "\"""
     '''
     return '"%s"' % identifier.replace('"', '""')
 
 
-quoteIdentifier = quote_identifier  # Backwards compatibility for now.
-
-
 def convert_storm_clause_to_string(storm_clause):
     """Convert a Storm expression into a plain string.
 
diff --git a/lib/lp/services/librarianserver/librariangc.py b/lib/lp/services/librarianserver/librariangc.py
index 14423be..aafd7cb 100644
--- a/lib/lp/services/librarianserver/librariangc.py
+++ b/lib/lp/services/librarianserver/librariangc.py
@@ -20,7 +20,7 @@ from lp.services.config import config
 from lp.services.database.postgresql import (
     drop_tables,
     listReferences,
-    quoteIdentifier,
+    quote_identifier,
 )
 from lp.services.features import getFeatureFlag
 from lp.services.librarianserver import swift
@@ -436,8 +436,8 @@ class UnreferencedLibraryFileAliasPruner:
                 WHERE LibraryFileAlias.id = %(table)s.%(column)s
                 """
                 % {
-                    "table": quoteIdentifier(table),
-                    "column": quoteIdentifier(column),
+                    "table": quote_identifier(table),
+                    "column": quote_identifier(column),
                 }
             )
             log.debug(
diff --git a/scripts/librarian-report.py b/scripts/librarian-report.py
index 8151b29..0281181 100755
--- a/scripts/librarian-report.py
+++ b/scripts/librarian-report.py
@@ -13,7 +13,7 @@ import sys
 from optparse import OptionParser
 
 from lp.services.database.postgresql import listReferences
-from lp.services.database.sqlbase import connect, quoteIdentifier, sqlvalues
+from lp.services.database.sqlbase import connect, quote_identifier, sqlvalues
 from lp.services.scripts import db_options
 
 
@@ -76,8 +76,8 @@ def main():
     for referring_table, referring_column in sorted(references):
         if referring_table == "libraryfiledownloadcount":
             continue
-        quoted_referring_table = quoteIdentifier(referring_table)
-        quoted_referring_column = quoteIdentifier(referring_column)
+        quoted_referring_table = quote_identifier(referring_table)
+        quoted_referring_column = quote_identifier(referring_column)
         cur.execute(
             """
             SELECT