Do no presume there is at least one host

* larpe/session.py:
   list can be empty, do not subscript wihtout knowing it's not empty.

git-svn-id: svn+ssh://labs.libre-entreprise.org/svnroot/larpe@472 3ed937ae-f919-0410-9a43-8e6f19e4ba6e
This commit is contained in:
bdauvergne 2009-04-27 13:02:38 +00:00
parent e69a4ca86b
commit 298ab6e5aa
1 changed files with 3 additions and 1 deletions

View File

@ -28,7 +28,9 @@ class BasicSession(Session):
user_id = None
host = Host.get_host_from_url()
if not host:
host = Host.select(lambda x: x.name == 'larpe')[0]
host_list = Host.select(lambda x: x.name == 'larpe')
if host_list:
host = host_list[0]
if host:
user_id = self.users.get(host.provider_id)
if not user_id: