Adding support for multiple simultaneous Ext.Direct calls packed into an array.
[philo.git] / views.py
1 from django.http import Http404, HttpResponse
2 from django.template import RequestContext
3 from django.contrib.sites.models import Site
4 from philo.models import Node
5
6
7 def node_view(request, path=None, **kwargs):
8         node = None
9         subpath = None
10         if path is None:
11                 path = '/'
12         try:
13                 current_site = Site.objects.get_current()
14                 if current_site:
15                         node, subpath = Node.objects.get_with_path(path, root=current_site.root_node, absolute_result=False)
16         except Node.DoesNotExist:
17                 raise Http404
18         if not node:
19                 raise Http404
20         if subpath and not node.accepts_subpath:
21                 raise Http404
22         return node.render_to_response(request, path=path, subpath=subpath)