Skip to content
This repository
Browse code

Moving the 'normalization' of field_names into a lower-level method

  • Loading branch information...
commit 06e8cb92afd2dfdef69a080541df2a65e138894d 1 parent 023d481
Charles Leifer authored August 02, 2012

Showing 1 changed file with 3 additions and 2 deletions. Show diff stats Hide diff stats

  1. 5  peewee.py
5  peewee.py
@@ -412,6 +412,9 @@ def create_table(self, model_class, safe=False, extra=''):
412 412
     def create_index_query(self, model_class, field_names, unique, framing=None):
413 413
         framing = framing or 'CREATE %(unique)s INDEX %(index)s ON %(table)s(%(field)s);'
414 414
 
  415
+        if isinstance(field_names, basestring):
  416
+            field_names = (field_names,)
  417
+
415 418
         columns = []
416 419
         for field_name in field_names:
417 420
             if field_name not in model_class._meta.fields:
@@ -435,8 +438,6 @@ def create_index_query(self, model_class, field_names, unique, framing=None):
435 438
         }
436 439
 
437 440
     def create_index(self, model_class, field_names, unique=False):
438  
-        if isinstance(field_names, basestring):
439  
-            field_names = (field_names,)
440 441
         self.execute(self.create_index_query(model_class, field_names, unique))
441 442
 
442 443
     def create_foreign_key(self, model_class, field):

0 notes on commit 06e8cb9

Please sign in to comment.
Something went wrong with that request. Please try again.