Пример #1
0
 def method_not_allowed_page(*args, **kwargs):
     """
     The method specified in the Request-Line is not allowed for the
     resource
     identified by the Request-URI. The response MUST include an
     Allow header
     containing a list of valid methods for the requested resource.
     """
     return render_template("errors/method_not_allowed.html"), 405
Пример #2
0
 def __call__(self, *args, **kwargs):
     html = super(PrepopulatedText, self).__call__(*args, **kwargs)
     slave = args[0].id
     if self.master:
         html += render_template('admin/custom/prepopulated.html',
                                 theme=current_app.config.get(
                                     'ADMIN_THEME', 'admin'),
                                 master=self.master,
                                 slave=slave)
     return html
Пример #3
0
 def __call__(self, *args, **kwargs):
     html = super(PrepopulatedText, self).__call__(*args, **kwargs)
     slave = args[0].id
     if self.master:
         html += render_template(
             'admin/custom/prepopulated.html',
             theme=current_app.config.get('ADMIN_THEME', 'admin'),
             master=self.master,
             slave=slave
         )
     return html
Пример #4
0
 def forbidden_page(*args, **kwargs):
     """
     The server understood the request, but is refusing to fulfill it.
     Authorization will not help and the request SHOULD NOT be repeated.
     If the request method was not HEAD and the server wishes to make public
     why the request has not been fulfilled, it SHOULD describe the
     reason for
     the refusal in the entity. If the server does not wish to make this
     information available to the client, the status code 404 (Not Found)
     can be used instead.
     """
     return render_template("errors/access_forbidden.html"), 403
Пример #5
0
 def __call__(self, field, **kwargs):
     c = kwargs.pop('class', '') or kwargs.pop('class_', '')
     kwargs['class'] = u'%s %s' % (self.css_cls, c)
     kwargs['rows'] = self.rows
     kwargs['cols'] = self.cols
     s = kwargs.pop('style', '') or kwargs.pop('style_', '')
     kwargs['style'] = u"%s %s" % (self.style_, s)
     html = super(TextEditor, self).__call__(field, **kwargs)
     html += render_template('admin/texteditor/%s.html' % self.editor,
                             theme=current_app.config.get(
                                 'ADMIN_THEME', 'admin'),
                             selector='.' + self.css_cls)
     return html
Пример #6
0
 def __call__(self, field, **kwargs):
     c = kwargs.pop('class', '') or kwargs.pop('class_', '')
     kwargs['class'] = u'%s %s' % (self.css_cls, c)
     kwargs['rows'] = self.rows
     kwargs['cols'] = self.cols
     s = kwargs.pop('style', '') or kwargs.pop('style_', '')
     kwargs['style'] = u"%s %s" % (self.style_, s)
     html = super(TextEditor, self).__call__(field, **kwargs)
     html += render_template(
         'admin/texteditor/%s.html' % self.editor,
         theme=current_app.config.get('ADMIN_THEME', 'admin'),
         selector='.' + self.css_cls
     )
     return html
Пример #7
0
 def page_not_found(*args, **kwargs):
     """
     The server has not found anything matching the Request-URI.
     No indication
     is given of whether the condition is temporary or permanent.
     The 410 (Gone)
     status code SHOULD be used if the server knows, through some internally
     configurable mechanism, that an old resource is permanently unavailable
     and has no forwarding address. This status code is commonly used when
     the
     server does not wish to reveal exactly why the request has been
     refused,
     or when no other response is applicable.
     """
     return render_template("errors/page_not_found.html"), 404
Пример #8
0
 def server_error_page(*args, **kwargs):
     return render_template("errors/server_error.html"), 500