Permalink
Browse files

Merge branch 'release/2.2'

  • Loading branch information...
Jonas Obrist
Jonas Obrist committed Sep 10, 2011
2 parents 8b9dc2d + 7334322 commit 686ed2fd096f0f84341f098c918c4ef7f87f8a03
Showing 782 changed files with 37,284 additions and 33,225 deletions.
View
@@ -0,0 +1,13 @@
+[django-cms.js]
+file_filter = cms/locale/<lang>/LC_MESSAGES/djangojs.po
+source_file = cms/locale/en/LC_MESSAGES/djangojs.po
+source_lang = en
+
+[main]
+host = http://www.transifex.net
+
+[django-cms.core]
+file_filter = cms/locale/<lang>/LC_MESSAGES/django.po
+source_file = cms/locale/en/LC_MESSAGES/django.po
+source_lang = en
+
View
24 AUTHORS
@@ -1,5 +1,6 @@
Current or previous core committers:
+* Angelo Dini
* Chris Glass
* Eric Robitaille
* Jonas Obrist
@@ -15,9 +16,9 @@ Contributors (in alphabetical order):
* Aaron Renner
* aball
* Adi Sieker
+* Adrián Ribao
* Alberto Paro
* Alessandro Ronchi
-* Angelo Dini
* angular_circle
* Antoni Aloy López
* Arne Gellhaus
@@ -36,8 +37,9 @@ Contributors (in alphabetical order):
* Cheng-Chia Tseng
* Chris Adams
* Chris Hughes
+* Chris Wesseling
* Christof Hagedorn
-* daniele
+* Daniele Procida
* DaNmarner
* Darryl Woods
* David Jean Louis
@@ -48,10 +50,12 @@ Contributors (in alphabetical order):
* eged
* Egor V. Nazarkin
* Ekrem Seren
+* Erik Allik
* Evandro Miquelito
* f4nt
* fcurella
* Filip Kazimierczak
+* Frank Bieniek
* GaretJax
* George Marshall
* Gerard Świderski
@@ -60,7 +64,7 @@ Contributors (in alphabetical order):
* Iacopo Spalletti
* Ian Lewis
* indexofire
-* Ionel Maries Cristian
+* Ionel Cristian Maries
* Ivan Vershigora
* izi
* Jameel Al-Aziz
@@ -75,7 +79,10 @@ Contributors (in alphabetical order):
* John-Scott Atlakson
* Jonathan Stoppani
* jordanjambazov
+* Jorge Vargas (elpargo)
* kar1m
+* Keryn Knight
+* Kim Blomqvist
* kochin
* Krzysztof Bandurski
* kunitoki
@@ -84,14 +91,17 @@ Contributors (in alphabetical order):
* limpbrains :P
* Lucas Vogelsang
* Lucio Asnaghi
+* Luke Crooks
* Luke Plant
* m000
* Maik Lustenberger
* Manolis Stamatogiannakis
* Manuel Schmidt
+* Marco Bonetti
* Marco Rimoldi
* Mark Rogers
* Martin Bommeli
+* Martin Brochhaus
* Martin Kosír
* martinkosir
* mathijs
@@ -102,6 +112,8 @@ Contributors (in alphabetical order):
* meers
* MerLex
* Mokys
+* Mike Johnson
+* Mitar
* mrlundis
* MW
* neoprolog
@@ -127,18 +139,22 @@ Contributors (in alphabetical order):
* Rodolfo Carvalho
* rtpm
* Samuel Lüscher
+* Scott Barnham
* sealibora
* Sean Bleier
+* Seth Buntin
* Seyhun Akyurek
* Shatalov Vadim
* shed
* Shinya Okano
* Simon Hedberg
* Simon Meers
+* Simon Charette
* sleytr
* spookylukey
* ssteinerX
* Stavros Korokithakis
+* Stephan Jaekel
* Steve R. Jones
* Steve Steiner
* Tanel Külaots
@@ -147,12 +163,12 @@ Contributors (in alphabetical order):
* Tino de Bruijn
* tiret
* Ulrich Petri
+* Vasil Vangelovski
* wangJunjie
* Wayne Moore
* wid
* wildermesser
* Yann Malet
-* Yann Malet
* yedpodtrzitko
* yohanboniface
* Yosuke Ikeda
View
@@ -55,3 +55,11 @@
==== 2.1.4 (2011-08-24) ====
- Fixed a XSS issue in Text Plugins
+
+==== 2.2.0 (In Development) ====
+
+- Replaced the old plugin media framework with django-sekizai. (This changed some plugin templates which might cause problems with your CSS styling).
+- Made django-mptt a proper dependency
+- Removed support for django-dbgettext
+- Google Maps Plugin now defaults to use HTTPS.
+- Google Maps Plugin now uses the version 3 of their API, no longer requiring an API Key.
View
@@ -4,8 +4,8 @@ include README.rst
include CHANGELOG.txt
recursive-include cms/locale *
recursive-include cms/templates *
-recursive-include cms/media *
+recursive-include cms/static *
recursive-include cms/plugins *
recursive-include menus/templates *
-recursive-include mptt/tests/fixtures *.json
recursive-include docs *
+recursive-exclude * *.pyc
View
@@ -1,10 +1,5 @@
# -*- coding: utf-8 -*-
-VERSION = (2, 1, 4, 'final')
-if VERSION[-1] != "final": # pragma: no cover
- __version__ = '.'.join(map(str, VERSION))
-else: # pragma: no cover
- __version__ = '.'.join(map(str, VERSION[:-1]))
-
+__version__ = '2.2'
# patch settings
try:
View
@@ -8,12 +8,42 @@
from django.contrib.admin.views.main import ChangeList, ALL_VAR, IS_POPUP_VAR, \
ORDER_TYPE_VAR, ORDER_VAR, SEARCH_VAR
from django.contrib.sites.models import Site
-from menus.utils import find_children
-
COPY_VAR = "copy"
+
+def cache_tree_children(queryset):
+ """
+ For all items in the queryset, set the '_cached_children' attribute to a
+ list. This attribute is in turn used by the 'get_children' method on the
+ item, which would otherwise (if '_cached_children' is not set) cause a
+ database query.
+
+ The queryset MUST BE ORDERED BY 'lft', 'tree_id'! Otherwise this function
+ will raise a ValueError.
+ """
+ parents_dict = {}
+ lastleft = -1 # integrity check
+ lasttree = -1 # integrity check
+ for obj in queryset:
+ parents_dict[obj.pk] = obj
+ if obj.tree_id == lasttree and obj.lft < lastleft: # integrity check
+ raise ValueError('Objects passed in the wrong order, must be ordered by the mptt left attribute and tree id')
+ lastleft = obj.lft # integrity check
+ lasttree = obj.tree_id # integrity check
+ # set the '_cached_children' attribute
+ obj._cached_children = []
+ # get the parent of this object (if available) via parent_id
+ parent = parents_dict.get(obj.parent_id, None)
+ if parent:
+ # if there is a parent, append the current object to the _cached_children
+ # list of the parent. Since the objects are ordered by lft, tree_id
+ # the _cached_children attribute will always have been set by this
+ # function already.
+ parent._cached_children.append(obj)
+
+
class CMSChangeList(ChangeList):
'''
Renders a Changelist - In our case it looks like a tree - it's the list of
@@ -50,7 +80,6 @@ def get_query_set(self, request=None):
self.root_query_set = self.root_query_set.filter(pk__in=permissions)
self.real_queryset = True
qs = qs.filter(site=self._current_site)
- qs = qs.order_by('tree_id', 'parent', 'lft')
return qs
def is_filtered(self):
@@ -75,7 +104,8 @@ def set_items(self, request):
site = self._current_site
# Get all the pages, ordered by tree ID (it's convenient to build the
# tree using a stack now)
- pages = self.get_query_set(request).drafts().order_by('tree_id', 'parent', 'lft').select_related()
+ pages = self.get_query_set(request).drafts().order_by('tree_id', 'lft').select_related()
+
# Get lists of page IDs for which the current user has
# "permission to..." on the current site.
@@ -111,13 +141,21 @@ def set_items(self, request):
ids = []
root_pages = []
pages = list(pages)
- all_pages = pages[:]
+ all_pages = pages[:] # That is, basically, a copy.
try:
home_pk = Page.objects.drafts().get_home(self.current_site()).pk
except NoHomeFound:
- home_pk = 0
+ home_pk = 0
+
+ # Unfortunately we cannot use the MPTT builtin code for pre-caching
+ # the children here, because MPTT expects the tree to be 'complete'
+ # and otherwise complaints about 'invalid item order'
+ cache_tree_children(pages)
+
for page in pages:
- children = []
+
+
+ children = page.get_children()
# note: We are using change_list permission here, because we must
# display also pages which user must not edit, but he haves a
@@ -133,7 +171,7 @@ def set_items(self, request):
# caching the permissions
page.permission_edit_cache = perm_edit_ids == Page.permissions.GRANT_ALL or page.pk in perm_edit_ids
page.permission_publish_cache = perm_publish_ids == Page.permissions.GRANT_ALL or page.pk in perm_publish_ids
- page.permission_advanced_settings_cache = perm_publish_ids == Page.permissions.GRANT_ALL or page.pk in perm_advanced_settings_ids
+ page.permission_advanced_settings_cache = perm_advanced_settings_ids == Page.permissions.GRANT_ALL or page.pk in perm_advanced_settings_ids
page.permission_user_cache = request.user
if settings.CMS_MODERATOR:
@@ -155,6 +193,8 @@ def set_items(self, request):
if page.root_node or self.is_filtered():
page.last = True
if len(children):
+ # TODO: WTF!?!
+ # The last one is not the last... wait, what?
children[-1].last = False
page.menu_level = 0
root_pages.append(page)
@@ -163,10 +203,20 @@ def set_items(self, request):
else:
page.ancestors_ascending = []
page.home_pk_cache = home_pk
- if not self.is_filtered():
- find_children(page, pages, 1000, 1000, [], -1, soft_roots=False, request=request, no_extended=True, to_levels=1000)
- else:
- page.childrens = []
+
+ # Because 'children' is the reverse-FK accessor for the 'parent'
+ # FK from Page->Page, we have to use wrong English here and set
+ # an attribute called 'childrens'. We are aware that this is WRONG
+ # but what should we do?
+
+ # If the queryset is filtered, do NOT set the 'childrens' attribute
+ # since *ALL* pages will be in the 'root_pages' list and therefore
+ # be displayed. (If the queryset is filtered, the result is not a
+ # tree but rather a flat list).
+ if self.is_filtered():
+ page.childrens = []
+ else:
+ page.childrens = children
# TODO: OPTIMIZE!!
titles = Title.objects.filter(page__in=ids)
@@ -29,7 +29,7 @@ def get_copy_dialog(request, page_id):
target = get_object_or_404(Page, pk=request.REQUEST['target'])
if not page.has_change_permission(request) or \
- not target.has_add_permission(request): # pragma: no cover
+ not target.has_add_permission(request): # pragma: no cover
raise Http404
context = {
Oops, something went wrong.

0 comments on commit 686ed2f

Please sign in to comment.