Skip to content
Browse files

Merge pull request #1674 from bikeshedder/django_1_5

Add support for Django 1.5 - All unit tests pass for Django 1.4 and 1.5.
  • Loading branch information...
2 parents 251236c + b7822a0 commit cabdf486033d7b86a61cd9c89b7f138ca31d0952 @digi604 digi604 committed Mar 27, 2013
View
7 .travis.yml
@@ -1,15 +1,14 @@
language: python
python:
- - "2.5"
- "2.6"
- "2.7"
env:
- - DJANGO=test_requirements/django-1.3.txt DB='sqlite://localhost/:memory:'
- - DJANGO=test_requirements/django-1.3.txt DB='mysql://root@127.0.0.1/djangocms_test'
- - DJANGO=test_requirements/django-1.3.txt DB='postgres://postgres@127.0.0.1/djangocms_test'
- DJANGO=test_requirements/django-1.4.txt DB='sqlite://localhost/:memory:'
- DJANGO=test_requirements/django-1.4.txt DB='mysql://root@127.0.0.1/djangocms_test'
- DJANGO=test_requirements/django-1.4.txt DB='postgres://postgres@127.0.0.1/djangocms_test'
+ - DJANGO=test_requirements/django-1.5.txt DB='sqlite://localhost/:memory:'
+ - DJANGO=test_requirements/django-1.5.txt DB='mysql://root@127.0.0.1/djangocms_test'
+ - DJANGO=test_requirements/django-1.5.txt DB='postgres://postgres@127.0.0.1/djangocms_test'
before_script:
- sh -c "if [ '$DB' = 'postgres://postgres@127.0.0.1/djangocms_test' ]; then psql -c 'DROP DATABASE IF EXISTS djangocms_test;' -U postgres; fi"
View
3 AUTHORS
@@ -150,9 +150,10 @@ Contributors (in alphabetical order):
* Mel Collins
* meers
* MerLex
-* Mokys
+* Michael P. Jung
* Mike Johnson
* Mitar
+* Mokys
* mrlundis
* MW
* neoprolog
View
2 CHANGELOG.txt
@@ -122,6 +122,8 @@
Please see Install/2.4 release notes *before* attempting to upgrade to version 2.4.
+- Compatibility with Django 1.4 and 1.5 (1.3 support dropped)
+- Support for Python 2.5 dropped
- CMS_LANGUAGE setting has changed
- CMS_HIDE_UNTRANSLATED setting removed
- CMS_LANGUAGE_FALLBACK setting removed
View
61 cms/admin/pageadmin.py
@@ -51,27 +51,17 @@
from cms.plugins.utils import has_reached_plugin_limit
from menus.menu_pool import menu_pool
-DJANGO_1_3 = LooseVersion(django.get_version()) < LooseVersion('1.4')
+DJANGO_1_4 = LooseVersion(django.get_version()) < LooseVersion('1.5')
require_POST = method_decorator(require_POST)
if 'reversion' in settings.INSTALLED_APPS:
import reversion
+ import reversion.models
from reversion.admin import VersionAdmin as ModelAdmin
- create_on_success = reversion.revision.create_on_success
+ from reversion import create_revision
else: # pragma: no cover
from django.contrib.admin import ModelAdmin
- create_on_success = lambda x: x
-
-if DJANGO_1_3:
- """
- Backwards compatibility for Django < 1.4 and django-reversion 1.6
- """
- class ModelAdmin(ModelAdmin):
- def get_inline_instances(self, request):
- return self.inline_instances
-
- def get_prepopulated_fields(self, request):
- return self.prepopulated_fields
+ create_revision = lambda: lambda x: x
def contribute_fieldsets(cls):
@@ -445,18 +435,22 @@ def get_form(self, request, obj=None, **kwargs):
return form
- def get_inline_instances(self, request):
- inlines = super(PageAdmin, self).get_inline_instances(request)
- if get_cms_setting('PERMISSION') and hasattr(self, '_current_page')\
- and self._current_page:
+ def get_inline_instances(self, request, obj=None):
+ if DJANGO_1_4:
+ inlines = super(PageAdmin, self).get_inline_instances(request)
+ if hasattr(self, '_current_page'):
+ obj = self._current_page
+ else:
+ inlines = super(PageAdmin, self).get_inline_instances(request, obj)
+ if get_cms_setting('PERMISSION') and obj:
filtered_inlines = []
for inline in inlines:
if (isinstance(inline, PagePermissionInlineAdmin)
and not isinstance(inline, ViewRestrictionInlineAdmin)):
if "recover" in request.path or "history" in request.path:
# do not display permissions in recover mode
continue
- if not self._current_page.has_change_permissions_permission(request):
+ if not obj.has_change_permissions_permission(request):
continue
filtered_inlines.append(inline)
inlines = filtered_inlines
@@ -524,9 +518,10 @@ def change_view(self, request, object_id, extra_context=None):
# get_inline_instances will need access to 'obj' so that it can
# determine if current user has enough rights to see PagePermissionInlineAdmin
- # because get_inline_instances doesn't receive 'obj' as a parameter,
- # the workaround is to set it as an attribute...
- self._current_page = obj
+ # because in django versions <1.5 get_inline_instances doesn't receive 'obj'
+ # as a parameter, the workaround is to set it as an attribute...
+ if DJANGO_1_4:
+ self._current_page = obj
response = super(PageAdmin, self).change_view(request, object_id, extra_context=extra_context)
if tab_language and response.status_code == 302 and response._headers['location'][1] == request.path :
location = response._headers['location']
@@ -626,12 +621,8 @@ def changelist_view(self, request, extra_context=None):
if not self.has_change_permission(request, None):
return HttpResponseForbidden(_("You do not have permission to change pages."))
try:
- if DJANGO_1_3:
- cl = CMSChangeList(request, self.model, self.list_display, self.list_display_links, self.list_filter,
- self.date_hierarchy, self.search_fields, self.list_select_related, self.list_per_page, self.list_editable, self)
- else:
- cl = CMSChangeList(request, self.model, self.list_display, self.list_display_links, self.list_filter,
- self.date_hierarchy, self.search_fields, self.list_select_related, self.list_per_page, self.list_max_show_all, self.list_editable, self)
+ cl = CMSChangeList(request, self.model, self.list_display, self.list_display_links, self.list_filter,
+ self.date_hierarchy, self.search_fields, self.list_select_related, self.list_per_page, self.list_max_show_all, self.list_editable, self)
except IncorrectLookupParameters:
# Wacky lookup parameters were given, so redirect to the main
# changelist page, without parameters, and pass an 'invalid=1'
@@ -728,7 +719,7 @@ def render_revision_form(self, request, obj, version, context, revert=False, rec
return super(PageAdmin, self).render_revision_form(request, obj, version, context, revert, recover)
@require_POST
- @create_on_success
+ @create_revision()
def change_template(self, request, object_id):
page = get_object_or_404(Page, pk=object_id)
if not page.has_change_permission(request):
@@ -950,7 +941,7 @@ def delete_view(self, request, object_id, *args, **kwargs):
return HttpResponseRedirect("../../../../")
return HttpResponseRedirect("../../")
- @create_on_success
+ @create_revision()
def delete_translation(self, request, object_id, extra_context=None):
language = get_language_from_request(request)
@@ -1121,7 +1112,7 @@ def descendants(self, request, page_id):
template="admin/cms/page/lazy_menu.html")
@require_POST
- @create_on_success
+ @create_revision()
def add_plugin(self, request):
"""
Could be either a page or a parent - if it's a parent we get the page via parent.
@@ -1190,7 +1181,7 @@ def add_plugin(self, request):
return HttpResponse(str(plugin.pk), content_type='text/plain')
@require_POST
- @create_on_success
+ @create_revision()
@transaction.commit_on_success
def copy_plugins(self, request):
if 'history' in request.path or 'recover' in request.path:
@@ -1225,7 +1216,7 @@ def copy_plugins(self, request):
plugin_list = CMSPlugin.objects.filter(language=language, placeholder=placeholder, parent=None).order_by('position')
return render_to_response('admin/cms/page/widgets/plugin_item.html', {'plugin_list':plugin_list}, RequestContext(request))
- @create_on_success
+ @create_revision()
def edit_plugin(self, request, plugin_id):
plugin_id = int(plugin_id)
if not 'history' in request.path and not 'recover' in request.path:
@@ -1350,7 +1341,7 @@ def edit_plugin(self, request, plugin_id):
return response
@require_POST
- @create_on_success
+ @create_revision()
def move_plugin(self, request):
if 'history' in request.path:
return HttpResponseBadRequest(str("error"))
@@ -1417,7 +1408,7 @@ def move_plugin(self, request):
return HttpResponse(str("ok"))
@require_POST
- @create_on_success
+ @create_revision()
def remove_plugin(self, request):
if 'history' in request.path:
raise Http404()
View
18 cms/admin/permissionadmin.py
@@ -6,36 +6,18 @@
from cms.utils.conf import get_cms_setting
from cms.utils.permissions import get_user_permission_level
from copy import deepcopy
-from distutils.version import LooseVersion
from django.conf import settings
from django.contrib import admin
from django.template.defaultfilters import title
from django.utils.translation import ugettext as _
-import django
-
-DJANGO_1_3 = LooseVersion(django.get_version()) < LooseVersion('1.4')
PAGE_ADMIN_INLINES = []
class TabularInline(admin.TabularInline):
pass
-if DJANGO_1_3 and 'reversion' in settings.INSTALLED_APPS:
- """
- Backwards compatibility for Django < 1.4 and django-reversion 1.6
- """
- class TabularInline(TabularInline):
- def get_prepopulated_fields(self, request, obj=None):
- return self.prepopulated_fields
- from reversion.admin import helpers
- class CompatInlineAdminFormSet(helpers.InlineAdminFormSet):
- def __init__(self, inline, formset, fieldsets, prepopulated_fields=None,
- readonly_fields=None, model_admin=None):
- super(CompatInlineAdminFormSet, self).__init__(inline, formset, fieldsets, readonly_fields, model_admin)
- helpers.InlineAdminFormSet = CompatInlineAdminFormSet
-
class PagePermissionInlineAdmin(TabularInline):
model = PagePermission
View
7 cms/models/pagemodel.py
@@ -9,7 +9,6 @@
from cms.models.pluginmodel import CMSPlugin
from cms.publisher.errors import MpttPublisherCantPublish
from cms.utils import i18n, urlutils, page as page_utils
-from cms.utils import timezone
from cms.utils.copy_plugins import copy_plugins_to
from cms.utils.helpers import reversion_register
from django.conf import settings
@@ -18,6 +17,7 @@
from django.db import models
from django.db.models import Q
from django.shortcuts import get_object_or_404
+from django.utils import timezone
from django.utils.translation import get_language, ugettext_lazy as _
from menus.menu_pool import menu_pool
from mptt.models import MPTTModel
@@ -104,6 +104,11 @@ def __unicode__(self):
title = u""
return unicode(title)
+ def __repr__(self):
+ # This is needed to solve the infinite recursion when
+ # adding new pages.
+ return object.__repr__(self)
+
def is_dirty(self):
return self.publisher_state == self.PUBLISHER_STATE_DIRTY
View
7 cms/models/pluginmodel.py
@@ -8,13 +8,14 @@
from django.db import models
from django.db.models.base import model_unpickle
from django.db.models.query_utils import DeferredAttribute
+from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from cms.exceptions import DontUsePageAttributeWarning
from cms.models.placeholdermodel import Placeholder
from cms.plugin_rendering import PluginContext, render_plugin
from cms.utils.helpers import reversion_register
-from cms.utils import timezone, get_cms_setting
+from cms.utils import get_cms_setting
from mptt.models import MPTTModel, MPTTModelBase
@@ -153,9 +154,7 @@ def get_plugin_instance(self, admin=None):
if plugin.model != self.__class__: # and self.__class__ == CMSPlugin:
# (if self is actually a subclass, getattr below would break)
try:
- instance = getattr(self, plugin.model.__name__.lower())
- # could alternatively be achieved with:
- # instance = plugin_class.model.objects.get(cmsplugin_ptr=self)
+ instance = plugin_class.model.objects.get(cmsplugin_ptr=self)
instance._render_meta = self._render_meta
except (AttributeError, ObjectDoesNotExist):
instance = None
View
2 cms/models/query.py
@@ -6,7 +6,7 @@
from cms.publisher.query import PublisherQuerySet
from django.conf import settings
from cms.exceptions import NoHomeFound
-from cms.utils import timezone
+from django.utils import timezone
class PageQuerySet(PublisherQuerySet):
View
2 cms/models/titlemodels.py
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
from django.db import models
+from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from cms.models.managers import TitleManager
from cms.models.pagemodel import Page
from cms.utils.helpers import reversion_register
-from cms.utils import timezone
class Title(models.Model):
View
17 cms/plugin_base.py
@@ -1,16 +1,22 @@
# -*- coding: utf-8 -*-
-from cms.utils import get_cms_setting
+from distutils.version import LooseVersion
import re
+
+from cms.utils import get_cms_setting
from cms.exceptions import SubClassNeededError, Deprecated
from cms.models import CMSPlugin
+import django
from django import forms
+from django.core.urlresolvers import reverse
from django.conf import settings
from django.contrib import admin
from django.core.exceptions import ImproperlyConfigured
from django.forms.models import ModelForm
from django.utils.encoding import smart_str
from django.utils.translation import ugettext_lazy as _
+DJANGO_1_4 = LooseVersion(django.get_version()) < LooseVersion('1.5')
+
class CMSPluginBaseMetaclass(forms.MediaDefiningClass):
"""
Ensure the CMSPlugin subclasses have sane values and set some defaults if
@@ -178,14 +184,19 @@ def response_change(self, request, obj):
self.object_successfully_changed = True
return super(CMSPluginBase, self).response_change(request, obj)
- def response_add(self, request, obj):
+ def response_add(self, request, obj, **kwargs):
"""
Just set a flag, so we know something was changed, and can make
new version if reversion installed.
New version will be created in admin.views.edit_plugin
"""
self.object_successfully_changed = True
- return super(CMSPluginBase, self).response_add(request, obj)
+ if not DJANGO_1_4:
+ post_url_continue = reverse('admin:cms_page_edit_plugin',
+ args=(obj._get_pk_val(),),
+ current_app=self.admin_site.name)
+ kwargs.setdefault('post_url_continue', post_url_continue)
+ return super(CMSPluginBase, self).response_add(request, obj, **kwargs)
def log_addition(self, request, object):
pass
View
6 cms/plugins/text/models.py
@@ -4,7 +4,7 @@
from cms.utils.html import clean_html
from django.db import models
from django.utils.html import strip_tags
-from django.utils.text import truncate_words
+from django.utils.text import Truncator
from django.utils.translation import ugettext_lazy as _
_old_tree_cache = {}
@@ -32,7 +32,7 @@ def _get_body_admin(self):
search_fields = ('body',)
def __unicode__(self):
- return u"%s" % (truncate_words(strip_tags(self.body), 3)[:30]+"...")
+ return Truncator(strip_tags(self.body)).chars(30)
def clean(self):
self.body = clean_html(self.body, full=False)
@@ -60,4 +60,4 @@ class Text(AbstractText):
"""
Actual Text Class
"""
-
+
View
2 cms/signals.py
@@ -133,7 +133,7 @@ def post_save_user(instance, raw, created, **kwargs):
from cms.utils.permissions import get_current_user
# read current user from thread locals
creator = get_current_user()
- if not creator or not created or not hasattr(creator, 'pk'):
+ if not creator or not created or creator.is_anonymous():
return
from django.db import connection
View
13 cms/templatetags/cms_js_tags.py
@@ -1,15 +1,24 @@
# -*- coding: utf-8 -*-
+from distutils.version import LooseVersion
+
from classytags.core import Tag, Options
+import django
from django import template
from django.core.serializers.json import DjangoJSONEncoder
-from django.utils import simplejson
from django.utils.text import javascript_quote
+DJANGO_1_4 = LooseVersion(django.get_version()) < LooseVersion('1.5')
+
+if DJANGO_1_4:
+ from django.utils import simplejson as json
+else:
+ import json
+
register = template.Library()
@register.filter
def js(value):
- return simplejson.dumps(value, cls=DjangoJSONEncoder)
+ return json.dumps(value, cls=DjangoJSONEncoder)
@register.filter
def bool(value):
View
11 cms/test_utils/cli.py
@@ -1,14 +1,11 @@
# -*- coding: utf-8 -*-
from __future__ import with_statement
-from distutils.version import LooseVersion
-import django
import os
import dj_database_url
gettext = lambda s: s
urlpatterns = []
-DJANGO_1_3 = LooseVersion(django.get_version()) < LooseVersion('1.4')
def configure(db_url, **extra):
from django.conf import settings
@@ -227,12 +224,8 @@ def configure(db_url, **extra):
'django.contrib.auth.hashers.MD5PasswordHasher',
)
)
- if DJANGO_1_3:
- defaults['INSTALLED_APPS'].append("i18nurls")
- defaults['MIDDLEWARE_CLASSES'][4] = 'i18nurls.middleware.LocaleMiddleware'
- else:
- from django.utils.functional import empty
- settings._wrapped = empty
+ from django.utils.functional import empty
+ settings._wrapped = empty
defaults.update(extra)
# add data from env
extra_settings = os.environ.get("DJANGO_EXTRA_SETTINGS", None)
View
3 cms/test_utils/project/sampleapp/templates/sampleapp/app.html
@@ -1,2 +1,3 @@
+{% load url from future %}
{{ app }}
-{% url namespaced_app_ns:current-app %}
+{% url 'namespaced_app_ns:current-app' %}
View
7 cms/test_utils/project/sampleapp/templates/sampleapp/extra.html
@@ -1,10 +1,11 @@
{% extends "base.html" %}
+{% load url from future %}
{% load cms_tags %}
{% block content %}
<h2>Sample application page - on page {% page_attribute page_title %}</h2>
<h3>{{ message }}</h3>
{{ block.super }}
- {% url extra_first %}
- {% url extra_second %}
-{% endblock content %}
+ {% url 'extra_first' %}
+ {% url 'extra_second' %}
+{% endblock content %}
View
2 cms/test_utils/project/sampleapp/templates/sampleapp/home.html
@@ -24,4 +24,4 @@
</ul>
<h4>Sample image - appmedia works?</h4>
<img src="{{ STATIC_URL }}sampleapp/img/gift.jpg" alt="gift">
-{% endblock content %}
+{% endblock content %}
View
9 cms/tests/admin.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import with_statement
+from distutils.version import LooseVersion
from cms.admin.change_list import CMSChangeList
from cms.admin.forms import PageForm
from cms.admin.pageadmin import contribute_fieldsets, contribute_list_filter, PageAdmin
@@ -19,6 +20,7 @@
from cms.test_utils.util.context_managers import SettingsOverride
from cms.test_utils.util.mock import AttributeObject
from cms.utils import get_cms_setting
+import django
from django.conf import settings
from django.contrib import admin
from django.contrib.admin.sites import site
@@ -31,6 +33,7 @@
from menus.menu_pool import menu_pool
from types import MethodType
+DJANGO_1_4 = LooseVersion(django.get_version()) < LooseVersion('1.5')
class AdminTestsBase(CMSTestCase):
@@ -951,7 +954,8 @@ def test_page_permission_inline_visibility(self):
# => must see the PagePermissionInline
self.assertTrue(
any(type(inline) is PagePermissionInlineAdmin
- for inline in page_admin.get_inline_instances(request)))
+ for inline in page_admin.get_inline_instances(request,
+ page if not DJANGO_1_4 else None)))
page = Page.objects.get(pk=page.pk)
# remove can_change_permission
@@ -963,7 +967,8 @@ def test_page_permission_inline_visibility(self):
# => PagePermissionInline is no longer visible
self.assertFalse(
any(type(inline) is PagePermissionInlineAdmin
- for inline in page_admin.get_inline_instances(request)))
+ for inline in page_admin.get_inline_instances(request,
+ page if not DJANGO_1_4 else None)))
def test_plugin_add_returns_valid_pk_for_plugin(self):
admin = self._get_admin()
View
3 cms/tests/page.py
@@ -10,6 +10,7 @@
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
from django.http import HttpRequest, HttpResponse, HttpResponseNotFound
+from django.utils import timezone
from cms.admin.forms import PageForm
from cms.admin.pageadmin import PageAdmin
@@ -27,8 +28,8 @@
from cms.test_utils.util.context_managers import (LanguageOverride,
SettingsOverride,
UserLoginContext)
+from cms.utils import get_cms_setting
from cms.utils.page_resolver import get_page_from_request, is_valid_url
-from cms.utils import timezone, get_cms_setting
from cms.utils.page import is_valid_page_slug
class PagesTestCase(CMSTestCase):
View
6 cms/tests/plugins.py
@@ -24,7 +24,7 @@
from cms.sitemaps.cms_sitemap import CMSSitemap
from cms.test_utils.util.context_managers import SettingsOverride
from cms.utils.copy_plugins import copy_plugins_to
-from cms.utils import timezone
+from django.utils import timezone
from django.conf import settings
from django.contrib import admin
from django.contrib.auth.models import User
@@ -134,7 +134,7 @@ def test_plugin_history_view(self):
"""
Test plugin history view
"""
- from reversion.models import Version
+ import reversion
page_data = self.get_new_page_data()
# two versions created by simply creating the page
response = self.client.post(URL_CMS_PAGE_ADD, page_data)
@@ -148,7 +148,7 @@ def test_plugin_history_view(self):
# page version 5
txt = self._edit_text_plugin(created_plugin_id, "Hello Bar")
self.assertEquals("Hello Bar", txt.body)
- versions = [v.pk for v in Version.objects.get_for_object(page)]
+ versions = [v.pk for v in reversed(reversion.get_for_object(page))]
history_url = '%s%d/' % (
URL_CMS_PLUGIN_HISTORY_EDIT % (page_id, versions[-2]),
created_plugin_id)
View
13 cms/tests/reversion_tests.py
@@ -12,8 +12,7 @@
from django.core.files.uploadedfile import SimpleUploadedFile
from os.path import join
from cms.test_utils.project.fileapp.models import FileModel
-from reversion import (revision as revision_manager,
- revision_context_manager as revision_context)
+import reversion
from reversion.models import Revision, Version, VERSION_CHANGE
import shutil
@@ -140,24 +139,26 @@ def tearDown(self):
shutil.rmtree(join(settings.MEDIA_ROOT, 'fileapp'))
def test_file_persistence(self):
- with revision_manager:
+ with reversion.create_revision():
# add a file instance
file1 = FileModel()
file1.test_file.save('file1.txt',
SimpleUploadedFile('file1.txt', 'content1'), False)
file1.save()
# manually add a revision because we use the explicit way
# django-cms uses too.
- adapter = revision_manager.get_adapter(FileModel)
- revision_context.add_to_context(revision_manager, file1, adapter.get_version_data(file1, VERSION_CHANGE))
+ adapter = reversion.get_adapter(FileModel)
+ reversion.revision_context_manager.add_to_context(
+ reversion.default_revision_manager, file1,
+ adapter.get_version_data(file1, VERSION_CHANGE))
# reload the instance from db
file2 = FileModel.objects.all()[0]
# delete the instance.
file2.delete()
# revert the old version
- file_version = Version.objects.get_for_object(file1)[0]
+ file_version = reversion.get_for_object(file1)[0]
file_version.revert()
# reload the reverted instance and check for its content
View
3 cms/tests/staticfiles.py
@@ -1,5 +1,4 @@
from __future__ import with_statement
-from cms.test_utils.compat import skipIf
from cms.test_utils.util.context_managers import SettingsOverride, StdoutOverride, TemporaryDirectory
import django
from django.core import management
@@ -9,8 +8,6 @@
class StaticFilesTest(TestCase):
- @skipIf(LooseVersion(django.get_version()) < LooseVersion('1.4'),
- "CachedStaticFilesStorage doesn't exist in Django < 1.4")
def test_collectstatic_with_cached_static_files_storage(self):
# CachedStaticFilesStorage requires that the CSS files
# don't contain any broken links.
View
6 cms/utils/__init__.py
@@ -81,13 +81,7 @@ def get_page_from_request(request):
return new(request)
-"""
-The following class is taken from https://github.com/jezdez/django/compare/feature/staticfiles-templatetag
-and should be removed and replaced by the django-core version in 1.4
-"""
default_storage = 'django.contrib.staticfiles.storage.StaticFilesStorage'
-if LooseVersion(django.get_version()) < LooseVersion('1.3'):
- default_storage = 'staticfiles.storage.StaticFilesStorage'
class ConfiguredStorage(LazyObject):
View
2 cms/utils/moderator.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import datetime
+from django.utils import timezone
from cms.models import Page, PageModeratorState, CMSPlugin, Title
-from cms.utils import timezone
def page_changed(page, old_page=None, force_moderation_action=None):
View
47 cms/utils/timezone.py
@@ -1,47 +0,0 @@
-# This file is a partial copy of django.utils.timezone as of Django 1.4.
-# It must be removed as soon as django-cms drops support for Django 1.3.
-# All imports of cms.utils.timezone must be replaced by django.utils.timezone.
-
-from datetime import datetime, timedelta, tzinfo
-from threading import local
-
-try:
- import pytz
-except ImportError:
- pytz = None
-
-from django.conf import settings
-
-ZERO = timedelta(0)
-
-class UTC(tzinfo):
- """
- UTC implementation taken from Python's docs.
-
- Used only when pytz isn't available.
- """
-
- def __repr__(self):
- return "<UTC>"
-
- def utcoffset(self, dt):
- return ZERO
-
- def tzname(self, dt):
- return "UTC"
-
- def dst(self, dt):
- return ZERO
-
-utc = pytz.utc if pytz else UTC()
-"""UTC time zone as a tzinfo instance."""
-
-def now():
- """
- Returns an aware or naive datetime.datetime, depending on settings.USE_TZ.
- """
- if getattr(settings, 'USE_TZ', False):
- # timeit shows that datetime.now(tz=utc) is 24% slower
- return datetime.utcnow().replace(tzinfo=utc)
- else:
- return datetime.now()
View
11 docs/getting_started/installation.rst
@@ -10,7 +10,7 @@ Requirements
************
* `Python`_ 2.5 (or a higher release of 2.x).
-* `Django`_ 1.3.1 or 1.4.
+* `Django`_ 1.4.5, 1.5 or higher
* `South`_ 0.7.2 or higher
* `PIL`_ 1.1.6 or higher
* `django-classy-tags`_ 0.3.4.1 or higher
@@ -40,11 +40,16 @@ Recommended
* `django-filer`_ with its `django CMS plugins`_, file and image management
application to use instead of some core plugins
-* `django-reversion`_ 1.6, to support versions of your content
+* `django-reversion`_ 1.6.6 (with Django 1.4.5), 1.7 (with Django 1.5)
+ to support versions of your content (If using a different Django version
+ it is a good idea to check the page `Compatible-Django-Versions`_ in the
+ django-reversion wiki in order to make sure that the package versions are
+ compatible.)
.. _django-filer: https://github.com/stefanfoulis/django-filer
.. _django CMS plugins: https://github.com/stefanfoulis/cmsplugin-filer
.. _django-reversion: https://github.com/etianen/django-reversion
+.. _Compatible-Django-Versions: https://github.com/etianen/django-reversion/wiki/Compatible-Django-Versions
On Ubuntu
=========
@@ -63,7 +68,7 @@ started:
sudo aptitude install python2.6 python-setuptools python-imaging
sudo easy_install pip
- sudo pip install Django==1.4 django-cms south
+ sudo pip install Django==1.5 django-cms south
Additionally, you need the Python driver for your selected database:
View
12 docs/upgrade/2.4.rst
@@ -18,6 +18,15 @@ What's new in 2.4
:ref:`cms-moderator-upgrade` below.
+Introducing Django 1.5 support, dropped support for Django 1.3 and Python 2.5
+=============================================================================
+
+Django CMS 2.4 introduces Django 1.5 support.
+
+In django CMS 2.4 we dropped support for Django 1.3 and Python 2.5.
+Django 1.4 and Python 2.6 are now the minimum required versions.
+
+
.. _migrations-upgrade:
Migrations overhaul
@@ -325,8 +334,7 @@ Backwards incompatible changes
New minimum requirements for dependencies
=========================================
-If you are running django 1.3.X you need to install django-i18nurls, if you want
-multilingual features. The ``cms.urls`` needs to be in a i18n url pattern.
+* Django 1.3 and Python 2.5 are no longer supported.
********************
View
2 setup.py
@@ -28,7 +28,7 @@
platforms=['OS Independent'],
classifiers=CLASSIFIERS,
install_requires=[
- 'Django>=1.3.1,<1.5',
+ 'Django>=1.4,<1.6',
'django-classy-tags>=0.3.4.1',
'south>=0.7.2',
'html5lib',
View
5 test_requirements/django-1.3.txt
@@ -1,5 +0,0 @@
--r requirements_base.txt
--e git://github.com/digi604/django-i18nurls.git#egg=django-i18nurls
-Django>=1.3,<1.4
-django-reversion==1.5.5
-psycopg2==2.3
View
4 test_requirements/django-1.4.txt
@@ -1,4 +1,4 @@
-r requirements_base.txt
-Django>=1.4,<1.5
-django-reversion==1.6
+Django>=1.4.5,<1.5
+django-reversion>=1.6.6,<1.7
psycopg2==2.4
View
4 test_requirements/django-1.5.txt
@@ -0,0 +1,4 @@
+-r requirements_base.txt
+Django>=1.5,<1.6
+django-reversion>=1.7,<1.8
+psycopg2==2.4

0 comments on commit cabdf48

Please sign in to comment.
Something went wrong with that request. Please try again.