[wwwsearch-commits] r27546 - in wwwsearch/mechanize/trunk: . mechanize

jjlee at codespeak.net jjlee at codespeak.net
Sun May 21 20:52:42 CEST 2006


Author: jjlee
Date: Sun May 21 20:52:39 2006
New Revision: 27546

Removed:
   wwwsearch/mechanize/trunk/mechanize/_Debug.py
Modified:
   wwwsearch/mechanize/trunk/doc.html.in
   wwwsearch/mechanize/trunk/mechanize/_ClientCookie.py
   wwwsearch/mechanize/trunk/mechanize/_LWPCookieJar.py
   wwwsearch/mechanize/trunk/mechanize/_MSIECookieJar.py
   wwwsearch/mechanize/trunk/mechanize/_MozillaCookieJar.py
Log:
Get rid of module _Debug

Modified: wwwsearch/mechanize/trunk/doc.html.in
==============================================================================
--- wwwsearch/mechanize/trunk/doc.html.in	(original)
+++ wwwsearch/mechanize/trunk/doc.html.in	Sun May 21 20:52:39 2006
@@ -611,9 +611,6 @@
 logger.setLevel(logging.DEBUG)
 """)}
 
-<p>(In Python 2.3 or newer, <code>logging.getLogger</code>,
-<code>logging.DEBUG</code>, <code>logging.INFO</code> etc. work just as well.)
-
 <p>The <code>DEBUG</code> level (as opposed to the <code>INFO</code> level) can
 actually be quite useful, as it explains why particular cookies are accepted or
 rejected and why they are or are not returned.

Modified: wwwsearch/mechanize/trunk/mechanize/_ClientCookie.py
==============================================================================
--- wwwsearch/mechanize/trunk/mechanize/_ClientCookie.py	(original)
+++ wwwsearch/mechanize/trunk/mechanize/_ClientCookie.py	Sun May 21 20:52:39 2006
@@ -32,7 +32,7 @@
 
 """
 
-import sys, re, urlparse, string, copy, time, struct, urllib, types
+import sys, re, urlparse, string, copy, time, struct, urllib, types, logging
 try:
     import threading
     _threading = threading; del threading
@@ -47,14 +47,15 @@
 
 from _HeadersUtil import split_header_words, parse_ns_headers
 from _Util import startswith, endswith, isstringlike, getheaders
-from _Debug import warn, getLogger
-debug = getLogger("mechanize.cookies").debug
+
+debug = logging.getLogger("mechanize.cookies").debug
 
 
 def reraise_unmasked_exceptions(unmasked=()):
     # There are a few catch-all except: statements in this module, for
     # catching input that's bad in unexpected ways.
     # This function re-raises some exceptions we don't want to trap.
+    import mechanize, warnings
     if not mechanize.USE_BARE_EXCEPT:
         raise
     unmasked = unmasked + (KeyboardInterrupt, SystemExit, MemoryError)
@@ -66,7 +67,7 @@
     f = StringIO.StringIO()
     traceback.print_exc(None, f)
     msg = f.getvalue()
-    warn("mechanize bug!\n%s" % msg)
+    warnings.warn("mechanize bug!\n%s" % msg, stacklevel=2)
 
 
 IPV4_RE = re.compile(r"\.\d+$")

Deleted: /wwwsearch/mechanize/trunk/mechanize/_Debug.py
==============================================================================
--- /wwwsearch/mechanize/trunk/mechanize/_Debug.py	Sun May 21 20:52:39 2006
+++ (empty file)
@@ -1,7 +0,0 @@
-import sys
-
-def warn(text):
-    warnings.warn(text, stacklevel=2)
-
-import logging
-from logging import getLogger, StreamHandler, INFO, DEBUG, NOTSET

Modified: wwwsearch/mechanize/trunk/mechanize/_LWPCookieJar.py
==============================================================================
--- wwwsearch/mechanize/trunk/mechanize/_LWPCookieJar.py	(original)
+++ wwwsearch/mechanize/trunk/mechanize/_LWPCookieJar.py	Sun May 21 20:52:39 2006
@@ -18,13 +18,14 @@
 
 """
 
-import time, re, string
+import time, re, string, logging
+
 from _ClientCookie import reraise_unmasked_exceptions, FileCookieJar, Cookie, \
      MISSING_FILENAME_TEXT, LoadError
 from _HeadersUtil import join_header_words, split_header_words
 from _Util import startswith, iso2time, time2isoz
-from _Debug import getLogger
-debug = getLogger("mechanize").debug
+
+debug = logging.getLogger("mechanize").debug
 
 
 def lwp_cookie_str(cookie):

Modified: wwwsearch/mechanize/trunk/mechanize/_MSIECookieJar.py
==============================================================================
--- wwwsearch/mechanize/trunk/mechanize/_MSIECookieJar.py	(original)
+++ wwwsearch/mechanize/trunk/mechanize/_MSIECookieJar.py	Sun May 21 20:52:39 2006
@@ -11,20 +11,15 @@
 
 # XXX names and comments are not great here
 
-import os, re, string, time, struct
+import os, re, string, time, struct, logging
 if os.name == "nt":
     import _winreg
 
 from _ClientCookie import FileCookieJar, CookieJar, Cookie, \
      MISSING_FILENAME_TEXT, LoadError
 from _Util import startswith
-from _Debug import getLogger
-debug = getLogger("mechanize").debug
 
-try: True
-except NameError:
-    True = 1
-    False = 0
+debug = logging.getLogger("mechanize").debug
 
 
 def regload(path, leaf):

Modified: wwwsearch/mechanize/trunk/mechanize/_MozillaCookieJar.py
==============================================================================
--- wwwsearch/mechanize/trunk/mechanize/_MozillaCookieJar.py	(original)
+++ wwwsearch/mechanize/trunk/mechanize/_MozillaCookieJar.py	Sun May 21 20:52:39 2006
@@ -9,13 +9,12 @@
 
 """
 
-import re, string, time
+import re, string, time, logging
 
 from _ClientCookie import reraise_unmasked_exceptions, FileCookieJar, Cookie, \
      MISSING_FILENAME_TEXT, LoadError
 from _Util import startswith, endswith
-from _Debug import getLogger
-debug = getLogger("ClientCookie").debug
+debug = logging.getLogger("ClientCookie").debug
 
 
 class MozillaCookieJar(FileCookieJar):


More information about the wwwsearch-commits mailing list