Anonymous avatar Anonymous committed 90f0946

The usual.

Comments (0)

Files changed (5)

Lib/dos-8x3/simpleht.py

 """
 
 
-__version__ = "0.4"
+__version__ = "0.5"
 
 
 import os
             return None
         list.sort(lambda a, b: cmp(a.lower(), b.lower()))
         f = StringIO()
+        f.write("<title>Directory listing for %s</title>\n" % self.path)
         f.write("<h2>Directory listing for %s</h2>\n" % self.path)
         f.write("<hr>\n<ul>\n")
         for name in list:
             # Append / for directories or @ for symbolic links
             if os.path.isdir(fullname):
                 displayname = name + "/"
-                linkname = name + os.sep
+                linkname = name + "/"
             if os.path.islink(fullname):
                 displayname = name + "@"
                 # Note: a link to a directory displays with @ and links with /

Lib/dos-8x3/sre_pars.py

 MAXREPEAT = 65535
 
 SPECIAL_CHARS = ".\\[{()*+?^$|"
-REPEAT_CHARS  = "*+?{"
+REPEAT_CHARS = "*+?{"
 
-DIGITS = tuple("012345689")
+DIGITS = tuple("0123456789")
 
 OCTDIGITS = tuple("01234567")
 HEXDIGITS = tuple("0123456789abcdefABCDEF")
             # hexadecimal escape
             while source.next in HEXDIGITS and len(escape) < 4:
                 escape = escape + source.get()
-            escape = escape[2:]
-            if len(escape) != 2:
-                raise error, "bogus escape: %s" % repr("\\" + escape)
-            return LITERAL, int(escape, 16) & 0xff
+            if len(escape) != 4:
+                raise ValueError
+            return LITERAL, int(escape[2:], 16) & 0xff
         elif escape[1:2] == "0":
             # octal escape
-            while source.next in OCTDIGITS and len(escape) < 5:
+            while source.next in OCTDIGITS and len(escape) < 4:
                 escape = escape + source.get()
             return LITERAL, int(escape[1:], 8) & 0xff
         elif escape[1:2] in DIGITS:
             here = source.tell()
             if source.next in DIGITS:
                 escape = escape + source.get()
-                if escape[2] in OCTDIGITS and source.next in OCTDIGITS:
+                if (escape[1] in OCTDIGITS and escape[2] in OCTDIGITS and
+                    source.next in OCTDIGITS):
                     # got three octal digits; this is an octal escape
                     escape = escape + source.get()
                     return LITERAL, int(escape[1:], 8) & 0xff
             group = _group(escape, state.groups)
             if group:
                 return GROUPREF, group
-            raise error, "bogus escape: %s" % repr(escape)
+            raise ValueError
         if len(escape) == 2:
             return LITERAL, ord(escape[1])
     except ValueError:

Lib/dos-8x3/test_mma.py

     assert m[0] == '3'
     print '  Contents of first 3 bytes:', repr(m[0:3])
     assert m[0:3] == '3\0\0'
-    print '  Contents of second page:',  m[PAGESIZE-1 : PAGESIZE + 7]
+    print '  Contents of second page:',  repr(m[PAGESIZE-1 : PAGESIZE + 7])
     assert m[PAGESIZE-1 : PAGESIZE + 7] == '\0foobar\0'
     
     m.flush()
     print ' Test passed'
 
 test_both()
-

Lib/dos-8x3/test_pop.py

     print "Testing os module:"
     import popen2
     cmd  = "cat"
-    teststr = "abc\n"
-    resultstr = teststr
+    teststr = "ab cd\n"
     if os.name == "nt":
         cmd = "more"
-        resultstr = "\n" + resultstr
+    # "more" doesn't act the same way across Windows flavors,
+    # sometimes adding an extra newline at the start or the
+    # end.  So we strip whitespace off both ends for comparison.
+    expected = teststr.strip()
     print "testing popen2..."
     w, r = os.popen2(cmd)
     w.write(teststr)
     w.close()
-    assert r.read() == resultstr
+    got = r.read()
+    if got.strip() != expected:
+        raise ValueError("wrote %s read %s" % (`teststr`, `got`))
     print "testing popen3..."
     try:
         w, r, e = os.popen3([cmd])
         w, r, e = os.popen3(cmd)
     w.write(teststr)
     w.close()
-    assert r.read() == resultstr
-    assert e.read() == ""
+    got = r.read()
+    if got.strip() != expected:
+        raise ValueError("wrote %s read %s" % (`teststr`, `got`))
+    got = e.read()
+    if got:
+        raise ValueError("unexected %s on stderr" % `got`)
     for inst in popen2._active[:]:
         inst.wait()
-    assert not popen2._active
+    if popen2._active:
+        raise ValueError("_active not empty")
     print "All OK"
 
 main()

Lib/dos-8x3/webbrows.py

 
 class WindowsDefault:
     def open(self, url, new=0):
-        import win32api, win32con
-        win32api.ShellExecute(0, "open", url, None, ".",
-                              win32con.SW_SHOWNORMAL)
+        self.junk = os.popen("start " + url)
 
     def open_new(self, url):
         self.open(url)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.