Thursday, March 15, 2012

show ldap attributes in django

Hi,

I started to learn Django recently, read the tutorial and Django Book etc.
My Goal is to make the functionality of a few system cli scripts for
ldap and mail available in the web.

I started with a simple existing ldap script that displays attributes of
an object.
Now I tried to integrate this in a view.

def myattrs(request, myobject):
object_id = myobject
con(s_as="cn=human,ou=foo",s_with="password")
dn,entry = suche(sfilter="(&(mail=foo*)(objectclass=inetorgperson))")
text = "Mail is %s" % entry['mail'][0]
return render_to_response('myobject/details.html',{'text' : entry})

And a template:

{{ text }}

Which gives a dictionary with values of lists where most of the list
have only one value. I can access single of them by {{ text.mail }} or
{{ text.mail }}.

My goal is to show whatever attribute there is with its values.
Can you point me in the right directions to achieve this?


Marc

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate