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()
|
self.session.cookies.clear()
|
||||||
|
|
||||||
def load_state(self, state):
|
def load_state(self, state):
|
||||||
super(PagesBrowser, self).load_state(state)
|
super(LoginBrowser, self).load_state(state)
|
||||||
|
|
||||||
if 'url' in state:
|
if 'url' in state:
|
||||||
try:
|
try:
|
||||||
self.location(state['url'])
|
self.location(state['url'])
|
||||||
|
|
@ -770,11 +771,11 @@ class LoginBrowser(PagesBrowser):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def dump_state(self):
|
def dump_state(self):
|
||||||
if not self.page.logged:
|
if not self.page or not self.page.logged:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
state = super(LoginBrowser, self).dump_state()
|
state = super(LoginBrowser, self).dump_state()
|
||||||
if self.page:
|
state['url'] = self.page.url
|
||||||
state['url'] = self.page.url
|
|
||||||
return state
|
return state
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue