115 |
return ("postgis://%(user)s@%(host)s:%(port)s/%(dbname)s" |
return ("postgis://%(user)s@%(host)s:%(port)s/%(dbname)s" |
116 |
% self.__dict__) |
% self.__dict__) |
117 |
|
|
118 |
|
def MatchesParameters(self, parameters): |
119 |
|
"""Return whether the connection matches the dictionary of parameters |
120 |
|
|
121 |
|
Return whether instatiating the connection with the given |
122 |
|
parameters would establish essentially the same connection as |
123 |
|
self. The connection is essentially the same if the same |
124 |
|
database (identified by host, port and databasename) is accessed |
125 |
|
as the same user. |
126 |
|
""" |
127 |
|
return (parameters["host"] == self.host |
128 |
|
and parameters["port"] == self.port |
129 |
|
and parameters["dbname"] == self.dbname |
130 |
|
and parameters["user"] == self.user) |
131 |
|
|
132 |
def Close(self): |
def Close(self): |
133 |
"""Close the database connection""" |
"""Close the database connection""" |
134 |
self.connection.close() |
self.connection.close() |