跳转到主要内容

Plone的内容警报插件

项目描述

Coveralls

collective.contentalerts

当在内容对象上找到(两个自定义列表中的)单词时,获取警报,无论该对象是任何内容类型(Dexterity或评论)。

可用于

  • 管理:用作黑名单。

  • 突出显示:用作白名单。

主要思想是利用plone.app.contentrules的强大功能来检查用户生成的内容中的特定单词。

在此基础上,可以触发常规的plone.app.contentrules操作:发送电子邮件,通知用户,应用工作流转换等。

次要思想是能够根据单词是否在列表之一中找到来对内容执行不同的操作。

功能

  • 管理两个单词列表,这些列表将用于搜索(黑名单/白名单)

    • 名为forbidden_wordsinadequate_words

  • plone.app.contentrules集成

    • 查找停用词的条件(来自任何列表或特定列表)

    • 字符串替换,在电子邮件中添加停用词找到的片段(文档和评论各一个)

  • 独立工具

    • 具有在两个列表中查找单词或仅在一个列表中查找单词的方法

  • 如果需要,提供不同的单词列表,可以是两个通用列表(基于plone.registry)或者针对每个内容规则的列表

  • 在评论和dexterity内容类型中查找停用词

  • 将标记接口应用于检测到停用词的对象

  • 标记对象为已审查

  • 监视单词列表的更改,并在已审查的对象中搜索新的停用词

    • 如果启用了[异步]额外功能,此审查将通过异步作业完成(通过collective.taskqueue

搜索位置

collective.contentalerts将在评论的文本或文本(对于基于Dexterity的内容类型)上搜索。

独立使用

虽然主集成是通过plone.app.contentrules条件实现的,但collective.contentalerts也可以作为独立实用程序使用。

使用提供的实用程序(collective.contentalerts.interfaces.IAlert)。

文档

完整用户文档可以在“docs”文件夹中找到。

安装

通过将其添加到您的buildout中安装collective.contentalerts

[buildout]

 ...

 eggs =
     collective.contentalerts

然后运行“bin/buildout”

升级说明

版本 3.0

此版本旨在与Plone 5.2兼容(仍在python 2.7上)。

版本 2.0

此版本仅支持Plone 5和Dexterity,如果您使用Archetypes或Plone 4.3.x,请继续使用版本1.x。

到目前为止,迁移到Plone 5与最后一个1.x版本的区别。

请关注CHANGES.rst

版本 1.0及以下

如果您是从0.7升级到任何更高版本,则需要执行一个手动步骤。

在版本1.0中,单个停用词列表被拆分为inadequate_wordsforbidden_words

由于无法猜测旧列表应映射到哪个列表,因此不提供自动迁移。

需要编写一个升级步骤

下面是一个将旧列表迁移到新forbidden_words列表的示例

from plone import api
from plone.registry.interfaces import IRegistry
from zope.component import getUtility

# safe the stop words on the old location
old_setting = 'collective.contentalerts.interfaces.IStopWords.stop_words'
current_forbidden_words = api.portal.get_registry_record(name=old_setting)

# update registry
setup = api.portal.get_tool('portal_setup')
setup.runImportStepFromProfile(
    'profile-collective.contentalerts:default',
    'plone.app.registry'
)

# set the stop words on the new field
api.portal.set_registry_record(
    name='collective.contentalerts.interfaces.IStopWords.forbidden_words',
    value=current_forbidden_words
)

# remove the old setting
registry = getUtility(IRegistry)
del registry.records[old_setting]

贡献

许可证

项目采用GPLv2许可证。

致谢

der Freitag赞助了这个附加组件的创建。

贡献者

变更日志

4.0.0 (2024-03-01)

错误修复

  • 避免一个弃用警告。[gforcada] (#1)

内部

  • 更新配置文件。

4.0.0a1(未发布)

  • 尚未有任何变化。

4.0.0a0(2023-12-01)

  • 更新到Plone 6。[gforcada]

3.2.1 (2022-12-17)

错误修复

  • 通过GitHub Actions添加linting操作。[gforcada] (#1)

  • 添加对Plone 5.2.10的支持。[gforcada] (#2)

3.2.0 (2021-03-31)

  • 使其兼容Python 3。[gforcada]

3.1.0 (2020-05-07)

  • 使文本规范化更彻底(#14)。[staeff]

3.0.0 (2020-02-11)

  • 尚未有任何变化。

3.0.0a0(2020-02-10)

  • 添加卸载配置文件。[gforcada]

  • 使代码和测试与Plone 5.2兼容。[gforcada]

2.0.0 (2019-02-11)

  • 对Plone 4.3、5.0、5.1和(实验性)5.2进行测试。

2.0a1(2016-07-28)

  • 使collective.contentalerts与Plone 5兼容。需要的调整包括:删除session_data_manager,使用z3c.form代替formlib,通过IRichText对象访问文本,测试中的几个更改。[staeff]

1.1 (2016-03-29)

  • 确保仅在需要时删除标记接口。[gforcada]

1.0.post0(2016-03-12)

  • 更新德语翻译。[staeff]

1.0 (2016-03-11)

  • 重命名了注册表设置,现在使用两个列表:forbidden_wordsinadequate_words。请参阅 README.rst 了解如何创建升级步骤以迁移它们。[gforcada]

  • 更新了 IAlert 工具,使其可以使用两个停用词列表,或者如果指定(作为参数传递),则只使用一个。[gforcada]

  • IAlert 工具添加了 has_forbidden_words 方法。它允许仅检查禁止的停用词。[gforcada]

  • 通过允许传递标记接口和审阅状态,使 @@review-objects 视图更通用。这允许过滤哪些元素将进行检查停用词。[gforcada]

  • 将内容规则增加到三倍,因此可以决定监控任何类型的词,仅监控禁止的词,或仅监控不适当的词。[gforcada]

0.7 (2016-01-22)

  • 监控注册表设置(停用词)的更改。如果发现更改,则验证审阅对象是否包含这些新停用词。[gforcada]

  • 进行一轮清理、重构和覆盖率修复。[gforcada]

  • 有条件地依赖于 collective.taskqueue 以异步方式执行大规模处理。[gforcada]

0.6 (2016-01-20)

  • 在丢弃警报时应用 IStopWordsVerified。[gforcada] [staeff]

  • 排序导入,使用 plone.api 和一些 buildout 清理。[gforcada]

0.5 (2016-01-19)

  • 支持 Plone 4.3.7 [gforcada]

  • 将 normalize 转换为全局函数 [gforcada] [staeff]

0.4.post1 (2015-08-31)

  • 添加德语翻译。[staeff]

0.4.post0 (2015-08-19)

  • 同时创建轮。[gforcada]

0.4 (2015-08-19)

  • 添加一个浏览器视图,以便根据每个对象删除 IHasStopWords 标记接口。[gforcada]

0.3.1 (2015-08-17)

  • 确保 IHasStopWords 标记接口在目录中已索引。[gforcada]

0.3.post0 (2015-08-15)

  • 修复包 URL。[gforcada]

0.3 (2015-08-14)

  • 正确分割停用词文本,以便考虑不同的行结束符。[gforcada]

  • 忽略停用词中的空行,以避免产生意外结果。[gforcada]

0.2 (2015-08-14)

  • 将字符串替换分为两部分:text_alertcomment_alert。[gforcada]

0.1 (2015-08-14)

  • 初始发布。[gforcada]

  • 修复包结构

    • 删除不需要的部分

    • 添加 travis 和 coveralls 徽章

    [gforcada]

  • 添加 plone.registry 以保存通用停用词列表。[gforcada]

  • 添加控制面板配置工具来编辑停用词列表。[gforcada]

  • 添加更多代码分析检查、依赖跟踪和 MANIFEST 检查[gforcada]

  • 添加搜索给定文本中的停用词的实用程序[gforcada]

  • 添加 plone.app.contentrules 条件:collective.contentalerts.TextAlert[gforcada]

  • 添加字符串替换:text_alert。在内容规则上用于编写电子邮件[gforcada]

  • 将标记接口应用于发现具有停用词的对象。[gforcada]

项目详情


下载文件

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

源代码分发

collective.contentalerts-4.0.0.tar.gz (39.0 kB 查看哈希值)

上传时间 源代码

构建分发

collective.contentalerts-4.0.0-py3-none-any.whl (37.8 kB 查看哈希值)

上传时间 Python 3

支持者