Commits

Mike Bayer  committed e5b3c74

- func.XXX() doesn't inadvertently resolve to non-Function
classes (e.g. fixes func.text()). [ticket:1798]

  • Participants
  • Parent commits 0d09f61

Comments (0)

Files changed (3)

     easier to produce specific subclasses of these which work in 
     alias/subquery situations.
 
+  - func.XXX() doesn't inadvertently resolve to non-Function 
+    classes (e.g. fixes func.text()).  [ticket:1798]
+
 - engines
   - Fixed building the C extensions on Python 2.4. [ticket:1781]
 

File lib/sqlalchemy/sql/expression.py

             if functions is None:
                 from sqlalchemy.sql import functions
             func = getattr(functions, self.__names[-1].lower(), None)
-            if func is not None:
+            if func is not None and \
+                    isinstance(func, type) and \
+                    issubclass(func, Function):
                 return func(*c, **o)
 
         return Function(

File test/sql/test_functions.py

             ('random', oracle.dialect())
         ]:
             self.assert_compile(func.random(), ret, dialect=dialect)
-
+    
+    def test_namespacing_conflicts(self):
+        self.assert_compile(func.text('foo'), 'text(:text_1)')
+        
     def test_generic_count(self):
         assert isinstance(func.count().type, sqltypes.Integer)