Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > generating a tree-like structure

Reply
Thread Tools

generating a tree-like structure

 
 
Thorsten Kampe
Guest
Posts: n/a
 
      05-31-2007
Hi,

This is a fairly general question: is there some kind of module or
framework that allows building a tree like structure from certain kind
of data?

To be specific: I have a program that dumps the content of a LDAP
directory including all properties and values and groups the result
from the LDAP search by objClass.

Now I was thinking: would it be possible to generate from the totally
unordered output that the LDAP server gives me, a tree like
representation that displays the hierarchy (omitting the values or
even properties if necessary)?

It should be a textual representation of what you see in GUI programs
like "LDAP Administrator" but the output should be represented like
the "tree" program in Linux or Windows "tree.com".

Any ideas appreciated...


Thorsten
 
Reply With Quote
 
 
 
 
kyosohma@gmail.com
Guest
Posts: n/a
 
      05-31-2007
On May 31, 12:44 pm, Thorsten Kampe <(E-Mail Removed)> wrote:
> Hi,
>
> This is a fairly general question: is there some kind of module or
> framework that allows building a tree like structure from certain kind
> of data?
>
> To be specific: I have a program that dumps the content of a LDAP
> directory including all properties and values and groups the result
> from the LDAP search by objClass.
>
> Now I was thinking: would it be possible to generate from the totally
> unordered output that the LDAP server gives me, a tree like
> representation that displays the hierarchy (omitting the values or
> even properties if necessary)?
>
> It should be a textual representation of what you see in GUI programs
> like "LDAP Administrator" but the output should be represented like
> the "tree" program in Linux or Windows "tree.com".
>
> Any ideas appreciated...
>
> Thorsten


I think you might be able to use ElementTree. The website for the
module claims it can be used for hierarchical data structures:
http://effbot.org/zone/element-index.htm

Did you look at any of the Python LDAP tools? They might be useful
too. See some of the links below:
http://linuxjournal.com/article/6988
http://aspn.activestate.com/ASPN/Coo.../Recipe/303336

Hopefully they'll give some guidance. I've not used LDAP myself as of
yet.

Mike

 
Reply With Quote
 
 
 
 
Thorsten Kampe
Guest
Posts: n/a
 
      05-31-2007
* (31 May 2007 12:15:48 -0700)
> On May 31, 12:44 pm, Thorsten Kampe <(E-Mail Removed)> wrote:
> > This is a fairly general question: is there some kind of module or
> > framework that allows building a tree like structure from certain kind
> > of data?
> >
> > To be specific: I have a program that dumps the content of a LDAP
> > directory including all properties and values and groups the result
> > from the LDAP search by objClass.
> >
> > Now I was thinking: would it be possible to generate from the totally
> > unordered output that the LDAP server gives me, a tree like
> > representation that displays the hierarchy (omitting the values or
> > even properties if necessary)?
> >
> > It should be a textual representation of what you see in GUI programs
> > like "LDAP Administrator" but the output should be represented like
> > the "tree" program in Linux or Windows "tree.com".

>
> I think you might be able to use ElementTree. The website for the
> module claims it can be used for hierarchical data structures:
> http://effbot.org/zone/element-index.htm
>
> Did you look at any of the Python LDAP tools? They might be useful
> too. See some of the links below:
> http://linuxjournal.com/article/6988
> http://aspn.activestate.com/ASPN/Coo.../Recipe/303336
>
> Hopefully they'll give some guidance. I've not used LDAP myself as of
> yet.


I already have the LDAP output part working - with python-ldap under
Cygwin - and I generate HMTL output with markup.py. Pretty simple. But
a tree structure output would be even prettier...
 
Reply With Quote
 
A.T.Hofkamp
Guest
Posts: n/a
 
      06-01-2007
On 2007-05-31, Thorsten Kampe <(E-Mail Removed)> wrote:
> * (31 May 2007 12:15:48 -0700)
>> On May 31, 12:44 pm, Thorsten Kampe <(E-Mail Removed)> wrote:
>> > This is a fairly general question: is there some kind of module or
>> > framework that allows building a tree like structure from certain kind
>> > of data?
>> >
>> > To be specific: I have a program that dumps the content of a LDAP
>> > directory including all properties and values and groups the result
>> > from the LDAP search by objClass.
>> >
>> > Now I was thinking: would it be possible to generate from the totally
>> > unordered output that the LDAP server gives me, a tree like
>> > representation that displays the hierarchy (omitting the values or
>> > even properties if necessary)?
>> >
>> > It should be a textual representation of what you see in GUI programs
>> > like "LDAP Administrator" but the output should be represented like
>> > the "tree" program in Linux or Windows "tree.com".

>>
>> I think you might be able to use ElementTree. The website for the
>> module claims it can be used for hierarchical data structures:
>> http://effbot.org/zone/element-index.htm
>>
>> Did you look at any of the Python LDAP tools? They might be useful
>> too. See some of the links below:
>> http://linuxjournal.com/article/6988
>> http://aspn.activestate.com/ASPN/Coo.../Recipe/303336
>>
>> Hopefully they'll give some guidance. I've not used LDAP myself as of
>> yet.

>
> I already have the LDAP output part working - with python-ldap under
> Cygwin - and I generate HMTL output with markup.py. Pretty simple. But
> a tree structure output would be even prettier...


I would probably generate a DOT file to get a 2D visualization. DOT is part of
Graphviz (graphviz.org), and there are quite a few graphviz front-ends
available in Python to make DOT generation easier (pydot, yapgvb, and probably
a few others).

Albert
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between c structure and c++ structure raghunandan_1081@yahoo.com C++ 9 11-11-2011 07:34 AM
Suggestions for structure of HTML-generating app lanwrangler@gmail.com Python 4 02-07-2008 10:08 AM
Memory allocation in Structure to Structure pra_ramli@rediffmail.com C++ 2 03-09-2006 05:51 AM
Copy String structure "A" to string structure "B" Leo Nunez C Programming 3 02-09-2005 05:14 AM
Pointers to structure and array of structure. Excluded_Middle C Programming 4 10-26-2004 05:39 AM



Advertisments