Skip to content

Instantly share code, notes, and snippets.

@felipe-prenholato
Created April 12, 2011 12:46
Show Gist options
  • Save felipe-prenholato/915438 to your computer and use it in GitHub Desktop.
Save felipe-prenholato/915438 to your computer and use it in GitHub Desktop.
# coding: utf-8
from ldapdb.router import is_ldap_model, Router as _Router
class Router(object):
def db_for_read(self, model, **hints):
if is_ldap_model(model):
return 'ldap_gold'
return None
def db_for_write(self, model, **hints):
if is_ldap_model(model):
return 'ldap_gold'
return None
DATABASES = {
'default': {
'ENGINE': 'mysql',
'NAME': 'sisweb',
'USER': 'pdgsisweb',
'PASSWORD': 'pdgsisweb#2010',
'HOST': '',
'PORT': '',
},
'ldap_pdgr': {
'ENGINE': 'ldapdb.backends.ldap',
'NAME': "ldap://server1.pdgr.corp",
'USER': "[email protected]",
'PASSWORD': "passwd",
},
'ldap_gold': {
'ENGINE': 'ldapdb.backends.ldap',
'NAME': "ldap://sever2.goldfarb.corp",
'USER': "[email protected]",
'PASSWORD': "passwd",
},
'ldap_chl': {
'ENGINE': 'ldapdb.backends.ldap',
'NAME': "ldap://server3.chl.corp",
'USER': "[email protected]",
'PASSWORD': "passwd",
},
}
DATABASE_ROUTERS = ['ldap_connector.Router']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment