Ticket #1705: rename.diff

File rename.diff, 7.8 KB (added by warner, at 2012-04-03T02:50:02Z)

rename the web side to -Renderer

  • src/allmydata/web/check_results.py

    diff --git a/src/allmydata/web/check_results.py b/src/allmydata/web/check_results.py
    index 82c0a77..39524a9 100644
    a b class ResultsBase: 
    185185            target = target + "?output=%s" % output
    186186        return T.a(href=target)[si_s]
    187187
    188 class LiteralCheckResults(rend.Page, ResultsBase):
     188class LiteralCheckResultsRenderer(rend.Page, ResultsBase):
    189189    docFactory = getxmlfile("literal-check-results.xhtml")
    190190
    191191    def __init__(self, client):
    class CheckerBase: 
    226226            return T.div[T.a(href=return_to)["Return to file/directory."]]
    227227        return ""
    228228
    229 class CheckResults(CheckerBase, rend.Page, ResultsBase):
     229class CheckResultsRenderer(CheckerBase, rend.Page, ResultsBase):
    230230    docFactory = getxmlfile("check-results.xhtml")
    231231
    232232    def __init__(self, client, results):
    class CheckResults(CheckerBase, rend.Page, ResultsBase): 
    269269        cr = self._render_results(ctx, data)
    270270        return ctx.tag[cr]
    271271
    272 class CheckAndRepairResults(CheckerBase, rend.Page, ResultsBase):
     272class CheckAndRepairResultsRenderer(CheckerBase, rend.Page, ResultsBase):
    273273    docFactory = getxmlfile("check-and-repair-results.xhtml")
    274274
    275275    def __init__(self, client, results):
    class CheckAndRepairResults(CheckerBase, rend.Page, ResultsBase): 
    316316        return ""
    317317
    318318
    319 class DeepCheckResults(rend.Page, ResultsBase, ReloadMixin):
     319class DeepCheckResultsRenderer(rend.Page, ResultsBase, ReloadMixin):
    320320    docFactory = getxmlfile("deep-check-results.xhtml")
    321321
    322322    def __init__(self, client, monitor):
    class DeepCheckResults(rend.Page, ResultsBase, ReloadMixin): 
    331331        si = base32.a2b(name)
    332332        r = self.monitor.get_status()
    333333        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))
    336336        except KeyError:
    337337            raise WebError("No detailed results for SI %s" % html.escape(name),
    338338                           http.NOT_FOUND)
    class DeepCheckResults(rend.Page, ResultsBase, ReloadMixin): 
    470470        runtime = time.time() - req.processing_started_timestamp
    471471        return ctx.tag["runtime: %s seconds" % runtime]
    472472
    473 class DeepCheckAndRepairResults(rend.Page, ResultsBase, ReloadMixin):
     473class DeepCheckAndRepairResultsRenderer(rend.Page, ResultsBase, ReloadMixin):
    474474    docFactory = getxmlfile("deep-check-and-repair-results.xhtml")
    475475
    476476    def __init__(self, client, monitor):
    class DeepCheckAndRepairResults(rend.Page, ResultsBase, ReloadMixin): 
    483483        # /operation/$OPHANDLE/$STORAGEINDEX provides detailed information
    484484        # about a specific file or directory that was checked
    485485        si = base32.a2b(name)
    486         r = self.monitor.get_status()
     486        s = self.monitor.get_status()
    487487        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)
    490490        except KeyError:
    491491            raise WebError("No detailed results for SI %s" % html.escape(name),
    492492                           http.NOT_FOUND)
  • src/allmydata/web/directory.py

    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, \ 
    2828     get_format, get_mutable_type
    2929from allmydata.web.filenode import ReplaceMeMixin, \
    3030     FileNodeHandler, PlaceHolderNodeHandler
    31 from allmydata.web.check_results import CheckResults, \
    32      CheckAndRepairResults, DeepCheckResults, DeepCheckAndRepairResults, \
    33      LiteralCheckResults
     31from allmydata.web.check_results import CheckResultsRenderer, \
     32     CheckAndRepairResultsRenderer, DeepCheckResultsRenderer, \
     33     DeepCheckAndRepairResultsRenderer, LiteralCheckResultsRenderer
    3434from allmydata.web.info import MoreInfo
    3535from allmydata.web.operations import ReloadMixin
    3636from allmydata.web.check_results import json_check_results, \
    class DirectoryNodeHandler(RenderMixin, rend.Page, ReplaceMeMixin): 
    421421    def _maybe_literal(self, res, Results_Class):
    422422        if res:
    423423            return Results_Class(self.client, res)
    424         return LiteralCheckResults(self.client)
     424        return LiteralCheckResultsRenderer(self.client)
    425425
    426426    def _POST_check(self, req):
    427427        # check this directory
    class DirectoryNodeHandler(RenderMixin, rend.Page, ReplaceMeMixin): 
    430430        add_lease = boolean_of_arg(get_arg(req, "add-lease", "false"))
    431431        if repair:
    432432            d = self.node.check_and_repair(Monitor(), verify, add_lease)
    433             d.addCallback(self._maybe_literal, CheckAndRepairResults)
     433            d.addCallback(self._maybe_literal, CheckAndRepairResultsRenderer)
    434434        else:
    435435            d = self.node.check(Monitor(), verify, add_lease)
    436             d.addCallback(self._maybe_literal, CheckResults)
     436            d.addCallback(self._maybe_literal, CheckResultsRenderer)
    437437        return d
    438438
    439439    def _start_operation(self, monitor, renderer, ctx):
    class DirectoryNodeHandler(RenderMixin, rend.Page, ReplaceMeMixin): 
    450450        add_lease = boolean_of_arg(get_arg(ctx, "add-lease", "false"))
    451451        if repair:
    452452            monitor = self.node.start_deep_check_and_repair(verify, add_lease)
    453             renderer = DeepCheckAndRepairResults(self.client, monitor)
     453            renderer = DeepCheckAndRepairResultsRenderer(self.client, monitor)
    454454        else:
    455455            monitor = self.node.start_deep_check(verify, add_lease)
    456             renderer = DeepCheckResults(self.client, monitor)
     456            renderer = DeepCheckResultsRenderer(self.client, monitor)
    457457        return self._start_operation(monitor, renderer, ctx)
    458458
    459459    def _POST_stream_deep_check(self, ctx):
  • src/allmydata/web/filenode.py

    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, \ 
    1919     boolean_of_arg, get_arg, should_create_intermediate_directories, \
    2020     MyExceptionHandler, parse_replace_arg, parse_offset_arg, \
    2121     get_format, get_mutable_type
    22 from allmydata.web.check_results import CheckResults, \
    23      CheckAndRepairResults, LiteralCheckResults
     22from allmydata.web.check_results import CheckResultsRenderer, \
     23     CheckAndRepairResultsRenderer, LiteralCheckResultsRenderer
    2424from allmydata.web.info import MoreInfo
    2525
    2626class ReplaceMeMixin:
    class FileNodeHandler(RenderMixin, rend.Page, ReplaceMeMixin): 
    285285    def _maybe_literal(self, res, Results_Class):
    286286        if res:
    287287            return Results_Class(self.client, res)
    288         return LiteralCheckResults(self.client)
     288        return LiteralCheckResultsRenderer(self.client)
    289289
    290290    def _POST_check(self, req):
    291291        verify = boolean_of_arg(get_arg(req, "verify", "false"))
    class FileNodeHandler(RenderMixin, rend.Page, ReplaceMeMixin): 
    293293        add_lease = boolean_of_arg(get_arg(req, "add-lease", "false"))
    294294        if repair:
    295295            d = self.node.check_and_repair(Monitor(), verify, add_lease)
    296             d.addCallback(self._maybe_literal, CheckAndRepairResults)
     296            d.addCallback(self._maybe_literal, CheckAndRepairResultsRenderer)
    297297        else:
    298298            d = self.node.check(Monitor(), verify, add_lease)
    299             d.addCallback(self._maybe_literal, CheckResults)
     299            d.addCallback(self._maybe_literal, CheckResultsRenderer)
    300300        return d
    301301
    302302    def render_DELETE(self, ctx):