mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-24 12:13:33 +08:00
Fixes for over escaping in c2bed0a.
Fixes dozens of tool functional tests.
This commit is contained in:
@@ -7,7 +7,7 @@ from galaxy.util import inflector
|
||||
from galaxy.web.form_builder import CheckboxField
|
||||
from string import punctuation as PUNCTUATION
|
||||
import galaxy.queue_worker
|
||||
from markupsafe import escape
|
||||
from tool_shed.util.web_util import escape
|
||||
|
||||
from tool_shed.util import shed_util_common as suc
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ from galaxy.web.framework.helpers import grids, time_ago
|
||||
from galaxy.web.params import QuotaParamParser
|
||||
from tool_shed.util import common_util
|
||||
from tool_shed.util import encoding_util
|
||||
from markupsafe import escape
|
||||
from tool_shed.util.web_util import escape
|
||||
|
||||
log = logging.getLogger( __name__ )
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@ from galaxy import util
|
||||
from galaxy.web.form_builder import CheckboxField
|
||||
from galaxy.util import json
|
||||
from galaxy.model.orm import or_
|
||||
from markupsafe import escape
|
||||
|
||||
import tool_shed.repository_types.util as rt_util
|
||||
from tool_shed.util.web_util import escape
|
||||
|
||||
from tool_shed.util import common_util
|
||||
from tool_shed.util import encoding_util
|
||||
|
||||
@@ -3,7 +3,7 @@ import logging
|
||||
from galaxy import util
|
||||
from galaxy.util import inflector
|
||||
from galaxy import web
|
||||
from markupsafe import escape
|
||||
from tool_shed.util.web_util import escape
|
||||
|
||||
from galaxy.web.base.controller import BaseUIController
|
||||
from galaxy.web.base.controllers.admin import Admin
|
||||
|
||||
@@ -6,7 +6,6 @@ from time import gmtime
|
||||
from time import strftime
|
||||
from datetime import date
|
||||
from datetime import datetime
|
||||
from markupsafe import escape
|
||||
|
||||
from galaxy import util
|
||||
from galaxy import web
|
||||
@@ -19,6 +18,7 @@ from galaxy.model.orm import and_
|
||||
from tool_shed.capsule import capsule_manager
|
||||
from tool_shed.dependencies.repository import relation_builder
|
||||
|
||||
from tool_shed.util.web_util import escape
|
||||
from tool_shed.galaxy_install import dependency_display
|
||||
from tool_shed.metadata import repository_metadata_manager
|
||||
from tool_shed.utility_containers import ToolShedUtilityContainerManager
|
||||
|
||||
@@ -2,7 +2,7 @@ import logging
|
||||
import os
|
||||
|
||||
from sqlalchemy.sql.expression import func
|
||||
from markupsafe import escape
|
||||
from tool_shed.util.web_util import escape
|
||||
|
||||
from galaxy import util
|
||||
from galaxy import web
|
||||
|
||||
@@ -9,7 +9,7 @@ from galaxy import util
|
||||
from galaxy import web
|
||||
from galaxy.datatypes import checkers
|
||||
from galaxy.web.base.controller import BaseUIController
|
||||
from markupsafe import escape
|
||||
from tool_shed.util.web_util import escape
|
||||
|
||||
from tool_shed.dependencies import attribute_handlers
|
||||
from tool_shed.galaxy_install import dependency_display
|
||||
|
||||
@@ -7,7 +7,7 @@ from galaxy import util
|
||||
from galaxy import web
|
||||
from galaxy.web.form_builder import build_select_field
|
||||
from galaxy.webapps.tool_shed.model import directory_hash_id
|
||||
from markupsafe import escape
|
||||
from tool_shed.util.web_util import escape
|
||||
|
||||
from tool_shed.dependencies.repository import relation_builder
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
from markupsafe import escape as raw_escape
|
||||
|
||||
ALLOWED_ELEMENTS = ["<b>", "</b>", "<br/>"]
|
||||
ALLOWED_MAP = dict(map(lambda x: (x, raw_escape(x)), ALLOWED_ELEMENTS))
|
||||
|
||||
|
||||
def escape( value ):
|
||||
""" A tool shed variant of markupsafe.escape that allows a select few
|
||||
HTML elements that are repeatedly used in messages created deep
|
||||
in the toolshed components. Ideally abstract things would be produced
|
||||
in these components and messages in the views or client side - this is
|
||||
what should be worked toward - but for now - we have this hack.
|
||||
|
||||
>>> escape("A <b>repo</b>")
|
||||
u'A <b>repo</b>'
|
||||
"""
|
||||
escaped = str( raw_escape( value ) )
|
||||
# Unescape few selected tags.
|
||||
for key, value in ALLOWED_MAP.iteritems():
|
||||
escaped = escaped.replace(value, key)
|
||||
return escaped
|
||||
Reference in New Issue
Block a user