* Django 1.3+ <http://www.djangoproject.com/>
* django-mptt e734079+ <https://github.com/django-mptt/django-mptt/>
* (Optional) django-grappelli 2.0+ <http://code.google.com/p/django-grappelli/>
- * (Optional) recaptcha-django r6 <http://code.google.com/p/recaptcha-django/>
* (Optional) south 0.7.2+ <http://south.aeracode.org/>
+ * (Optional) recaptcha-django r6 <http://code.google.com/p/recaptcha-django/>
+
+To contribute, please visit the project website <http://project.philocms.org/> and/or make a fork of the git repository on GitHub <http://github.com/ithinksw/philo> or Gitorious <http://gitorious
+.org/ithinksw/philo>. Feel free to join us on IRC at irc://irc.oftc.net/#philo.
-To contribute, please visit the project website <http://philocms.org/>. Feel free to join us on IRC at irc://irc.oftc.net/#philo.
====
Using philo
* (Optional) [south 0.7.2+ <http://south.aeracode.org/)](http://south.aeracode.org/)
* (Optional) [recaptcha-django r6 <http://code.google.com/p/recaptcha-django/>](http://code.google.com/p/recaptcha-django/)
-To contribute, please visit the [project website](http://philocms.org/). Feel free to join us on IRC at [irc://irc.oftc.net/#philo](irc://irc.oftc.net/#philo>).
+To contribute, please visit the [project website](http://project.philocms.org/) and/or make a fork of the git repository on [GitHub](http://github.com/ithinksw/philo) or [Gitorious](http://gitorious
+.org/ithinksw/philo). Feel free to join us on IRC at [irc://irc.oftc.net/#philo](irc://irc.oftc.net/#philo).
Using philo
===========
* (Optional) `south 0.7.2+ <http://south.aeracode.org/>`_
* (Optional) `recaptcha-django r6 <http://code.google.com/p/recaptcha-django/>`_
-To contribute, please visit the `project website <http://philocms.org/>`_ or make a fork of the git repository on `GitHub <http://github.com/ithinksw/philo>`_ or `Gitorious <http://gitorious.org/ithinksw/philo>`_. Feel free to join us on IRC at `irc://irc.oftc.net/#philo <irc://irc.oftc.net/#philo>`_.
+To contribute, please visit the `project website <http://project.philocms.org/>`_ and/or make a fork of the git repository on `GitHub <http://github.com/ithinksw/philo>`_ or `Gitorious <http://gitorious.org/ithinksw/philo>`_. Feel free to join us on IRC at `irc://irc.oftc.net/#philo <irc://irc.oftc.net/#philo>`_.
Contents
++++++++
Next, add a philo :class:`.Page` - let's call it "Hello World Page" and use the template you just made.
-Now make a philo :class:`.Node`. Give it the slug ``hello-world``. Set the view content type to "Page" and use the page that you just made. If you navigate to ``/hello-world``, you will see the results of rendering the page!
+Now make a philo :class:`.Node`. Give it the slug ``hello-world``. Set the ``view_content_type`` to "Page" and the ``view_object_id`` to the id of the page that you just made - probably 1. If you navigate to ``/hello-world``, you will see the results of rendering the page!
Setting the root node
+++++++++++++++++++++
{% if content %}
<p>{{ content }}</p>
{% endif %}
- <p>The time is {% now %}.</p>
+ <p>The time is {% now "jS F Y H:i" %}.</p>
</body>
</html>
The navigation mechanism is fairly complex; unfortunately, there's no real way around that - without a lot of equally complex code that you are quite welcome to write and contribute! ;-)
-For this guide, we'll assume that you have the setup described in :doc:`getting-started`. We'll be adding a main :class:`.Navigation` to the root :class:`.Node` and making it display as part of the :class:`.Template`.
+For this guide, we'll assume that you have the setup described in :doc:`getting-started`. We'll be adding a main :class:`.Navigation` to the root :class:`.Node` and making it display as part of the :class:`.Template`. Before getting started, make sure that you've added :mod:`philo.contrib.shipherd` to your :setting:`INSTALLED_APPS`.
Creating the Navigation
+++++++++++++++++++++++
-VERSION = (0, '1rc')
+VERSION = (0, 9)
class RequestNodeMiddleware(object):
- """Adds a ``node`` attribute, representing the currently-viewed node, to every incoming :class:`HttpRequest` object. This is required by :func:`philo.views.node_view`."""
+ """
+ Adds a ``node`` attribute, representing the currently-viewed :class:`.Node`, to every incoming :class:`HttpRequest` object. This is required by :func:`philo.views.node_view`.
+
+ :class:`RequestNodeMiddleware` also catches all exceptions raised while handling requests that have attached :class:`.Node`\ s if :setting:`settings.DEBUG` is ``True``. If a :exc:`django.http.Http404` error was caught, :class:`RequestNodeMiddleware` will look for an "Http404" :class:`.Attribute` on the request's :class:`.Node`; otherwise it will look for an "Http500" :class:`.Attribute`. If an appropriate :class:`.Attribute` is found, and the value of the attribute is a :class:`.View` instance, then the :class:`.View` will be rendered with the exception in the ``extra_context``, bypassing any later handling of exceptions.
+
+ """
def process_view(self, request, view_func, view_args, view_kwargs):
try:
path = view_kwargs['path']
if isinstance(exception, Http404):
error_view = request.node.attributes.get('Http404', None)
+ status_code = 404
else:
error_view = request.node.attributes.get('Http500', None)
+ status_code = 500
if error_view is None or not isinstance(error_view, View):
# Should this be duck-typing? Perhaps even no testing?
return
extra_context = {'exception': exception}
- return error_view.render_to_response(request, extra_context)
\ No newline at end of file
+ response = error_view.render_to_response(request, extra_context)
+ response.status_code = status_code
+ return response
\ No newline at end of file