From 8b54b59f2becae0a307b6953e74a92a5bc2741b5 Mon Sep 17 00:00:00 2001 From: Murtuza Zabuawala Date: Fri, 3 Jun 2016 15:36:40 +0530 Subject: [PATCH] Fixes #1285 - Update the comments (description) over the tablespace properly. --- .../browser/server_groups/servers/tablespaces/__init__.py | 4 ++-- .../tablespaces/templates/tablespaces/sql/9.1_plus/update.sql | 2 +- .../tablespaces/templates/tablespaces/sql/9.2_plus/update.sql | 2 +- .../tablespaces/templates/tablespaces/sql/pre_9.1/update.sql | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py b/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py index cec961586..2a9976ea9 100644 --- a/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py @@ -412,7 +412,7 @@ class TablespaceView(PGChildNodeView): if SQL and SQL.strip('\n') and SQL.strip(' '): return make_json_response( - data=SQL, + data=SQL.strip('\n'), status=200 ) @@ -518,7 +518,7 @@ class TablespaceView(PGChildNodeView): SQL = sql_header + SQL - return ajax_response(response=SQL) + return ajax_response(response=SQL.strip('\n')) @check_precondition diff --git a/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/9.1_plus/update.sql b/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/9.1_plus/update.sql index d39e457ac..24f818b80 100644 --- a/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/9.1_plus/update.sql +++ b/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/9.1_plus/update.sql @@ -15,7 +15,7 @@ ALTER TABLESPACE {{ conn|qtIdent(data.name) }} {% endif %} {# ==== To update tablespace comments ==== #} -{% if data.description and data.description != o_data.description %} +{% if data.description is defined and data.description != o_data.description %} COMMENT ON TABLESPACE {{ conn|qtIdent(data.name) }} IS {{ data.description|qtLiteral }}; diff --git a/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/9.2_plus/update.sql b/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/9.2_plus/update.sql index aac55b1c1..f0afd78f2 100644 --- a/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/9.2_plus/update.sql +++ b/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/9.2_plus/update.sql @@ -16,7 +16,7 @@ ALTER TABLESPACE {{ conn|qtIdent(data.name) }} {% endif %} {# ==== To update tablespace comments ==== #} -{% if data.description and data.description != o_data.description %} +{% if data.description is defined and data.description != o_data.description %} COMMENT ON TABLESPACE {{ conn|qtIdent(data.name) }} IS {{ data.description|qtLiteral }}; diff --git a/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/pre_9.1/update.sql b/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/pre_9.1/update.sql index d39e457ac..13ca953bb 100644 --- a/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/pre_9.1/update.sql +++ b/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/pre_9.1/update.sql @@ -15,7 +15,7 @@ ALTER TABLESPACE {{ conn|qtIdent(data.name) }} {% endif %} {# ==== To update tablespace comments ==== #} -{% if data.description and data.description != o_data.description %} +{% if data.description is defined and data.description != o_data.description %} COMMENT ON TABLESPACE {{ conn|qtIdent(data.name) }} IS {{ data.description|qtLiteral }};