From bd485d37c9e2912d1a13fb66d4aa25ebf9256b2a Mon Sep 17 00:00:00 2001 From: mdipierro Date: Tue, 8 Jan 2013 08:49:18 -0600 Subject: [PATCH] fixed st_x and st_y, thanks Paolo Valleri --- VERSION | 2 +- gluon/dal.py | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 11f9dcf6..359d305c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.4.1-alpha.2+timestamp.2013.01.07.10.33.48 +Version 2.4.1-alpha.2+timestamp.2013.01.08.08.48.34 diff --git a/gluon/dal.py b/gluon/dal.py index 8957c893..6c0f7b71 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -2582,6 +2582,18 @@ class PostgreSQLAdapter(BaseAdapter): """ return 'ST_AsText(%s)' %(self.expand(first)) + def ST_X(self, first): + """ + http://postgis.org/docs/ST_X.html + """ + return 'ST_X(%s)' %(self.expand(first)) + + def ST_Y(self, first): + """ + http://postgis.org/docs/ST_Y.html + """ + return 'ST_Y(%s)' %(self.expand(first)) + def ST_CONTAINS(self, first, second): """ http://postgis.org/docs/ST_Contains.html @@ -8417,6 +8429,14 @@ class Expression(object): db = self.db return Expression(db, db._adapter.ST_ASTEXT, self, type='string') + def st_x(self): + db = self.db + return Expression(db, db._adapter.ST_X, self, type='string') + + def st_y(self): + db = self.db + return Expression(db, db._adapter.ST_Y, self, type='string') + def st_distance(self, other): db = self.db return Expression(db,db._adapter.ST_DISTANCE,self,other, 'double')