#31802: Validation for "SITE_ID" setting
-----------------------------------------+------------------------------
               Reporter:  Gagan Deep     |          Owner:  nobody
                   Type:  Bug            |         Status:  new
              Component:  contrib.sites  |        Version:  3.0
               Severity:  Normal         |       Keywords:  sites, cache
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  1
                  UI/UX:  0              |
-----------------------------------------+------------------------------
 The "sites" framework requires to set a `SITE_ID` to specify the database
 ID of the Site object associated with that particular settings file. From
 the documentation, it can be interpreted that it should be an integer.
 But, it can also be set to a string literal('1'). I know this is wrong,
 but the Django accepted it and worked with it anyway without showing any
 warning or error.

 The problem arose with `SITE_CACHE`. It was not getting invalidated when
 the Site object is updated. The reason is the code which handles
 invalidation  uses primary key of instance object which will be an
 integer. Therefore, the cache is never invalidated.

 {{{
 try:
     del SITE_CACHE[instance.pk]
 except KeyError:
     pass
 }}}

 
[https://github.com/django/django/blob/3d16496037fbb8a6bbc6b6e354fa4f5eb65e6cea/django/contrib/sites/models.py#L103-L117
 Please see complete code on GitHub.]

 Since working of an element of Django is dependent on this setting, I
 suggest that there be a validation test for `SITE_ID`.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31802>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.4b542a46acda4a7ba852286fdcca1305%40djangoproject.com.

Reply via email to