[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-ldap-dev
Subject:    Re: Parsing a .schema file
From:       Michael_Ströder <michael () stroeder ! com>
Date:       2007-05-02 21:46:53
Message-ID: 463906CD.5040701 () stroeder ! com
[Download RAW message or body]

Aurynn Shaw wrote:
> 
> I'm trying to parse a foo.schema file, which appears to be in the
> 
> attributetype ( 1.3.6.1.4.1.11940.1
> 	NAME 'startDate'
> 	DESC 'Flash Code user subscription start date'
> 	EQUALITY caseIgnoreMatch
> 	SUBSTR caseIgnoreSubstringsMatch
> 	SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
> 
> style format, instead of LDIF.
> 
> ldap.schema seems to indicate that it can parse LDAP schemas. Is that  
> in this format, or does it require a connection to the LDAP server?

Mind the line-wrapping:

Python 2.5.1 (r251:54863, Apr 19 2007, 12:23:24)
[GCC 4.1.2 20061115 (prerelease) (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a="""attributetype ( 1.3.6.1.4.1.11940.1
... NAME 'startDate'
... DESC 'Flash Code user subscription start date'
... EQUALITY caseIgnoreMatch
... SUBSTR caseIgnoreSubstringsMatch
... SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
... """
>>> import ldap.schema
>>> at=ldap.schema.AttributeType(a[len('attributetype
'):].replace('\n',' '))
>>> at
<ldap.schema.models.AttributeType instance at 0xb779ee6c>
>>> dir(at)
['__doc__', '__init__', '__module__', '__str__', '_set_attrs',
'collective', 'desc', 'equality', 'get_id', 'key_attr', 'key_list',
'names', 'no_user_mod', 'obsolete', 'oid', 'ordering',
'schema_attribute', 'set_id', 'single_value', 'substr', 'sup', 'syntax',
'syntax_len', 'token_defaults', 'usage']

Same for other schema elements.

Ciao, Michael.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Python-LDAP-dev mailing list
Python-LDAP-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/python-ldap-dev
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic