当前位置: 首页>>代码示例>>Python>>正文


Python StringEscapeUtils.unescapeHtml方法代码示例

本文整理汇总了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>|^&lt;p&gt;.*&lt;\/p&gt;", 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)
开发者ID:redbox-mint,项目名称:redbox,代码行数:35,代码来源:copyTfPackage.py

示例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)
开发者ID:kiranba,项目名称:the-fascinator,代码行数:4,代码来源:layout.py


注:本文中的org.apache.commons.lang.StringEscapeUtils.unescapeHtml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。