Permalink
Browse files

Refs #9608; Fixed preview for queries returning empty fields

  • Loading branch information...
1 parent cf8755a commit 75a90ec76c747071b8c4282acce0dda7b87aaf23 @zotya zotya committed Jan 31, 2013
Showing with 9 additions and 1 deletion.
  1. +2 −0 docs/HISTORY.txt
  2. +7 −1 eea/sparql/browser/sparql.py
View
@@ -5,6 +5,8 @@ Changelog
----------------------
* Upgrade step: Within "Plone > Site setup > Add-ons" click on
upgrade button available for eea.sparql.
+* Bug fix: Fixed preview for queries returning empty fields
+ [szabozo0 refs #9608]
* Feature: Added quick preview for sparql queries
[szabozo0 refs #9608]
* Feature: Data persistence and versioning
@@ -329,6 +329,9 @@ class QuickPreview(BrowserView):
def preview(self):
"""preview"""
tmp_query = self.request.get("sparql_query", "")
+ tmp_query = "\n".join(x for x in tmp_query.splitlines()
+ if not x.strip().startswith("#"))
+
tmp_arg_spec = self.request.get("arg_spec", "")
tmp_endpoint = self.request.get("endpoint", "")
tmp_timeout = int(self.request.get("timeout", "0"))
@@ -372,7 +375,10 @@ def preview(self):
for row in data.get('rows', []):
result.append(u"<tr class='row_0'>")
for value in row:
- result.append(u"<td> %s </td>" %cgi.escape(value.n3()))
+ try:
+ result.append(u"<td> %s </td>" %cgi.escape(value.n3()))
+ except:
+ result.append(u"<td> %s </td>" %value)
result.append(u"</tr>")
result.append(u"</tbody>")
result.append(u"</table>")

0 comments on commit 75a90ec

Please sign in to comment.