def s3_populate_browser_compatibility(request):
 features = Storage()
 try:
  from pywurfl.algorithms import TwoStepAnalysis
 except ImportError:
  current.log.warning('pywurfl python module has not been installed, browser compatibility listing will not be populated. Download pywurfl from http://pypi.python.org/pypi/pywurfl/')
  return False
 import wurfl
 device = wurfl.devices.select_ua(unicode(request.env.http_user_agent), search=TwoStepAnalysis(wurfl.devices))
 browser = Storage()
 for feature in device:
  if ((feature[0] in features) and (feature[1] in features[feature[0]])):
   browser[feature[0]][feature[1]] = feature[2]
 return browser

def s3_populate_browser_compatibility ( request ) : features = Storage ( ) try : from pywurfl . algorithms import TwoStepAnalysis except ImportError : current . log . warning ( 'pywurfl python module has not been installed, browser compatibility listing will not be populated. Download pywurfl from http://pypi.python.org/pypi/pywurfl/' ) return False import wurfl device = wurfl . devices . select_ua ( unicode ( request . env . http_user_agent ) , search = TwoStepAnalysis ( wurfl . devices ) ) browser = Storage ( ) for feature in device : if ( ( feature [ 0 ] in features ) and ( feature [ 1 ] in features [ feature [ 0 ] ] ) ) : browser [ feature [ 0 ] ] [ feature [ 1 ] ] = feature [ 2 ] return browser
use wurfl for browser compatibility detection @todo: define a list of features to store .