[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Maposmatic-dev] [PATCH 3/4] Adapt feeds url code to Django 1.4
From: |
Étienne Loks |
Subject: |
Re: [Maposmatic-dev] [PATCH 3/4] Adapt feeds url code to Django 1.4 |
Date: |
Thu, 19 Apr 2012 11:58:36 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111120 Iceowl/1.0b2 Icedove/3.1.16 |
Hello Thomas,
Le 18/04/2012 22:37, Thomas Petazzoni a écrit :
> Le Wed, 18 Apr 2012 22:19:21 +0200,
> Thomas Petazzoni <address@hidden> a écrit :
>
>> Since 1.2, the declaration for the RSS feed url has slightly changed,
>> and the old way is no longer available in Django 1.4. So, switch to
>> the new way.
>>
>> Signed-off-by: Thomas Petazzoni <address@hidden>
>> ---
>> www/urls.py | 9 ++-------
>> 1 files changed, 2 insertions(+), 7 deletions(-)
>
> Unfortunately, it doesn't work really nicely due to the usage of
> django.contrib.gis.feeds with Django 1.2 (but it works fine in Django
> 1.4). Django 1.2 complains when parsing:
>
> + url(r'^feeds/(?P<url>.*)/$', MapsFeed(), name='rss-feed'),
>
> and says that __init__() takes 3 arguments and only one was provided (I
> guess it's the constructor of MapsFeed).
>
> On the dev.m.o instance, I have temporarily worked-around this by
> applying the following change:
>
> -from django.contrib.gis.feeds import Feed
> +# from django.contrib.gis.feeds import Feed
> +from django.contrib.syndication.views import Feed
>
> Étienne, do you know how to fix this problem to make the code Django
> 1.2 and 1.4 compatible?
The only way I am thinking of is to test Django version.
Something like:
import django
assert django.VERSION[0] == 1 and django.VERSION[1] >= 2
if django.VERSION[1] == 2:
from django.contrib.syndication.views import Feed
else:
from django.contrib.gis.feeds import Feed
--
Étienne Loks
Re: [Maposmatic-dev] [PATCH 3/4] Adapt feeds url code to Django 1.4, Thomas Petazzoni, 2012/04/23
[Maposmatic-dev] [PATCH 4/4] Read the GIS database lag from a local file, Thomas Petazzoni, 2012/04/18