Diff of /sqlobject/main.py [73e73d] .. [6229c8] Maximize Restore

  Switch to side-by-side view

--- a/sqlobject/main.py
+++ b/sqlobject/main.py
@@ -1256,10 +1256,9 @@
 
     def _findAlternateID(cls, name, dbName, value, connection=None):
         if isinstance(value, unicode):
-            for key, column in cls.sqlmeta.columns.items():
-                if (key == name) and isinstance(column, col.SOUnicodeCol):
-                    value = value.encode(column.dbEncoding)
-                    break
+            column = cls.sqlmeta.columns[name]
+            if isinstance(column, col.SOUnicodeCol):
+                value = value.encode(column.dbEncoding)
         return (connection or cls._connection)._SO_selectOneAlt(
             cls,
             [cls.sqlmeta.idName] +