1. Michael Manfre
  2. django-mssql

Issues

Issue #48 resolved

DatabaseWrapper' object has no attribute '_DatabaseWrapper__connect'

Janez Jere
created an issue

Hi,

I found that method __connect is undefined in base.py / DatabaseWrapper. This is a fatal error in my use cases.

def __get_dbms_version(self, make_connection=True):
        """
        Returns the 'DBMS Version' string, or ''. If a connection to the database has not already
        been established, a connection will be made when `make_connection` is True.
        """
        if not self.connection and make_connection:
            self.__connect() # UNDEFINED !!!
        return self.connection.adoConnProperties.get('DBMS Version', '') if self.connection else ''

Comments (3)

  1. Janez Jere reporter

    this fix works for me

    diff -r 8c5d2c9531dc sqlserver_ado/base.py
    --- a/sqlserver_ado/base.py     Thu Dec 19 17:16:07 2013 -0500
    +++ b/sqlserver_ado/base.py     Thu Dec 26 15:16:35 2013 +0100
    @@ -247,7 +247,7 @@
             been established, a connection will be made when `make_connection` is True.
             """
             if not self.connection and make_connection:
    -            self.__connect()
    +            self.get_new_connection(self.get_connection_params())
             return self.connection.adoConnProperties.get('DBMS Version', '') if self.connection else ''
    
         def is_sql2000(self, make_connection=True):
    
  2. Log in to comment