/[qa]/trunk/pts/www/bin/excuses_to_xml.py
ViewVC logotype

Diff of /trunk/pts/www/bin/excuses_to_xml.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 450 by hertzog, Wed Dec 25 15:56:32 2002 UTC revision 1154 by jeroen, Sun Nov 20 14:55:09 2005 UTC
# Line 1  Line 1 
1  #!/usr/bin/python2.2  #!/usr/bin/python
2    # -*- coding: utf8 -*-
3    
4  # Make sure tabs expand to 8 spaces in vim  # Make sure tabs expand to 8 spaces in vim
5  # vim: expandtab  # vim: expandtab
6    
7  # Copyright 2002 Raphaël Hertzog  # Copyright 2002 Raphaël Hertzog
8  # This file is distributed under the terms of the General Public License  # This file is distributed under the terms of the General Public License
9  # version 2 or (at your option) any later version.  # version 2 or (at your option) any later version.
10    
# Line 20  def striphtml(input): Line 21  def striphtml(input):
21      cleared = cleared.replace("<=", "&lt;=");      cleared = cleared.replace("<=", "&lt;=");
22      cleared = cleared.replace(">>", "&gt;&gt;");      cleared = cleared.replace(">>", "&gt;&gt;");
23      cleared = cleared.replace("<<", "&lt;&lt;");      cleared = cleared.replace("<<", "&lt;&lt;");
24        # Remove the tags
25      while cleared.find("<") != -1 and cleared.find(">") != -1:      while cleared.find("<") != -1 and cleared.find(">") != -1:
26          cleared = cleared[:cleared.find("<")] + cleared[cleared.find(">")+1:]          cleared = cleared[:cleared.find("<")] + cleared[cleared.find(">")+1:]
27        # But I really want the output in plain text
28        cleared = cleared.replace("&gt;=", ">=");
29        cleared = cleared.replace("&lt;=", "<=");
30        cleared = cleared.replace("&gt;&gt;", ">>");
31        cleared = cleared.replace("&lt;&lt;", "<<");
32      return cleared      return cleared
33    
34  # Load the list of excuses generated last time  # Load the list of excuses generated last time
# Line 71  while 1: Line 78  while 1:
78              if not subline: continue              if not subline: continue
79              subline = subline.strip()              subline = subline.strip()
80              if subline.find("Maintainer:") != -1: continue              if subline.find("Maintainer:") != -1: continue
81              elif subline.find("Too young,") != -1:              elif subline.find("Too young, only") != -1:
82                  words = subline.split()                  words = subline.split()
83                  main_elt.setAttribute("age", words[3])                  main_elt.setAttribute("age", words[3])
84                  main_elt.setAttribute("limit", words[5])                  main_elt.setAttribute("limit", words[5])
# Line 85  while 1: Line 92  while 1:
92                  words = subline.split()                  words = subline.split()
93                  main_elt.setAttribute("age", words[0])                  main_elt.setAttribute("age", words[0])
94                  main_elt.setAttribute("limit", words[4])                  main_elt.setAttribute("limit", words[4])
95                  main_elt.setAttribute("problematic", "yes")                  # Being at the last day isn't yet problematic
96                    if words[0] != words[4]:
97                        main_elt.setAttribute("problematic", "yes")
98                  subline = striphtml(subline)                  subline = striphtml(subline)
99                  sub_elt = doc.createElement("item")                  sub_elt = doc.createElement("item")
100                  sub_elt.appendChild(doc.createTextNode(subline))                  sub_elt.appendChild(doc.createTextNode(subline))
# Line 95  while 1: Line 104  while 1:
104                  start = subline.find('href="http://')                  start = subline.find('href="http://')
105                  if start != -1:                  if start != -1:
106                      url = subline[start+6:subline.find('"',start+6)]                      url = subline[start+6:subline.find('"',start+6)]
107                        # Manage broken links provided by the testing scripts
108                        url = string.replace(url, "+", "%2B")
109                      sub_elt.setAttribute("url", url)                      sub_elt.setAttribute("url", url)
110                  start = subline.find('href="#')                  start = subline.find('href="#')
111                  if start != -1:                  if start != -1:

Legend:
Removed from v.450  
changed lines
  Added in v.1154

  ViewVC Help
Powered by ViewVC 1.1.5