Coverage for lino/core/views.py : 81%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# Copyright 2010-2015 Luc Saffre # License: BSD (see file COPYING for details)
"""
return json_response(kw)
""" Theroretically we should send content_type='application/json' (http://stackoverflow.com/questions/477816/the-right-json-content-type), but "File uploads are not performed using Ajax submission, that is they are not performed using XMLHttpRequests. (...) If the server is using JSON to send the return object, then the Content-Type header must be set to "text/html" in order to tell the browser to insert the text unchanged into the document body." (http://docs.sencha.com/ext-js/3-4/#!/api/Ext.form.BasicForm) See 20120209. """ #~ return HttpResponse(s, content_type='text/html') #~ return HttpResponse(s, content_type='application/json') #~ return HttpResponse(s, content_type='text/json')
""" Utility function which returns the requested actor, either directly or (if specified name is a model) that model's default table. """ raise http.Http404("There's no app_label %r here" % app_label) # raise Exception("There's no app_label %r here" % app_label) raise http.Http404("%s.%s is not a class" % (app_label, actor)) return cl.get_default_table() #~ raise http.Http404("%r is not an actor" % cl) raise http.Http404("%r is not an actor" % cl)
else: action_name = rpt.default_elem_action_name raise http.Http404( "%s has no url action %r (possible values are %s)" % ( rpt, action_name, rpt.get_url_action_names())) raise exceptions.PermissionDenied( "As %s you have no permission to run this action." % user.profile) # The text of an Exception may not be # internationalized because some error handling code # may want to write it to a plain ascii stream.
|