Browse files

Improve layers query in getCapabilitiesData

+ Query layers by lset id, not by name.
+ Correctly get layer title.
  • Loading branch information...
1 parent 0f05284 commit d0a1e789289b6b20941ca976104ba50af1cccc3b @monoid committed Mar 20, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 nrcgit/wmsmash/relay/
@@ -13,25 +13,25 @@ def getCapabilitiesData(dbpool, user, set_name):
If layerset does not exists, None is returned."""
# Get layerset info: name, title, abastract, author name
lset = yield dbpool.runQuery(
-"""SELECT, title, abstract, auth_user.username FROM editor_set JOIN auth_user ON = editor_set.author_id WHERE auth_user.username = %s AND = %s
+"""SELECT, title, abstract, auth_user.username, FROM editor_set JOIN auth_user ON = editor_set.author_id WHERE auth_user.username = %s AND = %s
""", (user, set_name,))
# Fetch layers in the layerset and return a tuple (layersetData, layerdata)
if lset:
# TODO visible and public fields too, as we need them to
# reconstruct whole tree.
layers = yield dbpool.runQuery(
- editor_layer.title, editor_layer.abstract,,
+ editor_layertree.title, editor_layer.abstract,,
editor_layertree.parent_id, editor_layertree.first_id, editor_layertree.nxt_id,
editor_layer.latlngbb, editor_layer.capablilities
- FROM editor_layertree JOIN editor_set ON editor_layertree.lset_id =
+ FROM editor_layertree
LEFT JOIN editor_layer ON editor_layertree.layer_id =
LEFT JOIN editor_server ON editor_layer.server_id =
LEFT JOIN editor_namedlayertree ON = editor_layertree.named_id
LEFT JOIN editor_namedlayer ON = editor_layer.named_id
- WHERE = %s
-ORDER BY parent_id ASC, nxt_id DESC""", (set_name,))
+ WHERE editor_layertree.lset_id = %s
+ORDER BY parent_id ASC, nxt_id DESC""", (lset[0][4],))
defer.returnValue((lset[0], layers))

0 comments on commit d0a1e78

Please sign in to comment.