diff --git a/src/allmydata/web/check_results.py b/src/allmydata/web/check_results.py
index 82c0a77..39524a9 100644
a
|
b
|
class ResultsBase: |
185 | 185 | target = target + "?output=%s" % output |
186 | 186 | return T.a(href=target)[si_s] |
187 | 187 | |
188 | | class LiteralCheckResults(rend.Page, ResultsBase): |
| 188 | class LiteralCheckResultsRenderer(rend.Page, ResultsBase): |
189 | 189 | docFactory = getxmlfile("literal-check-results.xhtml") |
190 | 190 | |
191 | 191 | def __init__(self, client): |
… |
… |
class CheckerBase: |
226 | 226 | return T.div[T.a(href=return_to)["Return to file/directory."]] |
227 | 227 | return "" |
228 | 228 | |
229 | | class CheckResults(CheckerBase, rend.Page, ResultsBase): |
| 229 | class CheckResultsRenderer(CheckerBase, rend.Page, ResultsBase): |
230 | 230 | docFactory = getxmlfile("check-results.xhtml") |
231 | 231 | |
232 | 232 | def __init__(self, client, results): |
… |
… |
class CheckResults(CheckerBase, rend.Page, ResultsBase): |
269 | 269 | cr = self._render_results(ctx, data) |
270 | 270 | return ctx.tag[cr] |
271 | 271 | |
272 | | class CheckAndRepairResults(CheckerBase, rend.Page, ResultsBase): |
| 272 | class CheckAndRepairResultsRenderer(CheckerBase, rend.Page, ResultsBase): |
273 | 273 | docFactory = getxmlfile("check-and-repair-results.xhtml") |
274 | 274 | |
275 | 275 | def __init__(self, client, results): |
… |
… |
class CheckAndRepairResults(CheckerBase, rend.Page, ResultsBase): |
316 | 316 | return "" |
317 | 317 | |
318 | 318 | |
319 | | class DeepCheckResults(rend.Page, ResultsBase, ReloadMixin): |
| 319 | class DeepCheckResultsRenderer(rend.Page, ResultsBase, ReloadMixin): |
320 | 320 | docFactory = getxmlfile("deep-check-results.xhtml") |
321 | 321 | |
322 | 322 | def __init__(self, client, monitor): |
… |
… |
class DeepCheckResults(rend.Page, ResultsBase, ReloadMixin): |
331 | 331 | si = base32.a2b(name) |
332 | 332 | r = self.monitor.get_status() |
333 | 333 | try: |
334 | | return CheckResults(self.client, |
335 | | r.get_results_for_storage_index(si)) |
| 334 | return CheckResultsRenderer(self.client, |
| 335 | r.get_results_for_storage_index(si)) |
336 | 336 | except KeyError: |
337 | 337 | raise WebError("No detailed results for SI %s" % html.escape(name), |
338 | 338 | http.NOT_FOUND) |
… |
… |
class DeepCheckResults(rend.Page, ResultsBase, ReloadMixin): |
470 | 470 | runtime = time.time() - req.processing_started_timestamp |
471 | 471 | return ctx.tag["runtime: %s seconds" % runtime] |
472 | 472 | |
473 | | class DeepCheckAndRepairResults(rend.Page, ResultsBase, ReloadMixin): |
| 473 | class DeepCheckAndRepairResultsRenderer(rend.Page, ResultsBase, ReloadMixin): |
474 | 474 | docFactory = getxmlfile("deep-check-and-repair-results.xhtml") |
475 | 475 | |
476 | 476 | def __init__(self, client, monitor): |
… |
… |
class DeepCheckAndRepairResults(rend.Page, ResultsBase, ReloadMixin): |
483 | 483 | # /operation/$OPHANDLE/$STORAGEINDEX provides detailed information |
484 | 484 | # about a specific file or directory that was checked |
485 | 485 | si = base32.a2b(name) |
486 | | r = self.monitor.get_status() |
| 486 | s = self.monitor.get_status() |
487 | 487 | try: |
488 | | return CheckAndRepairResults(self.client, |
489 | | r.get_results_for_storage_index(si)) |
| 488 | results = s.get_results_for_storage_index(si) |
| 489 | return CheckAndRepairResultsRenderer(self.client, results) |
490 | 490 | except KeyError: |
491 | 491 | raise WebError("No detailed results for SI %s" % html.escape(name), |
492 | 492 | http.NOT_FOUND) |
diff --git a/src/allmydata/web/directory.py b/src/allmydata/web/directory.py
index 58fe781..788f339 100644
a
|
b
|
from allmydata.web.common import text_plain, WebError, \ |
28 | 28 | get_format, get_mutable_type |
29 | 29 | from allmydata.web.filenode import ReplaceMeMixin, \ |
30 | 30 | FileNodeHandler, PlaceHolderNodeHandler |
31 | | from allmydata.web.check_results import CheckResults, \ |
32 | | CheckAndRepairResults, DeepCheckResults, DeepCheckAndRepairResults, \ |
33 | | LiteralCheckResults |
| 31 | from allmydata.web.check_results import CheckResultsRenderer, \ |
| 32 | CheckAndRepairResultsRenderer, DeepCheckResultsRenderer, \ |
| 33 | DeepCheckAndRepairResultsRenderer, LiteralCheckResultsRenderer |
34 | 34 | from allmydata.web.info import MoreInfo |
35 | 35 | from allmydata.web.operations import ReloadMixin |
36 | 36 | from allmydata.web.check_results import json_check_results, \ |
… |
… |
class DirectoryNodeHandler(RenderMixin, rend.Page, ReplaceMeMixin): |
421 | 421 | def _maybe_literal(self, res, Results_Class): |
422 | 422 | if res: |
423 | 423 | return Results_Class(self.client, res) |
424 | | return LiteralCheckResults(self.client) |
| 424 | return LiteralCheckResultsRenderer(self.client) |
425 | 425 | |
426 | 426 | def _POST_check(self, req): |
427 | 427 | # check this directory |
… |
… |
class DirectoryNodeHandler(RenderMixin, rend.Page, ReplaceMeMixin): |
430 | 430 | add_lease = boolean_of_arg(get_arg(req, "add-lease", "false")) |
431 | 431 | if repair: |
432 | 432 | d = self.node.check_and_repair(Monitor(), verify, add_lease) |
433 | | d.addCallback(self._maybe_literal, CheckAndRepairResults) |
| 433 | d.addCallback(self._maybe_literal, CheckAndRepairResultsRenderer) |
434 | 434 | else: |
435 | 435 | d = self.node.check(Monitor(), verify, add_lease) |
436 | | d.addCallback(self._maybe_literal, CheckResults) |
| 436 | d.addCallback(self._maybe_literal, CheckResultsRenderer) |
437 | 437 | return d |
438 | 438 | |
439 | 439 | def _start_operation(self, monitor, renderer, ctx): |
… |
… |
class DirectoryNodeHandler(RenderMixin, rend.Page, ReplaceMeMixin): |
450 | 450 | add_lease = boolean_of_arg(get_arg(ctx, "add-lease", "false")) |
451 | 451 | if repair: |
452 | 452 | monitor = self.node.start_deep_check_and_repair(verify, add_lease) |
453 | | renderer = DeepCheckAndRepairResults(self.client, monitor) |
| 453 | renderer = DeepCheckAndRepairResultsRenderer(self.client, monitor) |
454 | 454 | else: |
455 | 455 | monitor = self.node.start_deep_check(verify, add_lease) |
456 | | renderer = DeepCheckResults(self.client, monitor) |
| 456 | renderer = DeepCheckResultsRenderer(self.client, monitor) |
457 | 457 | return self._start_operation(monitor, renderer, ctx) |
458 | 458 | |
459 | 459 | def _POST_stream_deep_check(self, ctx): |
diff --git a/src/allmydata/web/filenode.py b/src/allmydata/web/filenode.py
index 18ffe2d..fd7e7eb 100644
a
|
b
|
from allmydata.web.common import text_plain, WebError, RenderMixin, \ |
19 | 19 | boolean_of_arg, get_arg, should_create_intermediate_directories, \ |
20 | 20 | MyExceptionHandler, parse_replace_arg, parse_offset_arg, \ |
21 | 21 | get_format, get_mutable_type |
22 | | from allmydata.web.check_results import CheckResults, \ |
23 | | CheckAndRepairResults, LiteralCheckResults |
| 22 | from allmydata.web.check_results import CheckResultsRenderer, \ |
| 23 | CheckAndRepairResultsRenderer, LiteralCheckResultsRenderer |
24 | 24 | from allmydata.web.info import MoreInfo |
25 | 25 | |
26 | 26 | class ReplaceMeMixin: |
… |
… |
class FileNodeHandler(RenderMixin, rend.Page, ReplaceMeMixin): |
285 | 285 | def _maybe_literal(self, res, Results_Class): |
286 | 286 | if res: |
287 | 287 | return Results_Class(self.client, res) |
288 | | return LiteralCheckResults(self.client) |
| 288 | return LiteralCheckResultsRenderer(self.client) |
289 | 289 | |
290 | 290 | def _POST_check(self, req): |
291 | 291 | verify = boolean_of_arg(get_arg(req, "verify", "false")) |
… |
… |
class FileNodeHandler(RenderMixin, rend.Page, ReplaceMeMixin): |
293 | 293 | add_lease = boolean_of_arg(get_arg(req, "add-lease", "false")) |
294 | 294 | if repair: |
295 | 295 | d = self.node.check_and_repair(Monitor(), verify, add_lease) |
296 | | d.addCallback(self._maybe_literal, CheckAndRepairResults) |
| 296 | d.addCallback(self._maybe_literal, CheckAndRepairResultsRenderer) |
297 | 297 | else: |
298 | 298 | d = self.node.check(Monitor(), verify, add_lease) |
299 | | d.addCallback(self._maybe_literal, CheckResults) |
| 299 | d.addCallback(self._maybe_literal, CheckResultsRenderer) |
300 | 300 | return d |
301 | 301 | |
302 | 302 | def render_DELETE(self, ctx): |