- args = isinstance(params, list) and params or None
- kwargs = isinstance(params, dict) and params or None
+ args = kwargs = None
+ if isinstance(params, list):
+ args = params
+ elif isinstance(params, dict):
+ # Convert unicode keys to strings for Python < 2.6.5. Compare
+ # http://stackoverflow.com/questions/4598604/how-to-pass-unicode-keywords-to-kwargs
+ kwargs = dict([(smart_str(k, 'ascii'), v) for k, v in params.items()])