Skip to content

Commit d67a2b2

Browse files
committed
Merge branch 'master' of github.com:djity/djity
2 parents 22e6f6d + 772c1e0 commit d67a2b2

File tree

6 files changed

+24
-14
lines changed

6 files changed

+24
-14
lines changed

djity/locale/en/LC_MESSAGES/django.mo

1 Byte
Binary file not shown.

djity/project/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def update_context(self,context):
204204
# if no module name is declared we are in the project's context
205205
# for example the request might be for project.css
206206
# in this case permissions are asked for a current status of public
207-
if context['module_name'] is None:
207+
if not 'module' in context:
208208
context['perm'] = granted_perms(context['role'],settings.PUBLIC)
209209

210210
# get hierarchy of parent projects

djity/static/djity/js/widgets/editable.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ $.widget("ui.editable",{
1414
get_function:undefined,
1515
//send the id of the div to the save and get function
1616
send_divid:false,
17+
1718
toolbar:'maxi',
1819
},
1920
_create: function() {
@@ -59,6 +60,7 @@ $.widget("ui.editable",{
5960
*/
6061
if(! self.options.simple)
6162
{
63+
6264
self.editor_button = $('<button title="'+gettext('Rich Edit')+'">'+gettext('Rich Edit')+'</button>')
6365
.button({
6466
icons:{
@@ -143,12 +145,12 @@ $.widget("ui.editable",{
143145
editorBox = self.editorBox;
144146

145147
editorBox.hide(options.effect);
148+
146149
self._isOpen = false;
147150
if(self.is_editor){
148151
self.close_editor();
149152
}
150153
self.close();
151-
152154

153155
},
154156

@@ -182,6 +184,7 @@ $.widget("ui.editable",{
182184

183185
},
184186

187+
185188
save : function(close){
186189
var self = this,
187190
options = self.options,
@@ -355,8 +358,4 @@ $.widget("ui.editable",{
355358
document.execCommand ('insertLineBreak', false, null);
356359
},
357360

358-
359-
360-
361-
362361
});

djity/static/djity/js/widgets/register.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ dj.widgets.register =
3131
dj.widgets.register.close();
3232
};
3333

34-
3534
this.dialog = $('<div id="register_dialog" class="ui-helper-hidden" title="' + gettext('Create an account') +'"></div>')
3635
.keyup(function(e)
3736
{

djity/utils/context.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class JSONContext():
1111
def __init__(self,context):
1212
self.context = context
1313
def __repr__(self):
14-
return json.dumps(dict([(k,self.context[k]) for k in self.context._marked_as_json if k != 'json_context']),cls=DjityJSONEncoder)
14+
return json.dumps(dict([(k,self.context[k]) for k in self.context._marked_as_json if (k != 'json_context' and k in self.context)]),cls=DjityJSONEncoder)
1515

1616
class DjityContext(RequestContext):
1717

@@ -28,6 +28,14 @@ def __setitem__(self,key,value):
2828
RequestContext.__setitem__(self,key,value)
2929
self._marked_as_json.add(key)
3030

31+
def __delitem__(self,key):
32+
RequestContext.__delitem__(key)
33+
del self._marked_as_json[key]
34+
35+
def __iter__(self):
36+
for k in self._marked_as_json:
37+
yield (k,self[k])
38+
3139
def mark_as_json(self,attr_name):
3240
self._marked_as_json.add(attr_name)
3341

djity/utils/decorators.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
import logging
44

55
from django.http import HttpResponse,HttpResponseNotFound,HttpResponseForbidden,HttpResponseRedirect, Http404
6+
from django.shortcuts import render, render_to_response
67
from django.conf import settings
78
from django.utils.translation import ugettext_lazy as _
89
from django.contrib.auth import REDIRECT_FIELD_NAME
910
from django.utils.http import urlquote
1011
from django.contrib import messages
1112
from django.core.urlresolvers import reverse
1213

13-
from django.template import RequestContext
14+
from django.template import RequestContext, loader
1415
from djity.utils.context import DjityContext, JSTarget
1516

1617
from djity.project.models import Project
@@ -91,10 +92,6 @@ def _new_func(*args,**kwargs):
9192
# actually permissions are resolved here
9293
project.update_context(context)
9394

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-
9895
# if the user is not allowed to use this view, redirect or ask for
9996
# authentication of return error
10097
if not perm in context['perm']:
@@ -117,7 +114,14 @@ def _new_func(*args,**kwargs):
117114
context['info_message'] = request.GET['info_message']
118115

119116
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+
templ = loader.get_template('djity/base.html')
123+
return HttpResponseNotFound(templ.render(context))
124+
121125
if 'js_target' in context:
122126
func(*args,**kwargs)
123127
return context['js_target'].json()

0 commit comments

Comments
 (0)