Simple tagging adapter
Project description
largeblue.tag provides an uber simple tagging adapter. If included:
<include package="largeblue.tag" />
It will adapt any object configured to implement largeblue.tag.interfaces.ITaggable, e.g:
<class class=".objects.MyContentObject"> <implements interface="largeblue.tag.interfaces.ITaggable" /> ... </class>
This will hang a @@tags.html view of each instance of the adapted content object, which provides a single textline input to enter tags (seperated by a space). Thus if you enter ‘foo bar dolores’ into the text input and submit, you’ll find:
>>> context = my_obj >>> from largeblue.tag.interfaces import ITag >>> t = ITag(context) >>> t.tags ['foo', 'bar', 'dolores'] >>> t.tagstring u'foo bar dolores'
You can add, remove and update:
>>> 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']
That’s it.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
largeblue.tag-0.1.tar.gz
(7.8 kB
view details)
File details
Details for the file largeblue.tag-0.1.tar.gz
.
File metadata
- Download URL: largeblue.tag-0.1.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | abdbdb518e0af6f4f78b8ce524c8668e40942d5d04be0586dd06227a4f2c93da |
|
MD5 | 438bb8af042063064f94dcd76ba31160 |
|
BLAKE2b-256 | ae49cad98c65967ba352d7ecad2aa78177d7b9de1c74321d61f776eee2111602 |