跳转到主要内容

简单的标记适配器

项目描述

largeblue.tag提供了一种超简单的标记适配器。如果包含

<include package="largeblue.tag" />

它将适配任何配置为实现largeblue.tag.interfaces.ITaggable的对象,例如

<class class=".objects.MyContentObject">
  <implements interface="largeblue.tag.interfaces.ITaggable" />
  ...
</class>

这将为适配的内容对象的每个实例挂起一个@@tags.html视图,该视图提供单行文本输入以输入标签(由空格分隔)。因此,如果您在文本输入中输入“foo bar dolores”并提交,您将找到

>>> context = my_obj
>>> from largeblue.tag.interfaces import ITag
>>> t = ITag(context)
>>> t.tags
['foo', 'bar', 'dolores']
>>> t.tagstring
u'foo bar dolores'

您可以添加、删除和更新

>>> t.add_tag('elephants')
>>> t.tags
['foo', 'bar', 'dolores', 'elephants']
>>> t.remove_tag('dolores')
>>> t.tags
['foo', 'bar', 'elephants']
>>> t.update_tags(['coffee', 'milk'])
>>> t.tags
['coffee', 'milk']

就这么多。

项目详情


下载文件

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

源分布

largeblue.tag-0.1.1.tar.gz (7.9 kB 查看散列)

上传于 源代码

由以下提供支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面