[django-page-cms] r709 committed - Make get_placholder more safe to run

1 view
Skip to first unread message

codesite...@google.com

unread,
Sep 25, 2009, 4:43:25 AM9/25/09
to pinax-...@googlegroups.com
Revision: 709
Author: batiste.bieler
Date: Fri Sep 25 01:42:33 2009
Log: Make get_placholder more safe to run
http://code.google.com/p/django-page-cms/source/detail?r=709

Modified:
/trunk/example/templates/pages/index.html
/trunk/pages/templatetags/pages_tags.py
/trunk/pages/utils.py

=======================================
--- /trunk/example/templates/pages/index.html Mon Aug 24 23:56:49 2009
+++ /trunk/example/templates/pages/index.html Fri Sep 25 01:42:33 2009
@@ -2,9 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="{{ lang }}" xml:lang="{{
lang }}" >
<head>
<title>
-{% if current_page %}
{% show_content current_page "title" %}
-{% endif %}
</title>
<script type="text/javascript" src="{{ MEDIA_URL
}}pages/javascript/jquery.js" /></script>
<style>
=======================================
--- /trunk/pages/templatetags/pages_tags.py Wed Sep 23 06:47:28 2009
+++ /trunk/pages/templatetags/pages_tags.py Fri Sep 25 01:42:33 2009
@@ -385,6 +385,9 @@
def render(self, context):
if not self.page in context:
return ''
+ # current_page can be set to None
+ if not context[self.page]:
+ return ''

lang = context.get('lang', settings.PAGE_DEFAULT_LANGUAGE)
content = Content.objects.get_content(context[self.page], lang,
=======================================
--- /trunk/pages/utils.py Thu Sep 24 08:36:38 2009
+++ /trunk/pages/utils.py Fri Sep 25 01:42:33 2009
@@ -10,7 +10,7 @@

def get_context_mock():
"""return a mockup dictionnary to use in get_placeholders."""
- context = {}
+ context = {'current_page':None}
if settings.PAGE_EXTRA_CONTEXT:
context.update(settings.PAGE_EXTRA_CONTEXT())
return context

Reply all
Reply to author
Forward
0 new messages