self.strip_email = strip_email
self.generation_time = generation_time
self._refresh = 0
- self.http_user_error = 418
self._load_templates(template_dir=template_dir)
self._filters = {
'active': lambda bug: bug.active and bug.severity != 'target',
self.storage = storage
self.ui = libbe.command.base.UserInterface()
self.notify = notify
- self.http_user_error = 418
# handlers
def run(self, environ, start_response):
name = data['command']
except KeyError:
raise libbe.util.wsgi.HandlerError(
- self.http_user_error, 'UnknownCommand')
+ libbe.util.http.HTTP_USER_ERROR, 'UnknownCommand')
parameters = data.get('parameters', {})
try:
Class = libbe.command.get_command_class(command_name=name)
except libbe.command.UnknownCommand, e:
raise libbe.util.wsgi.HandlerError(
- self.http_user_error, 'UnknownCommand {}'.format(e))
+ libbe.util.http.HTTP_USER_ERROR, 'UnknownCommand {}'.format(e))
command = Class(ui=self.ui)
self.ui.setup_command(command)
arguments = [option.arg for option in command.options
import libbe
import libbe.command
import libbe.command.util
+import libbe.util.http
import libbe.util.subproc
import libbe.util.wsgi
import libbe.version
**kwargs)
self.storage = storage
self.notify = notify
- self.http_user_error = 418
# handlers
def add(self, environ, start_response):
revision = self.storage.commit(summary, body, allow_empty)
except libbe.storage.EmptyCommit, e:
raise libbe.util.wsgi.HandlerError(
- self.http_user_error, 'EmptyCommit')
+ libbe.util.http.HTTP_USER_ERROR, 'EmptyCommit')
if self.notify:
self._notify(environ, 'commit', id,
[('allow_empty', allow_empty), ('summary', summary),
import libbe.util.encoding
+import libbe.util.http
import libbe.util.id
import libbe.command
import libbe.command.base
"""
def __init__(self, *args, **kwargs):
super(BEExceptionApp, self).__init__(*args, **kwargs)
- self.http_user_error = 418
def _call(self, environ, start_response):
try:
raise libbe.util.wsgi.HandlerError(403, 'Write permission denied')
except libbe.storage.InvalidID as e:
raise libbe.util.wsgi.HandlerError(
- self.http_user_error, 'InvalidID {}'.format(e))
+ libbe.util.http.HTTP_USER_ERROR, 'InvalidID {}'.format(e))
except libbe.util.id.NoIDMatches as e:
raise libbe.util.wsgi.HandlerError(
- self.http_user_error, 'NoIDMatches {}'.format(e))
+ libbe.util.http.HTTP_USER_ERROR, 'NoIDMatches {}'.format(e))
class UppercaseHeaderApp (WSGI_Middleware):