486 |
if _cannot_run_postgis_tests: |
if _cannot_run_postgis_tests: |
487 |
raise support.SkipTest(_cannot_run_postgis_tests) |
raise support.SkipTest(_cannot_run_postgis_tests) |
488 |
|
|
489 |
|
def skip_if_addgeometrycolumn_does_not_use_quote_ident(): |
490 |
|
"""Skip a test if the AddGeometryColumn function doesn't use quote_ident |
491 |
|
|
492 |
|
If the AddGeometryColumn function doesn't use quote_ident it doesn't |
493 |
|
support unusual table or column names properly, that is, it will |
494 |
|
fail with errors for names that contain spaces or double quotes. |
495 |
|
|
496 |
|
The test performed by this function is a bit simplistic because it |
497 |
|
only tests whether the string 'quote_ident' occurs anywhere in the |
498 |
|
postgis.sql file. This will hopefully works because when this was |
499 |
|
fixed in postgis CVS AddGeometryColumn was the first function to use |
500 |
|
quote_ident. |
501 |
|
""" |
502 |
|
f = file(find_postgis_sql()) |
503 |
|
content = f.read() |
504 |
|
f.close() |
505 |
|
if content.find("quote_ident") < 0: |
506 |
|
raise support.SkipTest("AddGeometryColumn doesn't use quote_ident") |
507 |
|
|
508 |
def coords_to_point(coords): |
def coords_to_point(coords): |
509 |
"""Return string with a WKT representation of the point in coords""" |
"""Return string with a WKT representation of the point in coords""" |
510 |
x, y = coords[0] |
x, y = coords[0] |