Export to GitHub

django-atompub - issue #10

Need access to the request class


Posted on Jun 14, 2010 by Happy Ox

You shoud modify the constructor for the Feed class to mimic the standard Django Feed, in that it should store the request object as a Feed attribute, thus allowing one to exploit RequestSite to get an xml:base attribute.

So, want this as constructor in Feed (in atom.py): def init(self, slug, request): ''' Save constructor attributes ''' self.slug=slug self.request=request

When that's done, one can use the request object a local method (say self._mydomain, and then use your feed_extra_attrs to set xml:base.

def _mydomain(self): ... code manipulates self.request ...

def feed_extra_attrs(self,model): return {'xml:base':self._mydomain()}

Status: New