1def _init_browser(self):
2 """
3 Ovveride this method with the appropriate way to prepare a logged in
4 browser.
5 """
6 self.browser = mechanize.Browser()
7 self.browser.set_handle_robots(False)
8 self.browser.open(self.server_url + "/youraccount/login")
9 self.browser.select_form(nr=0)
10 try:
11 self.browser['nickname'] = self.user
12 self.browser['password'] = self.password
13 except:
14 self.browser['p_un'] = self.user
15 self.browser['p_pw'] = self.password
16 # Set login_method to be writable
17 self.browser.form.find_control('login_method').readonly = False
18 self.browser['login_method'] = self.login_method
19 self.browser.submit()