Oliver Liebel oliver at
Wed Aug 13 15:10:08 GMT 2008

Michael Ströder schrieb:
> Andrew Bartlett wrote:
>> On Tue, 2008-08-12 at 15:31 +0200, Oliver Liebel wrote:
>>> i didnt make use of the split-function yet, i will try that later.
>> OK.  Perhaps look at some of the other uses of arrays in python to
>> figure out the best use.
> Well, it's the .split() method you can use for any string. Note that 
> this parsing could be made robust by handling double-spaces (filtering 
> out empty values).
> Python 2.5.2 (r252:60911, Jun  6 2008, 23:32:27)
> [GCC 4.3.1 20080507 (prerelease) [gcc-4_3-branch revision 135036]] on 
> linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> s='ldap://host1  ldapi:/// ldaps://host2'
> >>> s.split(' ')
> ['ldap://host1', '', 'ldapi:///', 'ldaps://host2']
> >>> filter(None,s.split(' '))
> ['ldap://host1', 'ldapi:///', 'ldaps://host2']
> >>>
> The use of filter(None,l) strips out the null-values from the list l.
thanks for this tip, i will keep it in mind for a later stage.
>> For example, replace ${CONFIGDN} with ${MMRDN} and rid=3 with rid=
>> ${RID1} and rid=${RID2}
> I really wonder why this templating syntax is used instead of simply 
> relying what Python provides. One could read in a template file and 
> treat it like a Python string with dict-key formatters.
> Python 2.5.2 (r252:60911, Jun  6 2008, 23:32:27)
> [GCC 4.3.1 20080507 (prerelease) [gcc-4_3-branch revision 135036]] on 
> linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> d={'key1':'value1','key2':'value2'}
> >>> 'Display 1. value "%(key1)s" and 2. value here "%(key2)s"' % (d)
> 'Display 1. value "value1" and 2. value here "value2"'
> I make heavy use of it in web2ldap also for displaying template-based 
> forms with input fields implemented by different Python plugin classes.
as mentioned earlier in this thread, im not so experienced with python 
at the moment,
but i think i got a good starting point, as im familiar enough with 
other scripting languages.

the primary goal for this task is to extend the functionallity of the 
backend-provisioning script
with samba4/openldap-mmr capabilities,
and though its maybe not the optimal way of python-scripting right now,
the base-setup is working stable since yesterday.

there are still many open sub-tasks, so at  this stage of development 
its for me not about
how elegantly it may could be done,
just primarily get it done first.

you are free to optimize the python part, when the wanted
level of functionality is reached.

> Ciao, Michael.

Virus checked by G DATA AntiVirusKit
Version: AVK 18.4953 from 13.08.2008
Virus news:

More information about the samba-technical mailing list