Commits

Ralph Bean committed 5d2add6

Ran into a weird case while writing pyramid docs.

Comments (0)

Files changed (1)

tw2/sqla/widgets.py

     def to_python(self, value):
         if not value:
             return None
+
+        # How could this happen (that we are already to_python'd)?
+        if isinstance(value, self.entity):
+            return value
+
         if isinstance(self.primary_key.type, sa.types.Integer):
             try:
                 value = int(value)