Skip to main content

About tgcomments

tgcomments is a Pluggable Comments application for TurboGears2. Comments can be added to any webpage by using the comments_for partial.

TGComments supports Facebook for avatar if the user logged using tgapp-fbauth or if the User model provides a similar interface. Otherwise will fallback to Gravatar.

Installing

tgcomments can be installed both from pypi or from bitbucket:

pip install tgapp-tgcomments

should just work for most of the users

Plugging tgcomments

In your application config/app_cfg.py import plug:

from tgext.pluggable import plug

Then at the end of the file call plug with tgcomments:

plug(base_config, 'tgcomments')

To expose comments support for an entity, just call the comments_for(entity)  partial for that entity inside your templates as explained in the Exposed Partials section.

Exposed Partials

tgcomments exposes a bunch of partials which can be used to render pieces of the blogging system anywhere in your application:

  • tgcomments.partials:comments_for(entity)

    Given any SQLAlchemy or Ming entity (instance) which is available inside your application model module it will display a list of comments for that entity with a box to add a new comment.

Provided Options

tgcomments supports a bunch of options that can be passed to the plug call to change its behavior:

  • notify_facebook (default:True) automatically notify on facebook comments that

    the user wrote if he has logged using Facebook

  • allow_anonymous (default:True) allow anonymous users to comment

  • pretty_date a function that will be used to properly format dates (example: “5 minutes ago”)

  • get_user_avatar a function that will be used to get the avatar (by default searches for the avatar property, then fallbacks for fb information, then fallbacks gravatar)

Exposed Templates

The templates used by registration and that can be replaced with tgext.pluggable.replace_template are:

  • tgcomments.templates.comments_partial

Available Hooks

TGComments exposes some hooks to configure it’s behavior, The hooks that can be used with TurboGears2 register_hook are:

  • tgcomments.before_add(entity, user, kw) - called before adding a comment. kw[‘body’] can be modified here

Changelog

  • 0.2.6 - support turbogears 2.4

  • 0.2.3 - added tgcomments.before_add hook

  • 0.2.2 - fixed anon comment creation broken by v0.2.1, used pre instead of div to

    display the comment body, so it keeps newlines

  • 0.2.1 - fixed ming relation with User and added author_username

  • 0.2.0 - introduced compatibility with ming

Metadata

Release files for tgapp-tgcomments 0.2.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tgapp-tgcomments 0.2.6
File Size Uploaded Provenance Actions
tgapp-tgcomments-0.2.6.tar.gz 11.7 kB Without provenance Details for tgapp-tgcomments-0.2.6.tar.gz

Release files / tgapp-tgcomments-0.2.6.tar.gz

Download URL tgapp-tgcomments-0.2.6.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
620cf36be6be5b72676354323a2bf730b80b32c293e8cdb1598e815b3846d65e
BLAKE2b-256 checksum
How to use checksums
786164c49761049a7387cff0b159e6d5592307a9a1a1f0727797bd6703099578
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.8.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.4

Security for tgapp-tgcomments 0.2.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page