Skip to content

Commit

Permalink
Merge f1bad3a into addffdc
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien-berchet committed Jun 21, 2019
2 parents addffdc + f1bad3a commit 28a3500
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions geoalchemy2/elements.py
Expand Up @@ -61,6 +61,13 @@ def __getattr__(self, name):
# ST_Buffer(ST_GeomFromWKB(:ST_GeomFromWKB_1), :param_1)
#

# Function names that don't start with "ST_" are rejected.
# This is not to mess up with SQLAlchemy's use of
# hasattr/getattr on Column objects.

if not name.lower().startswith('st_'):
raise AttributeError

# We create our own _FunctionGenerator here, and use it in place of
# SQLAlchemy's "func" object. This is to be able to "bind" the
# function to the SQL expression. See also GenericFunction above.
Expand Down
4 changes: 2 additions & 2 deletions tests/test_functional.py
Expand Up @@ -256,7 +256,7 @@ def test_select_bindparam_WKBElement_extented(self):
rows = results.fetchall()
geom = rows[0][1]
assert isinstance(geom, WKBElement)
assert geom.extented
assert geom.extended is True

s = Lake.__table__.select().where(Lake.__table__.c.geom == bindparam('geom'))
results = self.conn.execute(s, geom=geom)
Expand Down Expand Up @@ -375,7 +375,7 @@ def test_pickle_unpickle(self):
unpickled = pickle.loads(pickled)
assert unpickled.geom.srid == 4326
assert str(unpickled.geom) == data_desc
assert unpickled.geom.extended
assert unpickled.geom.extended is True
assert unpickled.geom.name == 'ST_GeomFromEWKB'


Expand Down

0 comments on commit 28a3500

Please sign in to comment.