Skip to content

Commit

Permalink
[xs][middleware] Bug fix: check that lang list is not empty (old cook…
Browse files Browse the repository at this point in the history
…ie setup will give a server 500 error)
  • Loading branch information
johnglover committed Feb 29, 2012
1 parent b0b7822 commit 8919213
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ckan/config/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ def get_cookie_lang(self, environ):
if cookie:
cookies = [c.strip() for c in cookie.split(';')]
lang = [c.split('=')[1] for c in cookies \
if c.startswith('ckan_lang')][0]
if lang in self.local_list:
return lang
if c.startswith('ckan_lang')]
if lang and lang[0] in self.local_list:
return lang[0]
return None

def __call__(self, environ, start_response):
Expand Down

0 comments on commit 8919213

Please sign in to comment.