Permalink
Browse files

requirements updated for django 1.4.1, i18nurls for django1.3, reversion

reversion test fixes in django1.4.1
  • Loading branch information...
1 parent 569cffc commit c4b11bf9daab236fce950313cbddca4ac279ed49 @digi604 digi604 committed Sep 21, 2012
@@ -29,7 +29,7 @@ class Meta:
app_label = 'cms'
def __unicode__(self):
- return "%s (%s)" % (self.title, self.slug)
+ return "%s (%s, %s)" % (self.title, self.slug, self.language)
def save(self, *args, **kwargs):
# Update the path attribute before saving
View
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-from django.utils.functional import empty
+
import os
gettext = lambda s: s
@@ -186,12 +186,21 @@ def configure(**extra):
'django.contrib.auth.hashers.MD5PasswordHasher',
)
)
+ import django
+ version = django.get_version()
+ if version[:3] == "1.3":
+ defaults['INSTALLED_APPS'].append("i18nurls")
+ else:
+ from django.utils.functional import empty
+ settings._wrapped = empty
defaults.update(extra)
- settings._wrapped = empty
+
settings.configure(**defaults)
from cms.conf import patch_settings
patch_settings()
from south.management.commands import patch_for_test_db_setup
patch_for_test_db_setup()
from django.contrib import admin
+
+
admin.autodiscover()
@@ -1,7 +1,10 @@
from django.conf import settings
from django.conf.urls.defaults import handler500, handler404, patterns, include, \
url
-from django.conf.urls.i18n import i18n_patterns
+try:
+ from django.conf.urls.i18n import i18n_patterns
+except ImportError:
+ from i18nurls.i18n import i18n_patterns
from django.contrib import admin
admin.autodiscover()
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-{% load cms_tags i18n %}
+{% load cms_tags i18n_compat %}
{% load url from future %}
{% block content %}
@@ -1,7 +1,10 @@
from django.conf import settings
from django.conf.urls.defaults import handler500, handler404, patterns, include, \
url
-from django.conf.urls.i18n import i18n_patterns
+try:
+ from django.conf.urls.i18n import i18n_patterns
+except ImportError:
+ from i18nurls.i18n import i18n_patterns
from django.contrib import admin
admin.autodiscover()
@@ -2,7 +2,11 @@
from django.conf.urls.defaults import handler500, handler404, patterns, include, \
url
from django.contrib import admin
-from django.conf.urls.i18n import i18n_patterns
+try:
+ from django.conf.urls.i18n import i18n_patterns
+except ImportError:
+ from i18nurls.i18n import i18n_patterns
+
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
admin.autodiscover()
@@ -1,7 +1,10 @@
from django.conf import settings
from django.conf.urls.defaults import handler500, handler404, patterns, include, \
url
-from django.conf.urls.i18n import i18n_patterns
+try:
+ from django.conf.urls.i18n import i18n_patterns
+except ImportError:
+ from i18nurls.i18n import i18n_patterns
from django.contrib import admin
admin.autodiscover()
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import with_statement
-from cms.models import Page
+from cms.models import Page, Title
from cms.models.pluginmodel import CMSPlugin
from cms.plugins.text.models import Text
from cms.test_utils.project.fileapp.models import FileModel
@@ -68,6 +68,7 @@ def test_revert(self):
"""
with self.login_user_context(User.objects.get(username="test")):
self.assertEquals(Page.objects.all().count(), 2)
+ self.assertEquals(Title.objects.all().count(), 2)
self.assertEquals(CMSPlugin.objects.all().count(), 2)
self.assertEquals(Revision.objects.all().count(), 7)
@@ -83,8 +84,9 @@ def test_revert(self):
revert_url = history_url + "%s/" % version.pk
response = self.client.get(revert_url)
self.assertEquals(response.status_code, 200)
-
- response = self.client.post(revert_url, self.page_data)
+ data = self.page_data
+ response = self.client.post("%s?language=en&" % revert_url, self.page_data)
+ #print response
self.assertRedirects(response, URL_CMS_PAGE_CHANGE % page.pk)
# test for publisher_is_draft, published is set for both draft and
View
@@ -32,7 +32,9 @@ def is_valid_page_slug(page, parent, lang, slug, site, path=None):
qs = qs.filter(page__parent__isnull=True)
if page.pk:
- qs = qs.exclude(language=lang, page=page)
+ qs = qs.exclude(Q(language=lang)&Q(page=page))
+ if settings.CMS_MODERATOR:
+ qs = qs.exclude(page__publisher_public_id=page.id)
## Check for slugs
if qs.filter(slug=slug).count():
return False
@@ -1,4 +1,4 @@
-{% load i18n menu_tags %}
+{% load i18n_compat menu_tags %}
{% get_available_languages as languages %}
{% for language in languages %}
{% language language.0 %}
@@ -0,0 +1,11 @@
+from django import template
+
+register = template.Library()
+
+@register.tag
+def language(parser, token):
+ try:
+ from django.templatetags.i18n import language
+ except ImportError:
+ from i18nurls.templatetags.i18nurls import language
+ return language(parser, token)
@@ -1,2 +1,4 @@
-r requirements_base.txt
-Django==1.3.1
+Django==1.3.2
+-e git://github.com/brocaar/django-i18nurls.git#egg=django-i18nurls
+django-reversion==1.5.3
@@ -1,2 +1,3 @@
-r requirements_base.txt
-Django==1.4
+Django==1.4.1
+django-reversion==1.6.2
@@ -1,6 +1,5 @@
coverage==3.4
unittest-xml-reporting==1.0.3
-django-reversion==1.4
sphinx
Pillow==1.7.7
django-classy-tags>=0.3.4.1
@@ -9,3 +8,4 @@ html5lib
django-mptt==0.5.1
django-sekizai>=0.6.1
+

0 comments on commit c4b11bf

Please sign in to comment.