Beispiel #1
0
 def render_GET(self, request):
     body = tags.form(
         tags.label('Tahoe URI', for_='uri'), ' ',
         tags.input(id='uri', type='text', name='uri'),
         tags.br(),
         tags.label('Extension', for_='ext'), ' ',
         tags.input(id='ext', type='text', name='ext'),
         tags.br(),
         tags.input(type='submit', value='Convert to HTTP URL'),
         action='', method='POST')
     return renderElement(request, body)
Beispiel #2
0
 def render_GET(self, request):
     body = tags.form(tags.label('Tahoe URI', for_='uri'),
                      ' ',
                      tags.input(id='uri', type='text', name='uri'),
                      tags.br(),
                      tags.label('Extension', for_='ext'),
                      ' ',
                      tags.input(id='ext', type='text', name='ext'),
                      tags.br(),
                      tags.input(type='submit',
                                 value='Convert to HTTP URL'),
                      action='',
                      method='POST')
     return renderElement(request, body)
Beispiel #3
0
    def decorator(self, request, tag):

        decorators = []

        if self.ob.decorators:
            for dec in self.ob.decorators:
                if isinstance(dec.asList()[0], ast.Name):
                    fn = self.ob.expandName(dec.asList()[0].name)
                    # We don't want to show the deprecated decorator, it shows up
                    # as an infobox
                    if fn == "twisted.python.deprecate.deprecated":
                        break
                decorators.append(ast_pp.pp(dec))

        if self.ob.kind == "Class Method" and "classmethod" not in decorators:
            decorators.append("classmethod")
        elif self.ob.kind == "Static Method" and "staticmethod" not in decorators:
            decorators.append("staticmethod")

        if decorators:
            decorator = [("@" + dec, tags.br()) for dec in decorators]
        else:
            decorator = ()

        return decorator
Beispiel #4
0
 def footer(self, request, tag):
     """
     Description of the actions which are scored.
     """
     for factor in sorted(_factors.values(), key=lambda f: f.order):
         tag(str(factor.points), " ", factor.description, tags.br())
     return tag
Beispiel #5
0
 def main(self, request, tag):
     path = request.URLPath()
     l = []
     for y in range(-5, 5):
         for x in range(-5, 5):
             child = path.child("%s,%s" % (x, y))
             l.append(tags.img(src=str(child), height="64", width="64"))
         l.append(tags.br())
     return tag(*l)
Beispiel #6
0
 def main(self, request, tag):
     path = request.URLPath()
     l = []
     for y in range(-5, 5):
         for x in range(-5, 5):
             child = path.child("%s,%s" % (x, y))
             l.append(tags.img(src=str(child), height="64", width="64"))
         l.append(tags.br())
     return tag(*l)
Beispiel #7
0
def format_decorators(obj: Union[model.Function, model.Attribute]) -> Iterator[Any]:
    for dec in obj.decorators or ():
        if isinstance(dec, ast.Call):
            fn = node2fullname(dec.func, obj)
            # We don't want to show the deprecated decorator;
            # it shows up as an infobox.
            if fn in ("twisted.python.deprecate.deprecated",
                      "twisted.python.deprecate.deprecatedProperty"):
                break

        text = '@' + astor.to_source(dec).strip()
        yield text, tags.br()
Beispiel #8
0
    def joinWithBR(elements):
        noValues = True

        for element in elements:
            if not noValues:
                yield html.br()

            yield asText(element)

            noValues = False

        if noValues:
            yield u"(no values)"
Beispiel #9
0
    def joinWithBR(elements):
        noValues = True

        for element in elements:
            if not noValues:
                yield html.br()

            yield asText(element)

            noValues = False

        if noValues:
            yield u"(no values)"
Beispiel #10
0
    def decorator(self, request, tag):
        if self.ob.decorators:
            decorators = [ast_pp.pp(dec) for dec in self.ob.decorators]
        else:
            decorators = []

        if self.ob.kind == "Class Method" \
               and 'classmethod' not in decorators:
            decorators.append('classmethod')
        elif self.ob.kind == "Static Method" \
                 and 'staticmethod' not in decorators:
            decorators.append('staticmethod')

        if decorators:
            decorator = [('@' + dec, tags.br()) for dec in decorators]
        else:
            decorator = ()

        return decorator
Beispiel #11
0
        def entry_rendered(entry):
            if entry.system_entry:
                attrs_entry = attrs_entry_system
            else:
                attrs_entry = attrs_entry_user

            return tags.div(
                tags.span(
                    str(entry.created),
                    u", ",
                    entry.author,
                    **attrs_timestamp
                ),
                ":",
                tags.br(),
                tags.span(
                    entry.text,
                    **attrs_entry_text
                ),
                **attrs_entry
            )
Beispiel #12
0
    def decorator(self, request, tag):

        decorators = []

        if self.ob.decorators:
            for dec in self.ob.decorators:
                if isinstance(dec, ast.Call):
                    if isinstance(dec.func, ast.Name):
                        fn = self.ob.expandName(dec.func.id)
                        # We don't want to show the deprecated decorator, it shows up
                        # as an infobox
                        if fn == "twisted.python.deprecate.deprecated":
                            break

                decorators.append(astor.to_source(dec).strip())

        if decorators:
            decorator = [('@' + dec, tags.br()) for dec in decorators]
        else:
            decorator = ()

        return decorator
Beispiel #13
0
    def pageSlots(self):
        slots = {
            u"title": u"Server Configuration",
        }

        for key in (
                "ServerHostName",
                "HTTPPort",
                "SSLPort",
                "BindAddresses",
                "BindHTTPPorts",
                "BindSSLPorts",
                "EnableSSL",
                "RedirectHTTPToHTTPS",
                "SSLCertificate",
                "SSLPrivateKey",
                "SSLAuthorityChain",
                "SSLMethod",
                "SSLCiphers",
                "EnableCalDAV",
                "EnableCardDAV",
                "ServerRoot",
                "EnableSSL",
                "UserQuota",
                "MaxCollectionsPerHome",
                "MaxResourcesPerCollection",
                "MaxResourceSize",
                "UserName",
                "GroupName",
                "ProcessType",
                "MultiProcess.MinProcessCount",
                "MultiProcess.ProcessCount",
                "MaxRequests",
        ):
            value = self.configuration

            for subkey in key.split("."):
                value = getattr(value, subkey)

            def describe(value):
                if value == u"":
                    return u"(empty string)"

                if value is None:
                    return u"(no value)"

                return html.code(unicode(value))

            if isinstance(value, list):
                result = []
                for item in value:
                    result.append(describe(item))
                    result.append(html.br())
                result.pop()

            else:
                result = describe(value)

            slots[key] = result

        return slots
Beispiel #14
0
    def pageSlots(self):
        slots = {
            u"title": u"Server Configuration",
        }

        for key in (
            "ServerHostName",
            "HTTPPort",
            "SSLPort",
            "BindAddresses",
            "BindHTTPPorts",
            "BindSSLPorts",
            "EnableSSL",
            "RedirectHTTPToHTTPS",
            "SSLCertificate",
            "SSLPrivateKey",
            "SSLAuthorityChain",
            "SSLMethod",
            "SSLCiphers",
            "EnableCalDAV",
            "EnableCardDAV",
            "ServerRoot",
            "EnableSSL",
            "UserQuota",
            "MaxCollectionsPerHome",
            "MaxResourcesPerCollection",
            "MaxResourceSize",
            "UserName",
            "GroupName",
            "ProcessType",
            "MultiProcess.MinProcessCount",
            "MultiProcess.ProcessCount",
            "MaxRequests",
        ):
            value = self.configuration

            for subkey in key.split("."):
                value = getattr(value, subkey)

            def describe(value):
                if value == u"":
                    return u"(empty string)"

                if value is None:
                    return u"(no value)"

                return html.code(unicode(value))

            if isinstance(value, list):
                result = []
                for item in value:
                    result.append(describe(item))
                    result.append(html.br())
                result.pop()

            else:
                result = describe(value)

            slots[key] = result

        return slots