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


Python Utils.percent_identifiers方法代码示例

本文整理汇总了Python中Mailman.Utils.percent_identifiers方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.percent_identifiers方法的具体用法?Python Utils.percent_identifiers怎么用?Python Utils.percent_identifiers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mailman.Utils的用法示例。


在下文中一共展示了Utils.percent_identifiers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _convertString

# 需要导入模块: from Mailman import Utils [as 别名]
# 或者: from Mailman.Utils import percent_identifiers [as 别名]
 def _convertString(self, mlist, property, alloweds, val, doc):
     # Is the list using $-strings?
     dollarp = getattr(mlist, 'use_dollar_strings', 0)
     if dollarp:
         ids = Utils.dollar_identifiers(val)
     else:
         # %-strings
         ids = Utils.percent_identifiers(val)
     # Here's the list of allowable interpolations
     for allowed in alloweds:
         if ids.has_key(allowed):
             del ids[allowed]
     if ids:
         # What's left are not allowed
         badkeys = ids.keys()
         badkeys.sort()
         bad = BADJOINER.join(badkeys)
         doc.addError(_(
             """The following illegal substitution variables were
             found in the <code>%(property)s</code> string:
             <code>%(bad)s</code>
             <p>Your list may not operate properly until you correct this
             problem."""), tag=_('Warning: '))
         return val
     # Now if we're still using %-strings, do a roundtrip conversion and
     # see if the converted value is the same as the new value.  If not,
     # then they probably left off a trailing `s'.  We'll warn them and use
     # the corrected string.
     if not dollarp:
         fixed = Utils.to_percent(Utils.to_dollar(val))
         if fixed <> val:
             doc.addError(_(
                 """Your <code>%(property)s</code> string appeared to
                 have some correctable problems in its new value.
                 The fixed value will be used instead.  Please
                 double check that this is what you intended.
                 """))
             return fixed
     return val
开发者ID:fumiyas,项目名称:mailman-ja-utf8-debian,代码行数:41,代码来源:GUIBase.py


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