Changeset 5654
- Timestamp:
- 07/12/07 00:29:32 (1 year ago)
- Files:
-
- django/trunk/django/contrib/syndication/feeds.py (modified) (3 diffs)
- django/trunk/django/contrib/syndication/views.py (modified) (1 diff)
- django/trunk/docs/syndication_feeds.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/contrib/syndication/feeds.py
r5643 r5654 1 1 from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist 2 2 from django.template import Context, loader, Template, TemplateDoesNotExist 3 from django.contrib.sites.models import Site 3 from django.contrib.sites.models import Site, RequestSite 4 4 from django.utils import feedgenerator 5 5 from django.utils.encoding import smart_unicode, iri_to_uri … … 23 23 description_template = None 24 24 25 def __init__(self, slug, feed_url):25 def __init__(self, slug, request): 26 26 self.slug = slug 27 self.feed_url = feed_url 27 self.request = request 28 self.feed_url = request.path 28 29 self.title_template_name = self.title_template or ('feeds/%s_title.html' % slug) 29 30 self.description_template_name = self.description_template or ('feeds/%s_description.html' % slug) … … 68 69 obj = None 69 70 70 current_site = Site.objects.get_current() 71 if Site._meta.installed: 72 current_site = Site.objects.get_current() 73 else: 74 current_site = RequestSite(self.request) 75 71 76 link = self.__get_dynamic_attr('link', obj) 72 77 link = add_domain(current_site.domain, link) django/trunk/django/contrib/syndication/views.py
r4265 r5654 17 17 18 18 try: 19 feedgen = f(slug, request .path).get_feed(param)19 feedgen = f(slug, request).get_feed(param) 20 20 except feeds.FeedDoesNotExist: 21 21 raise Http404, "Invalid feed parameters. Slug %r is valid, but other parameters, or lack thereof, are not." % slug django/trunk/docs/syndication_feeds.txt
r5650 r5654 31 31 Initialization 32 32 -------------- 33 34 If you're not using the latest Django development version, you'll need to make 35 sure Django's sites framework is installed -- including its database table. 36 (See the `sites framework documentation`_ for more information.) This has 37 changed in the Django development version; the syndication feed framework no 38 longer requires the sites framework. 33 39 34 40 To activate syndication feeds on your Django site, add this line to your … … 73 79 Once that's set up, you just need to define the ``Feed`` classes themselves. 74 80 81 .. _sites framework documentation: ../sites/ 75 82 .. _URLconf: ../url_dispatch/ 76 83 .. _settings file: ../settings/ … … 132 139 * ``{{ obj }}`` -- The current object (one of whichever objects you 133 140 returned in ``items()``). 134 * ``{{ site }}`` -- A ``django. models.core.sites.Site`` object141 * ``{{ site }}`` -- A ``django.contrib.sites.models.Site`` object 135 142 representing the current site. This is useful for 136 ``{{ site.domain }}`` or ``{{ site.name }}``. 143 ``{{ site.domain }}`` or ``{{ site.name }}``. Note that if you're 144 using the latest Django development version and do *not* have the 145 Django sites framework installed, this will be set to a 146 ``django.contrib.sites.models.RequestSite`` object. See the 147 `RequestSite section of the sites framework documentation`_ for 148 more. 137 149 138 150 If you don't create a template for either the title or description, the … … 165 177 .. _object-relational mapper: ../db-api/ 166 178 .. _Django templates: ../templates/ 179 .. _RequestSite section of the sites framework documentation: ../sites/#requestsite-objects 167 180 168 181 A complex example
