fix crash if dump_state() occurs without a current page
This commit is contained in:
parent
4fa00ad235
commit
7891ce6118
1 changed files with 5 additions and 4 deletions
|
|
@ -762,7 +762,8 @@ class LoginBrowser(PagesBrowser):
|
|||
self.session.cookies.clear()
|
||||
|
||||
def load_state(self, state):
|
||||
super(PagesBrowser, self).load_state(state)
|
||||
super(LoginBrowser, self).load_state(state)
|
||||
|
||||
if 'url' in state:
|
||||
try:
|
||||
self.location(state['url'])
|
||||
|
|
@ -770,11 +771,11 @@ class LoginBrowser(PagesBrowser):
|
|||
pass
|
||||
|
||||
def dump_state(self):
|
||||
if not self.page.logged:
|
||||
if not self.page or not self.page.logged:
|
||||
return {}
|
||||
|
||||
state = super(LoginBrowser, self).dump_state()
|
||||
if self.page:
|
||||
state['url'] = self.page.url
|
||||
state['url'] = self.page.url
|
||||
return state
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue