Opened 17 years ago

Closed 17 years ago

#4407 closed (worksforme)

Sitemaps documentation should mention dispatchers

Reported by: orestis@… Owned by: nobody
Component: Documentation Version: dev
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In the sitemap documentation there is a suggestion that a good place to call ping_google() is in a models save method. This should be changed to mention dispatchers, as it is far more "correct" to connect to the post_save signal to ping google, instead of doing so in save_methods.

Example:

from django.db.models import signals
from django.dispatch import dispatcher
def ping(sender, args, kwargs):
    try:
         ping_google()
    except Exception:
         pass

dispatcher.connect(ping, sender=Entry, signal=signals.post_save)

Change History (1)

comment:1 by James Bennett, 17 years ago

Resolution: worksforme
Status: newclosed

If a specific model is supposed to ping whenever it changes, then the model is the object that should "know" about this; hence the model is the correct location for the method.

Note: See TracTickets for help on using tickets.
Back to Top