On Wed, Aug 19, 2009 at 5:44 AM, gthank<[email protected]> wrote:
>
> The accepted solution for Ticket 6064 does not seem to address the
> original problem—initializing a *specific* connection—because it uses
> the the class instead of the instance as the sender of the signal. I
> attempted to reopen the ticket but it was closed and I was told to
> take it up on the users mailing list. That didn't seem like the right
> place, but I did anyway and got no response. Perhaps this is the right
> place. I'm attaching a change that uses the ``connection``, instead of
> the ``__class__``, as the sender of the signal. If there is something
> wrong with the changes, I'd be more than happy to revise it, but I'd
> like to have this functionality in Django proper, since it makes my
> particular use case much easier.
>
> My Use Case
> ==========
>
> A multitenant application where each tenant has a completely isolated
> set of data. To avoid having to add some sort of tenant foreign key on
> every table and filter on it on every request, I'm using a different
> Postgres schema for each tenant. Therefore, I need to initialize the
> connections I create with a different search_path depending on which
> user made the request.

Currentlty there's no need to pass the connection into the signal
since, as the person who re-closed the ticket pointed out in a code
snippet, it's possible to obtain the connection using an import.

Besides which, the purpose of using the class as the sender is to be
able to subscribe to only certain types of connections [1].  Using the
connection instead would defeat that.  That doesn't mean we can't pass
the connection as an additional keyword argument, and with multi-db
around the corner there may be a use case for doing that.  If so, it
should certainly be a new ticket.

Regards,
Ian

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to