Opened 9 years ago
Last modified 3 years ago
#25741 new Cleanup/optimization
Make 'request' available to syndication.Feed methods
Reported by: | Ramez Issac | Owned by: | |
---|---|---|---|
Component: | contrib.syndication | Version: | 1.8 |
Severity: | Normal | Keywords: | syndication, request |
Cc: | ramezashraf@… | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Pull Requests: | How to create a pull request | ||
Description ¶
Use case : adding an image to feed.
i will to override Feed.item_extra_kwargs() and get my image url, But i can't make a Full URL as i'm missing the request.host
Proposal:
Add request to Feed class so it's accessible via self.request (as CBV)
According to the ticket's flags, the next step(s) to move this issue forward are:
- To provide a patch by sending a pull request. Claim the ticket when you start working so that someone else doesn't duplicate effort. Before sending a pull request, review your work against the patch review checklist. Check the "Has patch" flag on the ticket after sending a pull request and include a link to the pull request in the ticket comment when making that update. The usual format is:
[https://github.com/django/django/pull/#### PR]
.
Change History (9)
comment:1 by , 9 years ago
Type: | Uncategorized → Cleanup/optimization |
---|
comment:2 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 9 years ago
Triage Stage: | Unreviewed → Accepted |
---|
follow-up: 6 comment:4 by , 9 years ago
I believe this will require functionality similar to View.as_view()
to be thread-safe. Or even sublassing the Feed
from the generic View
. But this apparently will break backwards compatibility.
@timgraham, what do you think about it? Is it worth bothering?
comment:5 by , 9 years ago
Either add it to the Feed class in Got it, Feed.__call__()
, or later on in Feed.get_feed()
If that is not convenient for some reason (@alexmorozov care to elaborate on thread safe part, How this wont be thread safe?! I'm not an expert in this area)request
is a class attribute in our case.
Another option is to send request
as a parameter.. not a big fan of that road.
comment:6 by , 9 years ago
Replying to alexmorozov:
I believe this will require functionality similar to
View.as_view()
to be thread-safe. Or even sublassing theFeed
from the genericView
. But this apparently will break backwards compatibility.
Can we implement as_view()
code in the __call__()
behind the scenes and escape backward-incompatibility ?!
comment:7 by , 9 years ago
@RamezIssac: I surely can implement it either as a as_view()
addition or a __call__()
override. The problem is, AFAIK, Django is very conservative when it comes to breaking compatibility (it seems to me, the __call()__
override will break it too).
So I'd like to get an approvement from core devs before I start, so that my work won't be ultimately dumped.
I you ask me, I believe we should subclass the generic.View
.
comment:8 by , 9 years ago
Easy pickings: | unset |
---|
Clearing the 'Easy pickings' flag, as it is obviously not the case.
comment:9 by , 3 years ago
Owner: | removed |
---|---|
Status: | assigned → new |
Looks like an okay idea at first glance.