Changeset - c447e51fad04
[Not reviewed]
default
0 1 0
Dennis Fink - 10 years ago 2015-07-08 22:23:12

use key a name instead of el in first function
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
spaceapi/utils.py
Show inline comments
 
from flask import request
 

	
 

	
 
def request_wants_json():
 
    best = request.accept_mimetypes.best_match(
 
        ['application/json', 'text/html']
 
    )
 
    return best == 'application/json' and \
 
        request.accept_mimetypes[best] > \
 
        request.accept_mimetypes['text/html']
 

	
 

	
 
def fuzzy_list_find(lst, key, value):
 

	
 
    for i, dic in enumerate(lst):
 
        if dic[key] == value:
 
            return i
 

	
 
    raise ValueError
 

	
 

	
 
def first(iterable, keys):
 
    for el in keys:
 
        if el in iterable:
 
            return el
 
    for key in keys:
 
        if key in iterable:
 
            return key
 

	
 
    raise ValueError
0 comments (0 inline, 0 general)