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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pinax-updates" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/pinax-updates?hl=en -~----------~----~----~----~------~----~------~--~---
