You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
Hello,
I need to create my own modified backend based on postgresql database backend, which use my wrapper for psycopg2 driver. I tried to simply subclass django.db.backends.postgresql.DatabaseWrapper
and redefine DatabaseWrapper.Database class member, but faced the fact
that inside the class the <module>.Database member is used (in
get_new_connection and is_usable methods) instead of self.Database.
I think, this is bug, isn't it? I simply copy-pasted those two methods into my subclass and added self. , however, I think, this should be fixed in the library:
Here is my db.backends.my_postgresql.base file content: #################################################### from django.db.backends.postgresql_psycopg2.base import * from db.drivers import my_psycopg2
class DatabaseWrapper(DatabaseWrapper): Database = my_psycopg2
def get_new_connection(self, conn_params): connection = self.Database.connect(**conn_params) # here I added 'self.' ...
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
Looks reasonable to me -- want to submit a pull request? Maybe "self." was lost in a refactoring. If you can find where that happened, it's always helpful.