本文整理汇总了Python中assembl.models.Discussion.homepage方法的典型用法代码示例。如果您正苦于以下问题:Python Discussion.homepage方法的具体用法?Python Discussion.homepage怎么用?Python Discussion.homepage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assembl.models.Discussion
的用法示例。
在下文中一共展示了Discussion.homepage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: discussion_admin
# 需要导入模块: from assembl.models import Discussion [as 别名]
# 或者: from assembl.models.Discussion import homepage [as 别名]
def discussion_admin(request):
user_id = authenticated_userid(request)
if not user_id:
return HTTPFound(location='/login?next=/admin/discussions/')
session = User.default_db
context = dict(
get_default_context(request),
discussions=session.query(Discussion))
if request.method == 'POST':
g = lambda x: request.POST.get(x, None)
(topic, slug, name, host, port,
ssl, folder, password, username, homepage) = (
g('topic'),
g('slug'),
g('mbox_name'),
g('host'),
g('port'),
True if g('ssl') == 'on' else False,
g('folder'),
g('password'),
g('username'),
g('homepage')
)
discussion = Discussion(
topic=topic,
slug=slug
)
# Could raise an exception if there is no/incorrect scheme passed
discussion.homepage = homepage
session.add(discussion)
create_default_permissions(session, discussion)
mailbox_class = (
MailingList if g('mailing_list_address') else IMAPMailbox)
mailbox = mailbox_class(
name=name,
host=host,
port=int(port),
username=username,
use_ssl=ssl,
folder=folder,
password=password,
)
if(g('mailing_list_address')):
mailbox.post_email_address = g('mailing_list_address')
mailbox.discussion = discussion
return render_to_response(
'admin/discussions.jinja2',
context,
request=request)