~ubuntu-branches/ubuntu/saucy/prewikka/saucy-proposed

« back to all changes in this revision

Viewing changes to prewikka/utils.py

  • Committer: Bazaar Package Importer
  • Author(s): Pierre Chifflier
  • Date: 2009-06-14 10:00:20 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20090614100020-479f60e0m8ae7hq0
Tags: 0.9.15-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
def _load_protocol():
34
34
    global port_dict
35
35
    global read_done
36
 
    
 
36
 
37
37
    if read_done:
38
38
        return port_dict
39
39
 
43
43
    try: fd = open("/etc/protocols", "r")
44
44
    except IOError:
45
45
        return port_dict
46
 
        
 
46
 
47
47
    for line in fd.readlines():
48
 
        
 
48
 
49
49
        ret = sreg.match(line)
50
50
        if not ret:
51
51
            continue
64
64
 
65
65
     return None
66
66
 
67
 
def escape_attribute(value):   
 
67
def escape_attribute(value):
68
68
    # Escape '\' since it's a valid js escape.
69
69
    return value.replace("\\", "\\\\").replace("\"", "\\\"").replace("/", "\\/")
70
70
 
139
139
 
140
140
        content += "   " * (16 - len(chunk))
141
141
        content += "    "
142
 
        
 
142
 
143
143
        for b in chunk:
144
144
            if b >= 32 and b < 127:
145
145
                content += chr(b)