From: Stephen Burrows Date: Tue, 14 Jun 2011 23:24:09 +0000 (-0400) Subject: Merge branch 'master' into develop X-Git-Tag: philo-0.9.1^2~8^2~2 X-Git-Url: http://git.ithinksw.org/philo.git/commitdiff_plain/1c8fa4a2b433dc9a87814c15486929e20eaeecab?hp=bc77a18732f275f137b7f3921d15d809b786855b Merge branch 'master' into develop --- diff --git a/README b/README index f1ef32e..dbd9cc2 100644 --- a/README +++ b/README @@ -5,10 +5,12 @@ Prerequisites: * Django 1.3+ * django-mptt e734079+ * (Optional) django-grappelli 2.0+ - * (Optional) recaptcha-django r6 * (Optional) south 0.7.2+ + * (Optional) recaptcha-django r6 + +To contribute, please visit the project website and/or make a fork of the git repository on GitHub or Gitorious . Feel free to join us on IRC at irc://irc.oftc.net/#philo. -To contribute, please visit the project website . Feel free to join us on IRC at irc://irc.oftc.net/#philo. ==== Using philo diff --git a/README.markdown b/README.markdown index b85cb50..91a8115 100644 --- a/README.markdown +++ b/README.markdown @@ -9,7 +9,8 @@ Prerequisites: * (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 =========== diff --git a/docs/index.rst b/docs/index.rst index 079185d..7e960a0 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -19,7 +19,7 @@ Prerequisites: * (Optional) `south 0.7.2+ `_ * (Optional) `recaptcha-django r6 `_ -To contribute, please visit the `project website `_ or make a fork of the git repository on `GitHub `_ or `Gitorious `_. Feel free to join us on IRC at `irc://irc.oftc.net/#philo `_. +To contribute, please visit the `project website `_ and/or make a fork of the git repository on `GitHub `_ or `Gitorious `_. Feel free to join us on IRC at `irc://irc.oftc.net/#philo `_. Contents ++++++++ diff --git a/docs/tutorials/getting-started.rst b/docs/tutorials/getting-started.rst index d5d4c71..11eb927 100644 --- a/docs/tutorials/getting-started.rst +++ b/docs/tutorials/getting-started.rst @@ -53,7 +53,7 @@ Now that you've got everything configured, it's time to set up your first page! 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 +++++++++++++++++++++ @@ -78,7 +78,7 @@ Great! We've got a page that says "Hello World". But what if we want it to say s {% if content %}

{{ content }}

{% endif %} -

The time is {% now %}.

+

The time is {% now "jS F Y H:i" %}.

diff --git a/docs/tutorials/shipherd.rst b/docs/tutorials/shipherd.rst index f7988e6..3a62cb0 100644 --- a/docs/tutorials/shipherd.rst +++ b/docs/tutorials/shipherd.rst @@ -3,7 +3,7 @@ Using Shipherd in the Admin 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 +++++++++++++++++++++++ diff --git a/philo/__init__.py b/philo/__init__.py index e574b70..c07c373 100644 --- a/philo/__init__.py +++ b/philo/__init__.py @@ -1 +1 @@ -VERSION = (0, '1rc') +VERSION = (0, 9) diff --git a/philo/middleware.py b/philo/middleware.py index 037fdc8..f4f7e9d 100644 --- a/philo/middleware.py +++ b/philo/middleware.py @@ -36,7 +36,12 @@ def get_node(path): 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'] @@ -51,12 +56,16 @@ class RequestNodeMiddleware(object): 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