Skip to content
This repository
Browse code

Restored Python 2.5 support

* Backported itertools.chain.from_iterable for cms.sitemaps.cms_sitemap
* Replaced new-style property usage in cms.models.Placeholder with old style
  properties
* Added a missing future import in cms.middleware.multilingual
* Refactored the docs index page to have a separate section for
  installation and upgrades at the top.
* Added 2.3.3 release notes that include a deprecation warning for
  Python 2.5 in the next release.
  • Loading branch information...
commit e8032eb58c44e748614b7099d38a536a16d28b20 1 parent 1627429
Jonas Obrist authored
1  cms/middleware/multilingual.py
... ...
@@ -1,4 +1,5 @@
1 1
 # -*- coding: utf-8 -*-
  2
+from __future__ import with_statement
2 3
 from cms.test_utils.util.context_managers import SettingsOverride
3 4
 from cms.utils.i18n import get_default_language
4 5
 from django.conf import settings
8  cms/models/placeholdermodel.py
@@ -126,8 +126,7 @@ def _get_attached_models(self):
126 126
         """
127 127
         return [field.model for field in self._get_attached_fields()]
128 128
 
129  
-    @property
130  
-    def page(self):
  129
+    def page_getter(self):
131 130
         if not hasattr(self, '_page'):
132 131
             from cms.models.pagemodel import Page
133 132
             try:
@@ -136,10 +135,11 @@ def page(self):
136 135
                 self._page = None
137 136
         return self._page
138 137
 
139  
-    @page.setter
140  
-    def page(self, value):
  138
+    def page_setter(self, value):
141 139
         self._page = value
142 140
 
  141
+    page = property(page_getter, page_setter)
  142
+
143 143
     def get_plugins_list(self):
144 144
         return list(self.get_plugins())
145 145
 
11  cms/sitemaps/cms_sitemap.py
... ...
@@ -1,6 +1,13 @@
1 1
 # -*- coding: utf-8 -*-
2 2
 from django.contrib.sitemaps import Sitemap
3  
-import itertools
  3
+
  4
+def from_iterable(iterables):
  5
+    """
  6
+    Backport of itertools.chain.from_iterable
  7
+    """
  8
+    for it in iterables:
  9
+        for element in it:
  10
+            yield element
4 11
 
5 12
 class CMSSitemap(Sitemap):
6 13
     changefreq = "monthly"
@@ -15,7 +22,7 @@ def items(self):
15 22
     def lastmod(self, page):
16 23
         modification_dates = [page.changed_date, page.publication_date]
17 24
         plugins_for_placeholder = lambda placeholder: placeholder.cmsplugin_set.all()
18  
-        plugins = itertools.chain.from_iterable(map(plugins_for_placeholder, page.placeholders.all()))
  25
+        plugins = from_iterable(map(plugins_for_placeholder, page.placeholders.all()))
19 26
         plugin_modification_dates = map(lambda plugin: plugin.changed_date, plugins)
20 27
         modification_dates.extend(plugin_modification_dates)
21 28
         return max(modification_dates)
16  docs/index.rst
Source Rendered
@@ -9,6 +9,20 @@ Welcome to django CMS's documentation!
9 9
 
10 10
 This document refers to version |release|
11 11
 
  12
+*******
  13
+Install
  14
+*******
  15
+
  16
+.. toctree::
  17
+    :maxdepth: 1
  18
+
  19
+    getting_started/installation
  20
+    upgrade/2.3.3
  21
+    upgrade/2.3.2
  22
+    upgrade/2.3
  23
+    upgrade/2.2
  24
+    upgrade/2.1
  25
+
12 26
 ***************
13 27
 Getting Started
14 28
 ***************
@@ -17,8 +31,6 @@ Getting Started
17 31
     :maxdepth: 2
18 32
     :numbered:
19 33
 
20  
-    getting_started/installation
21  
-    upgrade/index
22 34
     getting_started/tutorial
23 35
     getting_started/using_south
24 36
     getting_started/configuration
2  docs/upgrade/2.3.2.rst
Source Rendered
@@ -7,7 +7,7 @@ What's new in 2.3.2
7 7
 *******************
8 8
 
9 9
 Google map plugin
10  
-===================
  10
+=================
11 11
 
12 12
 Google map plugin now supports width and height fields so that plugin size
13 13
 can be modified in the page admin or frontend editor.
19  docs/upgrade/2.3.3.rst
Source Rendered
... ...
@@ -0,0 +1,19 @@
  1
+###################
  2
+2.3.3 release notes
  3
+###################
  4
+
  5
+*******************
  6
+What's new in 2.3.3
  7
+*******************
  8
+
  9
+Restored Python 2.5 support
  10
+===========================
  11
+
  12
+2.3.3 restores Python 2.5 suppport for the django CMS.
  13
+
  14
+
  15
+********************
  16
+Pending deprecations
  17
+********************
  18
+
  19
+Python 2.5 support will be dropped in django CMS 2.4.
39  docs/upgrade/index.rst
Source Rendered
... ...
@@ -1,39 +0,0 @@
1  
-###################################
2  
-Upgrading a django CMS installation
3  
-###################################
4  
-
5  
-*************
6  
-2.3.2 Release
7  
-*************
8  
-
9  
-.. toctree::
10  
-    :maxdepth: 1
11  
-
12  
-    2.3.2
13  
-
14  
-***********
15  
-2.3 Release
16  
-***********
17  
-
18  
-.. toctree::
19  
-    :maxdepth: 1
20  
-
21  
-    2.3
22  
-
23  
-***********
24  
-2.2 Release
25  
-***********
26  
-
27  
-.. toctree::
28  
-    :maxdepth: 1
29  
-
30  
-    2.2
31  
-
32  
-******************
33  
-Upgrade from 2.1.x
34  
-******************
35  
-
36  
-.. toctree::
37  
-    :maxdepth: 1
38  
-
39  
-    2.1

0 notes on commit e8032eb

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