]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- fixed SQL function truncation of trailing underscores
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 25 Mar 2008 17:25:20 +0000 (17:25 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 25 Mar 2008 17:25:20 +0000 (17:25 +0000)
[ticket:996]

CHANGES
lib/sqlalchemy/sql/expression.py
test/sql/functions.py

diff --git a/CHANGES b/CHANGES
index 5481768a6e483fe444de740beb5a6e8298039923..f9c2c5a7bd2bf5420b02f8605d76622b7c2319ff 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -20,7 +20,10 @@ CHANGES
 
     - Fixed bug which was preventing synonym() attributes from
       being used with inheritance
-
+      
+    - fixed SQL function truncation of trailing underscores
+      [ticket:996]
+      
     - Session.execute can now find binds from metadata
 
     - adjusted the definition of "self-referential" to be
index 0d10c844ae9d36c59971d1ea4388b49f6ac303a0..a3a25f57353dddafd6541c8322381ac7d143a5d2 100644 (file)
@@ -777,7 +777,7 @@ class _FunctionGenerator(object):
             except KeyError:
                 raise AttributeError(name)
 
-        elif name.startswith('_'):
+        elif name.endswith('_'):
             name = name[0:-1]
         f = _FunctionGenerator(**self.opts)
         f.__names = list(self.__names) + [name]
index e5c59b091c5f9ed45d22ea629054b46fc9aaa1e4..d1ce17c72f556bd7267e5ece011b53b45810cd4f 100644 (file)
@@ -32,7 +32,10 @@ class CompileTest(TestBase, AssertsCompiledSQL):
             else:
                 self.assert_compile(func.nosuchfunction(), "nosuchfunction()", dialect=dialect)
             self.assert_compile(func.char_length('foo'), "char_length(%s)" % bindtemplate % {'name':'param_1', 'position':1}, dialect=dialect)
-
+    
+    def test_underscores(self):
+        self.assert_compile(func.if_(), "if()")
+        
     def test_generic_now(self):
         assert isinstance(func.now().type, sqltypes.DateTime)