跳转到主要内容

ZC buildout配方,用于在Zope2实例中设置zope.sendmail

项目描述

代码仓库: http://ingeniweb.svn.sourceforge.net/svnroot/ingeniweb/iw.recipe.sendmail

变更历史

trunk (2008-05-21)

  • xxx [Ingeniweb]

0.2.3 (2008-05-20)

  • 修复了文档和历史记录

0.2.2 (2008-05-19)

  • 修复 #60:如果不存在,则创建package-includes目录 [encolpe]。

0.2.1 (2007-02-09)

  • 自动包含zope.sendmail到生成的zcml [gawel]。

0.2 (2007-02-09)

  • 添加了用户名/密码选项 [gawel]。

0.1 (2007-02-09)

  • 使用ZopeSkel创建了配方 [gawel]。

详细文档

支持的选项

该配方支持以下选项

zope2location

到Zope2实例的路径

名称

邮件队列交付工具的名称。默认为iw.mailer。

主机

您的smtp主机。默认为localhost。

端口

您的smtp端口。默认为25。

用户名

如果smtp服务器需要,则登录名。

密码

如果smtp服务器需要,则密码。

mailqueue

创建邮件队列的现有目录的路径。默认为var/。请注意,这需要是一个绝对路径。

示例用法

PyPI页面上关于zc.buildout的文档包含有关测试环境的说明。

http://pypi.python.org/pypi/zc.buildout#testing-support

以下是一个骨架doctest,您可以在构建自己的测试时从它开始。

我们将首先创建一个使用该菜谱的构建包。

>>> write('buildout.cfg',
... """
... [buildout]
... parts = mailer
...
... [mailer]
... recipe = iw.recipe.sendmail
... zope2location=parts/zope2
... host = smtp.example.com
... """)

模拟 Zope2 部分

>>> mkdir('parts','zope2')
>>> mkdir('parts','zope2','etc')

运行构建包后,我们得到

>>> print system(buildout)
Installing mailer.
iw.sendmail-configure.zcml: Generated file 'iw.sendmail-configure.zcml'.

并查看 zcml 模板

>>> cat('parts','zope2','etc','package-includes',
...                           'iw.sendmail-configure.zcml')
<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:zcml="http://namespaces.zope.org/zcml">
<BLANKLINE>
    <include package="zope.sendmail" file="meta.zcml" />
<BLANKLINE>
    <configure
        xmlns:mail="http://namespaces.zope.org/mail">
<BLANKLINE>
        <mail:smtpMailer
            name="iw.smtp"
            hostname="smtp.example.com"
            port="25"
            />
<BLANKLINE>
        <mail:queuedDelivery
            name="iw.mailer"
            permission="zope.Public"
            mailer="iw.smtp"
            queuePath="/sample-buildout/var/mailqueue"
            />
    </configure>
<BLANKLINE>
    <configure zcml:condition="installed iw.mailhost">
        <include package="iw.mailhost" />
    </configure>
<BLANKLINE>
</configure>

让我们尝试使用所有参数

>>> write('buildout.cfg',
... """
... [buildout]
... parts = mailer
...
... [mailer]
... recipe = iw.recipe.sendmail
... zope2location=parts/zope2
... name = mailer
... host = smtp.example2.com
... port = 50
... username = gael
... password = xxx
... mailqueue = ${buildout:directory}
... """)

再次运行构建包

>>> print system(buildout)
Uninstalling mailer.
Installing mailer.
iw.sendmail-configure.zcml: Generated file 'iw.sendmail-configure.zcml'.

并查看 zcml 模板

>>> cat('parts','zope2','etc','package-includes',
...                           'iw.sendmail-configure.zcml')
<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:zcml="http://namespaces.zope.org/zcml">
<BLANKLINE>
    <include package="zope.sendmail" file="meta.zcml" />
<BLANKLINE>
    <configure
        xmlns:mail="http://namespaces.zope.org/mail">
<BLANKLINE>
        <mail:smtpMailer
            name="iw.smtp"
            hostname="smtp.example2.com"
            port="50"
            username="gael"
            password="xxx"
            />
<BLANKLINE>
        <mail:queuedDelivery
            name="mailer"
            permission="zope.Public"
            mailer="iw.smtp"
            queuePath="/sample-buildout/mailqueue"
            />
    </configure>
<BLANKLINE>
    <configure zcml:condition="installed iw.mailhost">
        <include package="iw.mailhost" />
    </configure>
<BLANKLINE>
</configure>

贡献者

Ingeniweb, Gael Pasgrimaud Ingeniweb, Encolpe Degoute

下载

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源分布

iw.recipe.sendmail-0.2.3.tar.gz (13.4 kB 查看哈希值)

上传时间

构建分布

iw.recipe.sendmail-0.2.3-py2.4.egg (10.2 kB 查看哈希值)

上传时间

支持者