[#1725] Refactor search_data()'s sort to accept an array

We'll need this to allow extensions to add new clauses to it.
[#1725] Catch exception thrown when there's no toolkit.request

I have changed this on 3fed29c, but got the following traceback:

```
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/usr/lib/ckan/default/src/ckan/ckanext/datastore/tests/test_interface.py", line 74, in test_filters_sent_arent_modified
    filters=filters.copy())
  File "/usr/lib/ckan/default/src/ckan/ckan/new_tests/helpers.py", line 91, in call_action
    return logic.get_action(action_name)(context=context, data_dict=kwargs)
  File "/usr/lib/ckan/default/src/ckan/ckan/logic/__init__.py", line 414, in wrapped
    result = _action(context, data_dict, **kw)
  File "/usr/lib/ckan/default/src/ckan/ckan/logic/__init__.py", line 530, in wrapper
    return action(context, data_dict)
  File "/usr/lib/ckan/default/src/ckan/ckanext/datastore/logic/action.py", line 339, in datastore_search
    result = db.search(context, data_dict)
  File "/usr/lib/ckan/default/src/ckan/ckanext/datastore/db.py", line 1141, in search
    return search_data(context, data_dict)
  File "/usr/lib/ckan/default/src/ckan/ckanext/datastore/db.py", line 947, in search_data
    _insert_links(data_dict, limit, offset)
  File "/usr/lib/ckan/default/src/ckan/ckanext/datastore/db.py", line 848, in _insert_links
    urlstring = toolkit.request.environ['CKAN_CURRENT_URL']
  File "/usr/lib/ckan/default/src/ckan/ckan/lib/maintain.py", line 75, in custom__getattr__
    depricated = __old_getattr__(self, '__depricated_properties__')
  File "/usr/local/lib/python2.7/dist-packages/paste/registry.py", line 137, in __getattr__
    return getattr(self._current_obj(), attr)
  File "/usr/local/lib/python2.7/dist-packages/paste/registry.py", line 197, in _current_obj
    'thread' % self.____name__)
TypeError: No object (name: request) has been registered for this thread
```