本文整理汇总了Python中Mailman.Utils.get_domain方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.get_domain方法的具体用法?Python Utils.get_domain怎么用?Python Utils.get_domain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mailman.Utils
的用法示例。
在下文中一共展示了Utils.get_domain方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_command
# 需要导入模块: from Mailman import Utils [as 别名]
# 或者: from Mailman.Utils import get_domain [as 别名]
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)
示例2: __init__
# 需要导入模块: from Mailman import Utils [as 别名]
# 或者: from Mailman.Utils import get_domain [as 别名]
def __init__ (self, templ):
self._cgidata = cgi.FieldStorage()
self._templ = templ
self._curr_user = get_curr_user()
self._all_mls = None
self._templ_dir = "../templates/en"
self.kwargs = {'auto_version' : auto_version,
'curr_user' : self.curr_user,
'logged_user' : get_curr_user(raw=True),
'hostname' : Utils.get_domain(),
}
self.more_headers = []
示例3: openidreg_overview
# 需要导入模块: from Mailman import Utils [as 别名]
# 或者: from Mailman.Utils import get_domain [as 别名]
def openidreg_overview(lang, msg=''):
# Present the general listinfo overview
hostname = Utils.get_domain()
# Set up the document and assign it the correct language. The only one we
# know about at the moment is the server's default.
doc = Document()
# doc.set_language(lang)
doc.set_language(mm_cfg.DEFAULT_SERVER_LANGUAGE)
legend = _(" OpenID Registeration for Systers Mailing Lists")
doc.SetTitle(legend)
table = Table(border=0, width="100%")
table.AddRow([Center(Header(2, legend))])
table.AddCellInfo(table.GetCurrentRowIndex(), 0, colspan=2,
bgcolor=mm_cfg.WEB_HEADER_COLOR)
# Skip any mailing lists that isn't advertised.
if msg:
greeting = FontAttr(msg, color="ff5060", size="+1")
else:
greeting = FontAttr(_('Welcome!'), size='+2')
welcome = [greeting]
mailmanlink = Link(mm_cfg.MAILMAN_URL, _('Mailman')).Format()
# set up some local variables
adj = msg and _('right') or ''
siteowner = Utils.get_site_email()
welcome.extend(
(_(''' This is the Systers OpenID registeration form . To enable your systers account fill in the following entries.
<p>or Go back to the listinfo page if already using it '''),
Link(Utils.ScriptURL('listinfo'),
_('the mailing lists overview page')),
_(''' <p>If you are having trouble using the lists, please contact '''),
Link('mailto:' + siteowner, siteowner),
'.<p>',
FormatOpenIDLogin(),
'<p>'))
table.AddRow([apply(Container, welcome)])
table.AddCellInfo(max(table.GetCurrentRowIndex(), 0), 0, colspan=2)
doc.AddItem(table)
doc.AddItem('<hr>')
doc.AddItem(MailmanLogo())
print doc.Format()
示例4: listinfo_overview
# 需要导入模块: from Mailman import Utils [as 别名]
# 或者: from Mailman.Utils import get_domain [as 别名]
def listinfo_overview(msg=''):
# Present the general listinfo overview
hostname = Utils.get_domain()
# Set up the document and assign it the correct language. The only one we
# know about at the moment is the server's default.
doc = Document()
doc.set_language(mm_cfg.DEFAULT_SERVER_LANGUAGE)
legend = _("%(hostname)s Mailing Lists")
doc.SetTitle(legend)
table = Table(border=0, width="100%")
table.AddRow([Center(Header(2, legend))])
table.AddCellInfo(table.GetCurrentRowIndex(), 0, colspan=2,
bgcolor=mm_cfg.WEB_HEADER_COLOR)
# Skip any mailing lists that isn't advertised.
advertised = []
listnames = Utils.list_names()
listnames.sort()
for name in listnames:
mlist = MailList.MailList(name, lock=0)
if mlist.advertised:
if mm_cfg.VIRTUAL_HOST_OVERVIEW and \
mlist.web_page_url.find(hostname) == -1:
# List is for different identity of this host - skip it.
continue
else:
advertised.append((mlist.GetScriptURL('listinfo'),
mlist.real_name,
mlist.description))
if msg:
greeting = FontAttr(msg, color="ff5060", size="+1")
else:
greeting = FontAttr(_('Welcome!'), size='+2')
welcome = [greeting]
mailmanlink = Link(mm_cfg.MAILMAN_URL, _('Mailman')).Format()
if not advertised:
welcome.extend(
_('''<p>There currently are no publicly-advertised
%(mailmanlink)s mailing lists on %(hostname)s.'''))
else:
welcome.append(
_('''<p>Below is a listing of all the public mailing lists on
%(hostname)s. Click on a list name to get more information about
the list, or to subscribe, unsubscribe, and change the preferences
on your subscription.'''))
# set up some local variables
adj = msg and _('right') or ''
siteowner = Utils.get_site_email()
welcome.extend(
(_(''' To visit the general information page for an unadvertised list,
open a URL similar to this one, but with a '/' and the %(adj)s
list name appended.
<p>List administrators, you can visit '''),
Link(Utils.ScriptURL('admin'),
_('the list admin overview page')),
_(''' to find the management interface for your list.
<p>If you are having trouble using the lists, please contact '''),
Link('mailto:' + siteowner, siteowner),
'.<p>'))
welcome.extend(
(_('''Users who are subscribed to one of the Mailing List can use OpenID to login with common credentials,
to access all their subscribed List.
<p> To register OpenID '''),
Link(Utils.ScriptURL('openidreg'),
_('Click Here')),
_(''' to use OpenID for Systers'''),
'.<p>'))
table.AddRow([apply(Container, welcome)])
table.AddCellInfo(max(table.GetCurrentRowIndex(), 0), 0, colspan=2)
if advertised:
table.AddRow([' ', ' '])
table.AddRow([Bold(FontAttr(_('List'), size='+2')),
Bold(FontAttr(_('Description'), size='+2'))
])
highlight = 1
for url, real_name, description in advertised:
table.AddRow(
[Link(url, Bold(real_name)),
description or Italic(_('[no description available]'))])
if highlight and mm_cfg.WEB_HIGHLIGHT_COLOR:
table.AddRowInfo(table.GetCurrentRowIndex(),
bgcolor=mm_cfg.WEB_HIGHLIGHT_COLOR)
highlight = not highlight
doc.AddItem(table)
doc.AddItem('<hr>')
doc.AddItem(MailmanLogo())
print doc.Format()