Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #68 from canarybake/hotfix-connection-proxy

Added ``DefaultConnectionProxy``, so that the ``NodeModelTestCase`` works
  • Loading branch information...
commit d474166d750aa91781b66d4c98c6a088ad7eff46 2 parents e34a88d + 02af895
Matt Luongo mhluongo authored
Showing with 12 additions and 1 deletion.
  1. +12 −1 neo4django/db/__init__.py
13 neo4django/db/__init__.py
View
@@ -38,4 +38,15 @@ def _request(self, method, url, data={}, headers={}):
connections = ConnectionHandler(_settings.NEO4J_DATABASES)
#TODO: think about emulating django's db routing
-connection = connections[DEFAULT_DB_ALIAS]
+class DefaultConnectionProxy(object):
+ """
+ Proxy for accessing the default DatabaseWrapper object's attributes. If you
+ need to access the DatabaseWrapper object itself, use
+ connections[DEFAULT_DB_ALIAS] instead.
+ """
+ def __getattr__(self, item):
+ return getattr(connections[DEFAULT_DB_ALIAS], item)
+
+ def __setattr__(self, name, value):
+ return setattr(connections[DEFAULT_DB_ALIAS], name, value)
+connection = DefaultConnectionProxy()
Please sign in to comment.
Something went wrong with that request. Please try again.