def createFromTemplate(host,admin,passwd,tmp_filename,tagdict): ldif_test = open(tmp_filename) buf = ldif_test.read() for tag in tagdict.keys(): buf = buf.replace(tag,tagdict[tag]) f=StringIO.StringIO(buf) imp = LDIFImporter(f) imp.parse() l = LDAPUtil(host) l.bind(admin,passwd) for dn,attribs in imp.imp_data: print dn,attribs l.l.add_s(dn,attribs)
def __init__(self): global conf LDAPUtil.__init__(self,conf.get('LDAPSERVER','host'))