电子邮件索引器和检索器的zope接口'notmuch[mail]`
dm.zope.notmuchmail的Python项目详细描述
这个包包含到^{tt1}的zope[2]接口$ 包(http://notmuchmail.org/)。notmuch用于电子邮件 索引和快速检索。此包公开其检索 通过zope的能力。
功能性
包定义了两个电子邮件搜索视图email_search_simple 和email_search_combined。
email_search_simple提供了一个简单的搜索表单 单个字段Search terms。在此字段中,指定 应根据以下内容检索的内容 从notmuch文档中提取:
The search terms can consist of free-form text (and quoted phrases) which will match all messages that contain all of the given terms/phrases in the body, the subject, or any of the sender or recipient headers. As a special case, a search string consisting of exactly a single asterisk ("*") will match all messages. In addition to free text, the following prefixes can be used to force terms to match against specific portions of an email, (where <brackets> indicate user-supplied values): from:<name-or-address> to:<name-or-address> subject:<word-or-quoted-phrase> attachment:<word> tag:<tag> (or is:<tag>) id:<message-id> thread:<thread-id> folder:<directory-path> The from: prefix is used to match the name or address of the sender of an email message. The to: prefix is used to match the names or addresses of any recipient of an email message, (whether To, Cc, or Bcc). Any term prefixed with subject: will match only text from the subject of an email. Searching for a phrase in the subject is supported by including quotation marks around the phrase, immediately following subject:. The attachment: prefix can be used to search for specific filenames (or extensions) of attachments to email messages. For tag: and is: valid tag values include inbox and unread by default for new messages added by notmuch new as well as any other tag values added manually with notmuch tag. For id:, message ID values are the literal contents of the Message-ID: header of email messages, but without the '<', '>' delimiters. The thread: prefix can be used with the thread ID values that are generated internally by notmuch (and do not appear in email messages). These thread ID values can be seen in the first column of output from notmuch search The folder: prefix can be used to search for email message files that are contained within particular directories within the mail store. Only the directory components below the top-level mail database path are available to be searched. In addition to individual terms, multiple terms can be combined with Boolean operators ( and, or, not , etc.). Each term in the query will be implicitly connected by a logical AND if no explicit operator is provided, (except that terms with a common prefix will be implicitly combined with OR until we get Xapian defect #402 fixed). Parentheses can also be used to control the combination of the Boolean operators. Finally, results can be restricted to only messages within a particular time range, (based on the Date: header) with a syntax of: <initial-timestamp>..<final-timestamp> Each timestamp is a number representing the number of seconds since 1970-01-01 00:00:00 UTC. This is not the most convenient means of expressing date ranges, but until notmuch is fixed to accept a more convenient form, one can use the date program to construct timestamps. For example, with the bash shell the following syntax would specify a date range to return messages from 2009-10-01 until the current time: $(date +%s -d 2009-10-01)..$(date +%s)
提交表单时,将显示这些线程的概述 至少包含一个匹配的消息。然后你可以检查 所选线程:显示所选的头信息 包含的消息。最后,您可以检查选定的消息。 当前,包尚未显示邮件附件 只测试纯文本消息(因为我不使用 HTML消息,出于安全和隐私原因)。
email_search_combined结合了搜索表单和线程概述 在一页纸上。你通常会用这个视图。
用户界面
该包目前支持两个用户界面:一个基于 在javascript上(更准确地说是jquery(http://jquery.com/) 以及纯html接口。
在基于javascript的接口中,线程和消息的详细信息 直接显示在线程概述页面上(使用ajax调用 和动态html);在纯html界面中,这些细节 在单独的窗口(或选项卡)中显示。
接口不会根据 浏览器中的javascript可用性。然而, 基于javascript的接口应该类似于 如果javascript被禁用,纯html接口(尽管它看起来 有点搞笑)。
您可以在配置过程中决定两个接口中的哪一个 使用。
安装
此软件包要求Zope 2.12或更高版本。
这个包应该可以用任何典型的方法安装 在zope 2环境中(“buildout”、“easy_install”、“pip”)。
但是,它取决于notmuchpython包 (https://pypi.python.org/pypi/notmuch)。为了方便 使用相应的操作系统包(称为 python-notmuch在debian系统中),此依赖关系不是 已声明,必须在中手动提供此包 你的Zope环境。
此外,只有在设置了 一个notmuch数据库,用于索引您的电子邮件 感兴趣的。有关详细信息,请参阅notmuch文档。
配置
配置包括3个必需部分:
register the package’s views.
This currently is done by including the ZCML of ^{tt14}$ in your overall ZCML configuration.
I plan to support a Plone integration in the future. This integration would use Plone’s ^{tt15}$ integration and Plone’s ^{tt16}$ as base rather than provide a standalone base. Looking at the source of ^{tt17}$, it should not be difficult to implement a Plone integration (in case, you need one before I support it).
provide access to the ^{tt1}$ database which indexes the interesting mails.
This is done by registering a ^{tt19}$ utility. To implement such a utility, you can use ^{tt20}$. Its constructor gets the path to the maildir indexed by ^{tt1}$. If you do not provide the path, then standard ^{tt1}$ configuration decides where to find the database - usually one configured for the user running the Zope process. ^{tt23}$ registers the utility in such a way.
define at what objects (in the Zope hierarchy) which user interface should be available.
The JavaScript based interface is available at an object, if this objects provides ^{tt24}$; the pure HTML based interface is available, if it does not provide ^{tt24}$ but provides ^{tt26}$.
You can use the ^{tt27}$ tab of the “Zope Management Interface” (aka “ZMI”) of an object, to add interfaces to its set of provided interfaces. Alternatively, you could use a ZCML ^{tt28}$ directive to let all objects of the respective class provide a specified interface.
除了这些必需的配置步骤(没有它们,您 无法使用该功能),有一个可选配置: 您可以定义其他邮件头字段。 为此,注册一个适配器 dm.zope.notmuchmail.interfaces.IAdditionalHeaderItems 对于dm.zope.notmuchmail.notmuchmail._Delegator对象(那些 是notmuch消息周围的包装器。它必须回来 名称/值项的序列。每个元素 在序列中被解释为附加的消息头字段 (具有相应的值)。