bernardopires/django-tenant-schemas — pull request #121 by juanqui (2014-02-28 03:15:38+00:00)
Title: Fix connection.set_tenant(None) and deprecation warnings

This pull requests fixes an issue that occurs when utils.tenant_context(...) is used when the current tenant is public (i.e. None). For example, the following used to fail:
```python
from tenant_schemas.utils import tenant_context

tenant = Tenant.objects.get(schema_name='someothertenant')
with tenant_context(tenant):
pass
```
To fix this I added an 'if' condition to the connection.set_tenant(...) method to handle the case where the tenant may be None.

I also fixed the deprecated warnings being generated by utils.schema_context(...) and utils.tenant_context(...) since it was using the now deprecated connection.get_tenant()