from dataclasses import dataclass
from typing import Any, Callable
from base64 import b64encode, b64decode
from dataclasses import dataclass
from typing import Any, Callable
from base64 import b64encode, b64decode
from http.server import BaseHTTPRequestHandler
from http.server import HTTPServer
from urllib.parse import urlparse, parse_qs
from http.server import BaseHTTPRequestHandler
from http.server import HTTPServer
from urllib.parse import urlparse, parse_qs
returns successfully, or right after any exception is triggered –
otherwise, race conditions become plausible.
returns successfully, or right after any exception is triggered –
otherwise, race conditions become plausible.
- Note that any POST attempt, even a failed one, may end in problematic
- inconsistencies:
+ Note that otherwise any POST attempt, even a failed one, may end in
+ problematic inconsistencies:
- if the POST handler experiences an Exception, changes to objects
won't get written to the DB, but the changed objects may remain in
- if the POST handler experiences an Exception, changes to objects
won't get written to the DB, but the changed objects may remain in
if hasattr(self, handler_name):
handler = getattr(self, handler_name)
redir_target = f(self, handler)
if hasattr(self, handler_name):
handler = getattr(self, handler_name)
redir_target = f(self, handler)
msg = f'{not_found_msg}: {self._site}'
raise NotFoundException(msg)
except HandledException as error:
msg = f'{not_found_msg}: {self._site}'
raise NotFoundException(msg)
except HandledException as error:
- title = b64decode(title_64.encode()).decode()
+ try:
+ title = b64decode(title_64.encode()).decode()
+ except binascii_Exception as exc:
+ msg = 'invalid base64 for ?title_b64='
+ raise BadFormatException(msg) from exc
owners = process.used_as_step_by(self.conn)
for step_id in owner_ids:
owners += [Process.by_id(self.conn, step_id)]
owners = process.used_as_step_by(self.conn)
for step_id in owner_ids:
owners += [Process.by_id(self.conn, step_id)]
preset_top_step = process_id
return {'process': process, 'is_new': process.id_ is None,
'preset_top_step': preset_top_step,
preset_top_step = process_id
return {'process': process, 'is_new': process.id_ is None,
'preset_top_step': preset_top_step,