3
3
import logging
4
4
5
5
from django .http import HttpResponse ,HttpResponseNotFound ,HttpResponseForbidden ,HttpResponseRedirect , Http404
6
+ from django .shortcuts import render , render_to_response
6
7
from django .conf import settings
7
8
from django .utils .translation import ugettext_lazy as _
8
9
from django .contrib .auth import REDIRECT_FIELD_NAME
9
10
from django .utils .http import urlquote
10
11
from django .contrib import messages
11
12
from django .core .urlresolvers import reverse
12
13
13
- from django .template import RequestContext
14
+ from django .template import RequestContext , loader
14
15
from djity .utils .context import DjityContext , JSTarget
15
16
16
17
from djity .project .models import Project
@@ -91,10 +92,6 @@ def _new_func(*args,**kwargs):
91
92
# actually permissions are resolved here
92
93
project .update_context (context )
93
94
94
- # if module was not found by projet.update_context() raise 404
95
- if module_name and not 'module' in context :
96
- return HttpResponseRedirect (djreverse ('page_not_found' ,context ))
97
-
98
95
# if the user is not allowed to use this view, redirect or ask for
99
96
# authentication of return error
100
97
if not perm in context ['perm' ]:
@@ -117,7 +114,16 @@ def _new_func(*args,**kwargs):
117
114
context ['info_message' ] = request .GET ['info_message' ]
118
115
119
116
kwargs ['context' ] = context
120
-
117
+
118
+ # if module was not found by projet.update_context() raise 404
119
+ if module_name and not 'module' in context :
120
+ context .message (_ ("This page does not exist on this project !" ))
121
+ context ["module" ] = {'label' :_ ('Page not found' )}
122
+ return render_to_response ('djity/base.html' ,context )
123
+ #t = loader.get_template('djity/base.html')
124
+ #r = t.render(context)
125
+ #return HttpResponseNotFound(r)
126
+
121
127
if 'js_target' in context :
122
128
func (* args ,** kwargs )
123
129
return context ['js_target' ].json ()
0 commit comments