[Buildbot-devel] [patch] make HTML status produce valid HTML

Brad Hards bradh at frogmouth.net
Sat Oct 22 05:04:43 UTC 2005


Any thoughts on this? Likely to be applied?

Brad

On Sunday 16 October 2005 16:15 pm, Brad Hards wrote:
> I converted my custom mail parser to the email package, but the changes
> displayed on the waterfall display still didn't handle UTF8 names
> correctly. Turns out that my browser was guessing iso-8859-1, not UTF-8.
>
> A bit more investigation showed that the output didn't validate (using
> the W3C validator). The patch below fixes those problems.
>
> The rationale for the changes:
> 1. orange isn't a valid color for CSS
> 2. charset needs to be specified
> 3. We need a valid doctype
> 4. <link> has to occur inside the <head>
>
> With those changes, the XHTML and CSS validate.
>
> Brad
>
> Index: classic.css
> ===================================================================
> RCS file: /cvsroot/buildbot/buildbot/buildbot/status/classic.css,v
> retrieving revision 1.1
> diff -u -4 -p -r1.1 classic.css
> --- classic.css 26 Apr 2005 02:43:12 -0000      1.1
> +++ classic.css 16 Oct 2005 06:08:16 -0000
> @@ -19,9 +19,9 @@ td.Event, td.BuildStep, td.Activity, td.
>  .failure {
>         background-color: red;
>  }
>  .warnings {
> -       background-color: orange;
> +       background-color: #FF8000;
>  }
>  .exception {
>         background-color: #c000c0;
>  }
> Index: html.py
> ===================================================================
> RCS file: /cvsroot/buildbot/buildbot/buildbot/status/html.py,v
> retrieving revision 1.69
> diff -u -4 -p -r1.69 html.py
> --- html.py     14 Oct 2005 19:42:40 -0000      1.69
> +++ html.py     16 Oct 2005 06:08:17 -0000
> @@ -139,9 +139,9 @@ class Box:
>
>
>  class HtmlResource(Resource):
>      css = None
> -    contentType = "text/html"
> +    contentType = "text/html; charset=UTF-8"
>      def render(self, request):
>          data = self.content(request)
>          request.setHeader("content-type", self.contentType)
>          if request.method == "HEAD":
> @@ -149,15 +149,20 @@ class HtmlResource(Resource):
>              return ''
>          return data
>      title = "Dummy"
>      def content(self, request):
> -        data = "<html>\n<head><title>" + self.title + "</title></head>\n"
> +        data = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
> Transitional//EN"\n' +        data +=
> '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n' +       
> data += '<html xmlns="http://www.w3.org/1999/xhtml" lang="en"
> xml:lang="en">\n' +        data += "<head>\n"
> +        data += "  <title>" + self.title + "</title>\n"
>          if self.css:
>              # TODO: use some sort of relative link up to the root page, so
>              # this css can be used from child pages too
> -            data += ("<link href=\"%s\""
> +            data += ("    <link href=\"%s\""
>                       " rel=\"stylesheet\""
> -                     " type=\"text/css\">\n" % "buildbot.css")
> +                     " type=\"text/css\"/>\n" % "buildbot.css")
> +        data += "</head>\n"
>          data += "<body vlink=\"#800080\">\n"
>          data += self.body(request)
>          data += "</body></html>\n"
>          return data
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://buildbot.net/pipermail/devel/attachments/20051022/4588ae22/attachment.bin>


More information about the devel mailing list