Remove all uses of str.format().
authora_magical_me <andrew@turnipmints.mooo.com>
Tue, 29 Mar 2011 21:39:54 +0000 (14:39 -0700)
committera_magical_me <andrew@turnipmints.mooo.com>
Sun, 3 Apr 2011 10:16:52 +0000 (03:16 -0700)
For Python 2.5 compatibility.

pokedex/db/load.py
pokedex/db/tables.py

index 6a548b8..f0e4b6d 100644 (file)
@@ -185,15 +185,15 @@ def load(session, tables=[], directory=None, drop_tables=False, verbose=False, s
                 force_not_null = 'FORCE NOT NULL ' + ','.join('"%s"' % c for c in not_null_cols)
             else:
                 force_not_null = ''
-            command = "COPY {table_name} ({columns}) FROM '{csvpath}' CSV HEADER {force_not_null}"
+            command = "COPY %(table_name)s (%(columns)s) FROM '%(csvpath)s' CSV HEADER %(force_not_null)s"
             session.connection().execute(
-                    command.format(
-                            table_name=table_name,
-                            csvpath=csvpath,
-                            columns=','.join('"%s"' % c for c in column_names),
-                            force_not_null=force_not_null,
-                        )
+                command % dict(
+                    table_name=table_name,
+                    csvpath=csvpath,
+                    columns=','.join('"%s"' % c for c in column_names),
+                    force_not_null=force_not_null,
                 )
+            )
             session.commit()
             print_done()
             continue
index d9905b6..6afe000 100644 (file)
@@ -1150,7 +1150,7 @@ class Pokemon(TableBase):
         u"""Returns the Pokémon's name, including its form if applicable."""
 
         if self.form_name:
-            return u'{0} {1}'.format(self.form_name, self.name)
+            return u'%s %s' % (self.form_name, self.name)
         else:
             return self.name
 
@@ -1354,7 +1354,7 @@ class PokemonForm(TableBase):
         if not self.name:
             return None
         elif self.form_group and self.form_group.term:
-            return u'{0} {1}'.format(self.name, self.form_group.term)
+            return u'%s %s' % (self.name, self.form_group.term)
         else:
             return self.name
 
@@ -1365,7 +1365,7 @@ class PokemonForm(TableBase):
         """
 
         if self.name:
-            return u'{0} {1}'.format(self.name, self.form_base_pokemon.name)
+            return u'%s %s' % (self.name, self.form_base_pokemon.name)
         else:
             return self.form_base_pokemon.name