Hmm another regression was preventing match_regexps from working. Fixed in svn. Note that in your case match regexps should be
match_regexps = ['http://online.barrons.com/.*?html\?mod=.*?|file://.*']
As for the cleanup hanging it seems to be following a long redirect chain
Use the following code to see the HTTP responses being sent by the server
Code:
def cleanup(self):
try:
self.browser.set_debug_responses(True)
import sys, logging
logger = logging.getLogger("mechanize")
logger.addHandler(logging.StreamHandler(sys.stdout))
logger.setLevel(logging.INFO)
res = self.browser.open('http://online.barrons.com/logout')
except:
import traceback
traceback.print_exc()
You may find the documentation at
http://wwwsearch.sourceforge.net/mechanize/ useful for understanding how the browser object works.