Code

Opened 7 years ago

Closed 7 years ago

#4407 closed (worksforme)

Sitemaps documentation should mention dispatchers

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

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)

Attachments (0)

Change History (1)

comment:1 Changed 7 years ago by ubernostrum

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to worksforme
  • Status changed from new to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.