Changes between Initial Version and Version 1 of Ticket #36775


Ignore:
Timestamp:
Dec 4, 2025, 2:07:47 PM (26 minutes ago)
Author:
Jacob Walls
Comment:

Seems reasonable, thanks. (I think this is the "better error" described as "wouldn't kill us" in a very similar scenario in ticket:2218#comment:1.)

Could you include a test?

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #36775

    • Property Needs tests set
    • Property Owner set to yureiblack
    • Property Triage Stage UnreviewedAccepted
    • Property Status newassigned
    • Property Type BugCleanup/optimization
  • Ticket #36775 – Description

    initial v1  
    11Currently, the `Feed.get_feed()` method retrieves the feed's `link` using:
    2 
     2{{{#!py
    33    link = self._get_dynamic_attr("link", obj)
    4 
     4}}}
    55If a Feed subclass does not define a `link` attribute, `link` becomes `None`.
    66This results in an unhelpful exception when Django later calls:
    7 
     7{{{#!py
    88    link = add_domain(current_site.domain, link, request.is_secure())
    9 
     9}}}
    1010Since `add_domain()` calls `url.startswith()`, a missing `link`
    1111causes:
    12 
     12{{{#!py
    1313    AttributeError: 'NoneType' object has no attribute 'startswith'
    14 
     14}}}
    1515This error does not clearly indicate the actual problem.
    1616
     
    2020
    2121The attached PR adds the following check:
    22 
     22{{{#!py
    2323    if link is None:
    2424        raise ImproperlyConfigured(
    2525            "Feed class must define a 'link' attribute."
    2626        )
    27 
     27}}}
    2828This results in a clearer error message and avoids unexpected crashes.
    2929
Back to Top