本文整理汇总了Python中org.apache.commons.lang.StringEscapeUtils.unescapeHtml方法的典型用法代码示例。如果您正苦于以下问题:Python StringEscapeUtils.unescapeHtml方法的具体用法?Python StringEscapeUtils.unescapeHtml怎么用?Python StringEscapeUtils.unescapeHtml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang.StringEscapeUtils
的用法示例。
在下文中一共展示了StringEscapeUtils.unescapeHtml方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setMultiDescription
# 需要导入模块: from org.apache.commons.lang import StringEscapeUtils [as 别名]
# 或者: from org.apache.commons.lang.StringEscapeUtils import unescapeHtml [as 别名]
def setMultiDescription(self, tfPackageJson, descriptionValue):
if descriptionValue is None:
self.log.info("No description found. Aborting set description shadow...")
tfPackageJson.put("dc:description.1.text", "")
tfPackageJson.put("dc:description.1.shadow", "")
tfPackageJson.put("dc:description.1.type", "full")
return
else:
## no tags are added to wysiwyg until user interacts with wysiwyg editor
unescapedDescription = ""
escapedDescription = ""
rawDescription = StringUtils.defaultString("%s" % descriptionValue)
## sanitize the incoming description
self.log.debug("raw deprecated description is: %s" % rawDescription)
sanitizedDescription = OwaspSanitizer.sanitizeHtml("dc:description.1.text", rawDescription)
if (sanitizedDescription):
# not completely accurate for checking for tags but ensures a style consistent with wysiwyg editor
if re.search("^<p>.*</p>|^<p>.*<\/p>", sanitizedDescription):
## deprecated description may be unescaped or escaped already - so ensure both cases covered
unescapedDescription = StringEscapeUtils.unescapeHtml("%s" % sanitizedDescription)
escapedDescription = OwaspSanitizer.escapeHtml("%s" % sanitizedDescription)
else:
unescapedDescription = StringEscapeUtils.unescapeHtml("<p>%s</p>" % sanitizedDescription)
escapedDescription = OwaspSanitizer.escapeHtml("<p>%s</p>" % sanitizedDescription)
self.log.info("relevant unescaped description is: %s" % unescapedDescription)
self.log.info("relevant escaped description is: %s" % escapedDescription)
tfPackageJson.put("dc:description.1.text", unescapedDescription)
tfPackageJson.put("dc:description.1.shadow", escapedDescription)
tfPackageJson.put("dc:description.1.type", "full")
self.log.debug("Removing deprecated 'dc:description' key...")
tfPackageJson.remove("dc:description")
self.log.debug(
"Completed migrating 'dc:description' to dc:description.1.text|shadow" % tfPackageJson)
示例2: unescapeHtml
# 需要导入模块: from org.apache.commons.lang import StringEscapeUtils [as 别名]
# 或者: from org.apache.commons.lang.StringEscapeUtils import unescapeHtml [as 别名]
def unescapeHtml(self, text):
return StringEscapeUtils.unescapeHtml(text)