Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install tgext.tagging

How to install tgext.tagging

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install tgext.tagging
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.2.1 Available View build log
0.2.0 Available View build log
0.1.2 Available View build log
0.1 Available View build log
Windows (64-bit)
0.1.2
0.2.1Never BuiltWhy not?
0.1.2 Available View build log
0.1 Available View build log
Mac OS X (10.5+)
0.2.1 Available View build log
0.2.0 Available View build log
0.1.2 Available View build log
0.1 Available View build log
Linux (32-bit)
0.2.1 Available View build log
0.2.0 Available View build log
0.1.2 Available View build log
0.1 Available View build log
Linux (64-bit)
0.2.1 Available View build log
0.2.0 Available View build log
0.1.2 Available View build log
0.1 Available View build log
 
License
LGPL
Dependencies
Depended by
Lastest release
version 0.2.1 on Nov 20th, 2012

About Tagging

tgext.tagging is a TurboGears2 library that permits to quickly add tagging to any project managing tags, tagging, tag clouds and widgets to list, remove and add tags to entities.

Installing

tgext.tagging can be installed both from pypi or from bitbucket:

easy_install tgext.tagging

should just work for most of the users

Enabling Tagging Management

For TurboGears 2.2 using tgext.pluggables is suggested, for previous versions edit model/__init__.py and add the following lines:

import tgext.tagging
Tag, Tagging = tgext.tagging.setup_model()

most of the utitiles to manage tagging are exposed by the Tagging class they expose:

  • Tag.lookup(tag_name) -> Returns the Tag instance for the given tag name
  • Tag.lookup_list(comma_separated_tags) -> Returns the tags instances for each entry in the tags list.
  • Tagging.items_for_tags(Model, comma_separated_tags) -> Returns the list of items having the given tags
  • Tagging.tag_cloud_for_object(item) -> Returns the list of tags for the given object
  • Tagging.tag_cloud_for_set(Model, items=None) -> Returns the tag cloud for the given set of items. if a list of items is passed it will retrieve tags for the given list, otherwise for all the items of the given Model.
  • Tagging.tag_cloud_for_user(user, Model=None) -> Returns all the tags set by the given user. if any Model is passed it will retrieve tags only for that model.
  • Tagging.add_tags(item, comma_separated_tags) -> Add the given tags to the item
  • Tagging.del_tags(item, comma_separated_tags) -> Removes the given tags from the item
  • Tagging.set_tags(item, comma_separated_tags) -> Replaces all the tags of the item with the new list

Tagging Controller

tgext.tagging provides a controller to manage tagging. Enable it inside your project with the following code:

from tgext.tagging.controllers import TaggingController

class RootController(BaseController):
    tagging = TaggingController(model=Group, session=DBSession, allow_edit=None)

You can enable multiple TaggingController one for each model available in your application. The model parameter indicates for which model objects tags will be managed, session is the sqlalchemy session used to perform queries and allow_edit is the repoze.what predicates used to check if to show editing functions.

The controller provides tags, add, remove, search actions:

  • /tags/id -> Partial view that can be loaded with jQuery.load that displays a taglist with form to add/remove tags for the given object.
  • /add/id?tags=tag1,tag2,tag3 -> Permits to add one or more tags to the item
  • /remove/id?tags=tag1,tag2 -> Permits to remove one or more tags from the item
  • /search?tags=tag1,tag -> Searches for items having the given tags, will use Model.tagging_display method to display the results if available. Otherwise str(Model) is performed.

Tagging Widgets

tgext.tagging provides some widgets to manage tags. tgext.tagging.widgets.TagList and tgext.tagging.widget.TagCloud are provided. Both take a tagging_url parameter at construction which points to the url of the tagging controller that can be used by the widget to manage tags. By default this points to /tagging. TagList widget also takes a editmode parameter which permits to specify if controls to add and remove tags must be shown or not.

At rendering TagList takes an object as argument and will show the tag list for the given object, while TagCloud takes a tag cloud returned by Tagging.tag_cloud_for_object, Tagging.tag_cloud_for_set or Tagging.tag_cloud_for_user and will show a weighted tag cloud.

Subscribe to package updates

Last updated Nov 20th, 2012

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.