• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python i18n._函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中Mailman.i18n._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: _setValue

 def _setValue(self, mlist, property, val, doc):
     # Do value conversion from web representation to internal
     # representation.
     try:
         if property == 'bounce_processing':
             val = int(val)
         elif property == 'bounce_score_threshold':
             val = float(val)
         elif property == 'bounce_info_stale_after':
             val = days(int(val))
         elif property == 'bounce_you_are_disabled_warnings':
             val = int(val)
         elif property == 'bounce_you_are_disabled_warnings_interval':
             val = days(int(val))
         elif property == 'bounce_notify_owner_on_disable':
             val = int(val)
         elif property == 'bounce_notify_owner_on_removal':
             val = int(val)
     except ValueError:
         doc.addError(
             _("""Bad value for <a href="?VARHELP=bounce/%(property)s"
             >%(property)s</a>: %(val)s"""),
             tag = _('Error: '))
         return
     GUIBase._setValue(self, mlist, property, val, doc)
开发者ID:EdLeafe,项目名称:mailman_config,代码行数:25,代码来源:Bounce.py


示例2: GetStandardReplacements

 def GetStandardReplacements(self, lang=None):
     dmember_len = len(self.getDigestMemberKeys())
     member_len = len(self.getRegularMemberKeys())
     # If only one language is enabled for this mailing list, omit the
     # language choice buttons.
     if len(self.GetAvailableLanguages()) == 1:
         listlangs = _(Utils.GetLanguageDescr(self.preferred_language))
     else:
         listlangs = self.GetLangSelectBox(lang).Format()
     d = {
         '<mm-mailman-footer>' : self.GetMailmanFooter(),
         '<mm-list-name>' : self.real_name,
         '<mm-email-user>' : self._internal_name,
         '<mm-list-description>' : Utils.websafe(self.description),
         '<mm-list-info>' : 
             '<!---->' + BR.join(self.info.split(NL)) + '<!---->',
         '<mm-form-end>'  : self.FormatFormEnd(),
         '<mm-archive>'   : self.FormatArchiveAnchor(),
         '</mm-archive>'  : '</a>',
         '<mm-list-subscription-msg>' : self.FormatSubscriptionMsg(),
         '<mm-restricted-list-message>' : \
             self.RestrictedListMessage(_('The current archive'),
                                        self.archive_private),
         '<mm-num-reg-users>' : `member_len`,
         '<mm-num-digesters>' : `dmember_len`,
         '<mm-num-members>' : (`member_len + dmember_len`),
         '<mm-posting-addr>' : '%s' % self.GetListEmail(),
         '<mm-request-addr>' : '%s' % self.GetRequestEmail(),
         '<mm-owner>' : self.GetOwnerEmail(),
         '<mm-reminder>' : self.FormatReminder(self.preferred_language),
         '<mm-host>' : self.host_name,
         '<mm-list-langs>' : listlangs,
         }
开发者ID:fumiyas,项目名称:mailman-ja-utf8-debian,代码行数:33,代码来源:HTMLFormatter.py


示例3: loginpage

def loginpage(mlist, scriptname, msg='', frontpage=None):
    url = mlist.GetScriptURL(scriptname)
    if frontpage:
        actionurl = url
    else:
        actionurl = Utils.GetRequestURI(url)
    if msg:
        msg = FontAttr(msg, color='#ff0000', size='+1').Format()
        # give an HTTP 401 for authentication failure
        print 'Status: 401 Unauthorized'
    if scriptname == 'admindb':
        who = _('Moderator')
    else:
        who = _('Administrator')
    # Language stuff
    charset = Utils.GetCharSet(mlist.preferred_language)
    print 'Content-type: text/html; charset=' + charset + '\n\n'
    print Utils.maketext(
        'admlogin.html',
        {'listname': mlist.real_name,
         'path'    : actionurl,
         'message' : msg,
         'who'     : who,
         }, mlist=mlist)
    print mlist.GetMailmanFooter()
开发者ID:EdLeafe,项目名称:mailman_config,代码行数:25,代码来源:Auth.py


示例4: maybe_forward

def maybe_forward(mlist, msg):
    # Does the list owner want to get non-matching bounce messages?
    # If not, simply discard it.
    if mlist.bounce_unrecognized_goes_to_list_owner:
        adminurl = mlist.GetScriptURL('admin', absolute=1) + '/bounce'
        mlist.ForwardMessage(msg,
                             text=_("""\
The attached message was received as a bounce, but either the bounce format
was not recognized, or no member addresses could be extracted from it.  This
mailing list has been configured to send all unrecognized bounce messages to
the list administrator(s).

For more information see:
%(adminurl)s

"""),
                             subject=_('Uncaught bounce notification'),
                             tomoderators=0)
        syslog('bounce',
               '%s: forwarding unrecognized, message-id: %s',
               mlist.internal_name(),
               msg.get('message-id', 'n/a'))
    else:
        syslog('bounce',
               '%s: discarding unrecognized, message-id: %s',
               mlist.internal_name(),
               msg.get('message-id', 'n/a'))
开发者ID:darix,项目名称:mailman,代码行数:27,代码来源:BounceRunner.py


示例5: _setValue

 def _setValue(self, mlist, property, val, doc):
     # Watch for the special, immediate action attributes
     if property == "_new_volume" and val:
         mlist.bump_digest_volume()
         volume = mlist.volume
         number = mlist.next_digest_number
         doc.AddItem(
             _(
                 """The next digest will be sent as volume
         %(volume)s, number %(number)s"""
             )
         )
     elif property == "_send_digest_now" and val:
         status = mlist.send_digest_now()
         if status:
             doc.AddItem(_("""A digest has been sent."""))
         else:
             doc.AddItem(_("""There was no digest to send."""))
     else:
         # Everything else...
         if property in ("digest_header", "digest_footer"):
             val = self._convertString(mlist, property, ALLOWEDS, val, doc)
             if val is None:
                 # There was a problem, so don't set it
                 return
         GUIBase._setValue(self, mlist, property, val, doc)
开发者ID:KWMSources,项目名称:mailman_config,代码行数:26,代码来源:Digest.py


示例6: OpenIDOption

    def OpenIDOption(self, lang):
        #from Cgi import client
        container = Container()
        hostname = mm_cfg.DEFAULT_URL_HOST
        hostid = mm_cfg.DEFAULT_OID_CONSUMER
#       if self.private_roster == 0:
#            either = _('<b><i>either</i></b> ')
#        else:
#            either = ''
#        realname = self.real_name
        container.AddItem(Hidden('language', lang))
        if not self.private_roster:
            container.AddItem(_("Click here for the list of ")
                              + self.real_name
                              + _(" subscribers: "))
            container.AddItem(SubmitButton('LoginThrough',
                                           _("Visit Subscriber list")))
        else:
            if self.private_roster == 1:
                only = _('members')
                whom = _('Address:')
            else:
                only = _('the list administrator')
                whom = _('Admin address:')

        container.AddItem(_("<B> <p>Use Common ")
                             # + whom[:-1].lower()
                              + _("Authentication to access"
                              "  <a href='http://%(hostname)s:%(hostid)s'>  all lists</a>  <p> </B> ")
                              + _("<p> <B> You can enable Common Authentication <a href='http://%(hostname)s/mailman/openidreg'> Enable </a> </B>")
                        #      + whom
                              + " ")
        container.AddItem("</center>")         

        return container
开发者ID:jdk2588,项目名称:systers-gsoc10-membership,代码行数:35,代码来源:HTMLFormatter.py


示例7: GetConfigSubCategories

 def GetConfigSubCategories(self, category):
     if category == 'members':
         return [('list',   _('Membership&nbsp;List')),
                 ('add',    _('Mass&nbsp;Subscription')),
                 ('remove', _('Mass&nbsp;Removal')),
                 ]
     return None
开发者ID:EdLeafe,项目名称:mailman_config,代码行数:7,代码来源:Membership.py


示例8: handleForm

 def handleForm(self, mlist, category, subcat, cgidata, doc):
     for item in self.GetConfigInfo(mlist, category, subcat):
         # Skip descriptions and legacy non-attributes
         if not isinstance(item, TupleType) or len(item) < 5:
             continue
         # Unpack the gui item description
         property, wtype, args, deps, desc = item[0:5]
         # BAW: I know this code is a little crufty but I wanted to
         # reproduce the semantics of the original code in admin.py as
         # closely as possible, for now.  We can clean it up later.
         #
         # The property may be uploadable...
         uploadprop = property + '_upload'
         if cgidata.has_key(uploadprop) and cgidata[uploadprop].value:
             val = cgidata[uploadprop].value
         elif not cgidata.has_key(property):
             continue
         elif isinstance(cgidata[property], ListType):
             val = [x.value for x in cgidata[property]]
         else:
             val = cgidata[property].value
         # Coerce the value to the expected type, raising exceptions if the
         # value is invalid.
         try:
             val = self._getValidValue(mlist, property, wtype, val)
         except ValueError:
             doc.addError(_('Invalid value for variable: %(property)s'))
         # This is the parent of MMBadEmailError and MMHostileAddress
         except Errors.EmailAddressError, error:
             doc.addError(
                 _('Bad email address for option %(property)s: %(error)s'))
         else:
             # Set the attribute, which will normally delegate to the mlist
             self._setValue(mlist, property, val, doc)
开发者ID:fumiyas,项目名称:mailman-ja-utf8-debian,代码行数:34,代码来源:GUIBase.py


示例9: process

def process(mlist, msg, msgdata):
    # Extract the sender's address and find them in the user database
    sender = msgdata.get('original_sender', msg.get_sender())
    try:
        ack = mlist.getMemberOption(sender, mm_cfg.AcknowledgePosts)
        if not ack:
            return
    except Errors.NotAMemberError:
        return
    # Okay, they want acknowledgement of their post.  Give them their original
    # subject.  BAW: do we want to use the decoded header?
    origsubj = msgdata.get('origsubj', msg.get('subject', _('(no subject)')))
    # Get the user's preferred language
    lang = msgdata.get('lang', mlist.getMemberLanguage(sender))
    # Now get the acknowledgement template
    realname = mlist.real_name
    text = Utils.maketext(
        'postack.txt',
        {'subject'     : Utils.oneline(origsubj, Utils.GetCharSet(lang)),
         'listname'    : realname,
         'listinfo_url': mlist.GetScriptURL('listinfo', absolute=1),
         'optionsurl'  : mlist.GetOptionsURL(sender, absolute=1),
         }, lang=lang, mlist=mlist, raw=1)
    # Craft the outgoing message, with all headers and attributes
    # necessary for general delivery.  Then enqueue it to the outgoing
    # queue.
    subject = _('%(realname)s post acknowledgement')
    usermsg = Message.UserNotification(sender, mlist.GetBouncesEmail(),
                                       subject, text, lang)
    usermsg.send(mlist)
开发者ID:EdLeafe,项目名称:mailman_config,代码行数:30,代码来源:Acknowledge.py


示例10: scrub_msg822

    def scrub_msg822(self, part):
        # submessage
        submsg = part.get_payload(0)
        omask = os.umask(002)
        try:
            url = save_attachment(self.mlist, part, self.dir)
        finally:
            os.umask(omask)
        subject = submsg.get('subject', _('no subject'))
        subject = Utils.oneline(subject, self.lcset)
        date = submsg.get('date', _('no date'))
        who = submsg.get('from', _('unknown sender'))
        who = Utils.oneline(who, self.lcset)
        size = len(str(submsg))
        self.msgtexts.append(unicode(_("""\
An embedded message was scrubbed...
From: %(who)s
Subject: %(subject)s
Date: %(date)s
Size: %(size)s
URL: %(url)s
"""), self.lcset))
        # Replace this part because subparts should not be walk()-ed.
        del part['content-type']
        part.set_payload('blah blah', 'us-ascii')
开发者ID:atsuoishimoto,项目名称:mailman-2.1-ja,代码行数:25,代码来源:Scrubber.py


示例11: MailmanLogo

def MailmanLogo():
    t = Table(border=0, width='100%')

    version = mm_cfg.VERSION
    mmlink = _("Delivered by Mailman")
    pylink = _("Python Powered")
    gnulink = _("GNU's Not Unix")
    if mm_cfg.SITE_LINK:
        sitelink = mm_cfg.SITE_TEXT

    if mm_cfg.IMAGE_LOGOS:
        def logo(file, alt, base=mm_cfg.IMAGE_LOGOS):
            return '<img src="%s" alt="%s" border="0" />' % \
              (base + file, alt)
        mmlink = logo(DELIVERED_BY, mmlink)
        pylink = logo(PYTHON_POWERED, pylink)
        gnulink = logo(GNU_HEAD, gnulink)
        if mm_cfg.SITE_LINK:
            sitelink = logo(mm_cfg.SITE_LOGO, sitelink, "")

    mmlink = Link(MAILMAN_URL, mmlink + _('<br>version %(version)s'))
    pylink = Link(PYTHON_URL, pylink)
    gnulink = Link(GNU_URL, gnulink)
    links = [mmlink, pylink, gnulink]
    if mm_cfg.SITE_LINK:
        if mm_cfg.SITE_URL:
            sitelink = Link(mm_cfg.SITE_URL, sitelink)
        links.append(sitelink)
    t.AddRow(links)
    return t
开发者ID:fumiyas,项目名称:mailman-ja-utf8-debian,代码行数:30,代码来源:htmlformat.py


示例12: do_discard

def do_discard(mlist, msg):
    sender = msg.get_sender()
    # Do we forward auto-discards to the list owners?
    if mlist.forward_auto_discards:
        lang = mlist.preferred_language
        varhelp = '%s/?VARHELP=privacy/sender/discard_these_nonmembers' % \
                  mlist.GetScriptURL('admin', absolute=1)
        nmsg = Message.UserNotification(mlist.GetOwnerEmail(),
                                        mlist.GetBouncesEmail(),
                                        _('Auto-discard notification'),
                                        lang=lang)
        nmsg.set_type('multipart/mixed')
        text = MIMEText(Utils.wrap(_(
            'The attached message has been automatically discarded.')),
                        _charset=Utils.GetCharSet(lang))
        nmsg.attach(text)

        decrypted = msg.get('X-Mailman-SLS-decrypted', '').lower()
        if decrypted == 'yes':
            syslog('gpg',
 'forwarding only headers of message from %s to listmaster to notify discard since message was decrypted',
 sender)
            msgtext = msg.as_string()
            (header, body) = msgtext.split("\n\n", 1)
            nmsg.attach(MIMEText(header))
        else:
            nmsg.attach(MIMEMessage(msg))

        nmsg.send(mlist)
    # Discard this sucker
    raise Errors.DiscardMessage
开发者ID:jurov,项目名称:gnu-mailman,代码行数:31,代码来源:Moderate.py


示例13: GetConfigSubCategories

 def GetConfigSubCategories(self, category):
     if category == 'privacy':
         return [('subscribing', _('Subscription&nbsp;rules')),
                 ('sender',      _('Sender&nbsp;filters')),
                 ('recipient',   _('Recipient&nbsp;filters')),
                 ('spam',        _('Spam&nbsp;filters')),
                 ]
     return None
开发者ID:EdLeafe,项目名称:mailman_config,代码行数:8,代码来源:Privacy.py


示例14: do_reject

def do_reject(mlist):
    listowner = mlist.GetOwnerEmail()
    if mlist.nonmember_rejection_notice:
        raise Errors.RejectMessage, \
              Utils.wrap(_(mlist.nonmember_rejection_notice))
    else:
        raise Errors.RejectMessage, Utils.wrap(_("""\
You are not allowed to post to this mailing list, and your message has been
automatically rejected.  If you think that your messages are being rejected in
error, contact the mailing list owner at %(listowner)s."""))
开发者ID:EdLeafe,项目名称:mailman_config,代码行数:10,代码来源:Moderate.py


示例15: convert

def convert(mlist):
    for attr in ('msg_header', 'msg_footer', 'digest_header', 'digest_footer',
                 'autoresponse_postings_text', 'autoresponse_admin_text',
                 'autoresponse_request_text'):
        s = getattr(mlist, attr)
        t = Utils.to_dollar(s)
        setattr(mlist, attr, t)
    mlist.use_dollar_strings = 1
    print _('Saving list')
    mlist.Save()
开发者ID:EmilyDirsh,项目名称:Paperboy,代码行数:10,代码来源:convert.py


示例16: RestrictedListMessage

 def RestrictedListMessage(self, which, restriction):
     if not restriction:
         return ''
     elif restriction == 1:
         return _(
             '''(<i>%(which)s is only available to the list
             members.</i>)''')
     else:
         return _('''(<i>%(which)s is only available to the list
         administrator.</i>)''')
开发者ID:fumiyas,项目名称:mailman-ja-utf8-debian,代码行数:10,代码来源:HTMLFormatter.py


示例17: do_reject

def do_reject(mlist):
    listowner = mlist.GetOwnerEmail()
    if mlist.nonmember_rejection_notice:
        raise Errors.RejectMessage, \
              Utils.wrap(_(mlist.nonmember_rejection_notice))
    else:
        raise Errors.RejectMessage, Utils.wrap(_("""\
Your message has been rejected, probably because you are not subscribed to the
mailing list and the list's policy is to prohibit non-members from posting to
it.  If you think that your messages are being rejected in error, contact the
mailing list owner at %(listowner)s."""))
开发者ID:jurov,项目名称:gnu-mailman,代码行数:11,代码来源:Moderate.py


示例18: scrub_text

    def scrub_text(self, part):
        # Plain text scrubber.
        omask = os.umask(002)
        try:
            url = save_attachment(self.mlist, part, self.dir)
        finally:
            os.umask(omask)
        filename = part.get_filename(_('not available'))
        filename = Utils.oneline(filename, self.lcset)
        self.msgtexts.append(unicode(_("""\
An embedded and charset-unspecified text was scrubbed...
Name: %(filename)s
URL: %(url)s
"""), self.lcset))
开发者ID:atsuoishimoto,项目名称:mailman-2.1-ja,代码行数:14,代码来源:Scrubber.py


示例19: GetConfigInfo

    def GetConfigInfo(self, mlist, category, subcat=None):
        if category <> 'topics':
            return None
        WIDTH = mm_cfg.TEXTFIELDWIDTH

        return [
            _('List topic keywords'),

            ('topics_enabled', mm_cfg.Radio, (_('Disabled'), _('Enabled')), 0,
             _('''Should the topic filter be enabled or disabled?'''),

             _("""The topic filter categorizes each incoming email message
             according to <a
            href="http://docs.python.org/library/re.html">regular
             expression filters</a> you specify below.  If the message's
             <code>Subject:</code> or <code>Keywords:</code> header contains a
             match against a topic filter, the message is logically placed
             into a topic <em>bucket</em>.  Each user can then choose to only
             receive messages from the mailing list for a particular topic
             bucket (or buckets).  Any message not categorized in a topic
             bucket registered with the user is not delivered to the list.

             <p>Note that this feature only works with regular delivery, not
             digest delivery.

             <p>The body of the message can also be optionally scanned for
             <code>Subject:</code> and <code>Keywords:</code> headers, as
             specified by the <a
       href="?VARHELP=topics/topics_bodylines_limit">topics_bodylines_limit</a>
             configuration variable.""")),

            ('topics_bodylines_limit', mm_cfg.Number, 5, 0,
             _('How many body lines should the topic matcher scan?'),

             _("""The topic matcher will scan this many lines of the message
             body looking for topic keyword matches.  Body scanning stops when
             either this many lines have been looked at, or a non-header-like
             body line is encountered.  By setting this value to zero, no body
             lines will be scanned (i.e. only the <code>Keywords:</code> and
             <code>Subject:</code> headers will be scanned).  By setting this
             value to a negative number, then all body lines will be scanned
             until a non-header-like line is encountered.
             """)),

            ('topics', mm_cfg.Topics, 0, 0,
             _('Topic keywords, one per line, to match against each message.'),

             _("""Each topic keyword is actually a regular expression, which is
             matched against certain parts of a mail message, specifically the
             <code>Keywords:</code> and <code>Subject:</code> message headers.
             Note that the first few lines of the body of the message can also
             contain a <code>Keywords:</code> and <code>Subject:</code>
             "header" on which matching is also performed.""")),

            ]
开发者ID:EdLeafe,项目名称:mailman_config,代码行数:55,代码来源:Topics.py


示例20: do_command

    def do_command(self, cmd, args=None):
        if args is None:
            args = ()
        # Try to import a command handler module for this command
        modname = 'Mailman.Commands.cmd_' + cmd
        try:
            __import__(modname)
            handler = sys.modules[modname]
        # ValueError can be raised if cmd has dots in it.
        except (ImportError, ValueError):
            # If we're on line zero, it was the Subject: header that didn't
            # contain a command.  It's possible there's a Re: prefix (or
            # localized version thereof) on the Subject: line that's messing
            # things up.  Pop the prefix off and try again... once.
            #
            # If that still didn't work it isn't enough to stop processing.
            # BAW: should we include a message that the Subject: was ignored?
            if not self.subjcmdretried and args:
                self.subjcmdretried += 1
                cmd = args.pop(0)
                return self.do_command(cmd, args)
            return self.lineno <> 0
	# with Dlists, we don't allow email subscription
  	if DlistUtils.enabled(self.mlist) and (cmd == 'subscribe' or cmd == 'join'):
            realname = self.mlist.real_name
            domain = Utils.get_domain()
            self.results.append(Utils.wrap(_("""\
This list cannot be subscribed to via email. 
Please use the website at http://%(domain)s/mailman/listinfo/%(realname)s .
""")))
            return self.lineno <> 0 # superstitious behavior as they do it above

	return handler.process(self, args)
开发者ID:jdk2588,项目名称:systers-gsoc10-membership,代码行数:33,代码来源:CommandRunner.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python i18n.get_translation函数代码示例发布时间:2022-05-24
下一篇:
Python Syslog.syslog函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap