Tryag File Manager
Home
-
Turbo Force
Current Path :
/
usr
/
lib
/
python2.4
/
site-packages
/
Upload File :
New :
File
Dir
//usr/lib/python2.4/site-packages/dsml.pyc
mò Âká@c�����������@���s·���d��Z��d�Z�d�k�Z�d�k�Z�d�„��Z�d�d�d�d�f�Z�d�„��Z�d �f��d�„��ƒ��YZ�y�d�k�Z �d�k �Z �Wn�e�j �o�n4�Xd�e �i�i �i�f�d�„��ƒ��YZ�d�f��d�„��ƒ��YZ�d�S(���s*�� dsml - generate and parse DSMLv1 data (see http://www.oasis-open.org/committees/dsml/) written by Michael Stroeder <michael@stroeder.com> See http://python-ldap.sourceforge.net for details. $Id: dsml.py,v 1.9 2004/06/17 13:52:07 stroeder Exp $ Python compability note: Tested with Python 2.0+. s���0.5.2Nc���������C���s%���h��}�x�|��D]�}�d�|�|�<q �W|�S(���sN��� return a dictionary with all items of l being the keys of the dictionary N(���t���dt���lt���it���None(���R���R���R����(����(����t(���/usr/lib/python2.4/site-packages/dsml.pyt ���list_dict���s������t���&s���&t���<s���<t���"s���"t���'s���'c���������C���s0���x)�t��D]!�\�}�}�t�i�|��|�|�ƒ�}��q�W|��S(���N(���t���special_entitiest���chart���entityt���stringt���replacet���s(���R���R���R���(����(����R���t���replace_char#���s�����t ���DSMLWriterc�����������B���sG���t��Z�g��d�d�d�„�Z�d�„��Z�d�„��Z�d�„��Z�d�„��Z�d�„��Z�RS( ���Nt����s��� c���������C���s:���|�|��_�t�t�t�i�|�ƒ�ƒ�|��_�|�|��_ �|�|��_�d�S(���s�� Parameters: f File object for output. base64_attrs Attribute types to be base64-encoded. dsml_comment Text placed in comment lines behind <dsml:dsml>. indent String used for indentiation of next nested level. N( ���t���ft���selft���_output_fileR���t���mapR ���t���lowert���base64_attrst ���_base64_attrst���dsml_commentt ���_dsml_commentt���indentt���_indent(���R���R���R���R���R���(����(����R���t���__init__*���s ���� � c���������C���sZ���|��i�o�|��i�i�t�i�|�ƒ�ƒ�Sn0�y�t�|�d�ƒ�Wn�t�j �o�d�Sn�Xd�Sd��S(���Ns���utf-8i���i����( ���R���R���t���has_keyR ���R���t ���attr_typet���unicodet ���attr_valuet���UnicodeError(���R���R ���R"���(����(����R���t���_needs_base64_encoding=���s���� c���������C���sŒ���|��i�i�d�i�d�d�d�d�|��i�g�ƒ�ƒ�|��i�oR�|��i�i�d�|��i�ƒ�|��i�i�d�|��i�|��i�f�ƒ�|��i�i�d�|��i�ƒ�n�d �S( ���s��� Write the header s��� s&���<?xml version="1.0" encoding="UTF-8"?>sD���<!DOCTYPE root PUBLIC "dsml.dtd" "http://www.dsml.org/1.0/dsml.dtd">s1���<dsml:dsml xmlns:dsml="http://www.dsml.org/DSML">s���%s<dsml:directory-entries> s���%s<!-- s���%s%s s���%s--> N(���R���R���t���writet���joinR���R���(���R���(����(����R���t���writeHeaderH���s�����, c���������C���s+���|��i�i�d�|��i�ƒ�|��i�i�d�ƒ�d�S(���s��� Write the footer s���%s</dsml:directory-entries> s ���</dsml:dsml> N(���R���R���R%���R���(���R���(����(����R���t���writeFooterX���s�����c���������C���s���|��i�|�|�ƒ�S(���N(���R���t���writeRecordt���dnt���entry(���R���R*���R+���(����(����R���t���unparse_���s����c��� ������C���s��|��i�i�d�|��i�d�t�|�ƒ�f�ƒ�|�i�d�|�i�d�g��ƒ�ƒ�}�|��i�i�d�|��i�d�ƒ�x/�|�D]'�}�|��i�i�d�|��i�d�|�f�ƒ�qg�W|��i�i�d �|��i�d�ƒ�|�i �ƒ��}�y�|�i�d�ƒ�|�i�d�ƒ�Wn�t �j �o�n�X|�i�ƒ��xû�|�D]ó�}�|��i�i�d �|��i�d�|�f�ƒ�x®�|�|�D]¢�}�|��i�|�|�ƒ�}�|�o�t�i�|�ƒ�}�n �t�|�ƒ�}�|��i�i�d�|��i�d�d�|�f�ƒ�|��i�i�d �|��i�d�|�f�ƒ�|��i�i�d�|��i�d�f�ƒ�q1W|��i�i�d�|��i�d�ƒ�qÿ�W|��i�i�d�|��i�d�ƒ�d�S(���s„��� dn string-representation of distinguished name entry dictionary holding the LDAP entry {attr:data} s���%s<dsml:entry dn="%s"> i���t���objectclasst���objectClasss���%s<dsml:objectclass> i���s$���%s<dsml:oc-value>%s</dsml:oc-value> i���s���%s</dsml:objectclass> s���%s<dsml:attr name="%s"> s���%s<dsml:value%s> s��� encoding="base64"s���%s%s i���s���%s</dsml:value> s���%s</dsml:attr> s���%s</dsml:entry> N(���R���R���R%���R���R���R*���R+���t���gett ���objectclassest���oct���keyst ���attr_typest���removet ���ValueErrort���sortR ���t���attr_value_itemR$���t���needs_base64_encodingt���base64t���encodestring( ���R���R*���R+���R3���R7���R1���R ���R0���R8���(����(����R���R)���b���s<�����'�% �!�%!"(���t���__name__t ���__module__R���R$���R'���R(���R,���R)���(����(����(����R���R���(���s��� t ���DSMLv1Handlerc�����������B���sD���t��Z�d��Z�d�„��Z�d�„��Z�d�„��Z�d�„��Z�d�„��Z�d�„��Z�RS(���s*��� Content handler class for DSMLv1 c���������C���s#���|�|��_�t�i�i�i�i�|��ƒ�d��S(���N(���t���parser_instanceR���t���_parser_instancet���xmlt���saxt���handlert���ContentHandlerR���(���R���R>���(����(����R���R���ª���s���� c���������C���s���d��S(���N(����(���R���(����(����R���t ���startDocument®���s����c���������C���s���d��S(���N(����(���R���(����(����R���t���endDocument±���s����c���������C���s&��|�i�d�ƒ�p �t�d�‚�|�d�}�|�d�j�o�nî�|�d�j�o �d�|��_�nÔ�|�d�j�o�|�d�|��_�h��|��_�n�|�d �j�o#�|�d �i �d�ƒ�|��_ �g��|��_�n}�|�d�j�o.�d�|��_�|�i �d �d�ƒ�i�ƒ��d�j�|��_�nB�|�d�j�o �g��|��_�n(�|�d�j�o �d�|��_�n�t�d�|�‚�d��S(���NR���s���Illegal namei���t���dsmls���directory-entriesi���R+���R*���t���attrt���names���utf-8t���valuet���encodingR9���R-���s���oc-values���Unknown tag %s(���t���raw_namet ���startswitht���AssertionErrorRH���R���t���_parsing_entriest���attrst���_dnt���_entryt���encodet ���_attr_typet���_attr_valuest���_attr_valueR/���R���t���_base64_encodingt���_object_classest ���_oc_valueR5���(���R���RK���RO���RH���(����(����R���t���startElement´���s(���� % c���������C���s”��|�i�d�ƒ�p �t�d�‚�|�d�}�|�d�j�o�n\|�d�j�o �d�|��_�nB|�d�j�o)�|��i�i�|��i�|��i �ƒ�|��`�|��` �n|�d�j�o#�|��i �|��i �|��i�<|��`�|��` �nÜ�|�d �j�oa�|��i�o�t �i�|��i�i�ƒ��ƒ�}�n�|��i�i�ƒ��i�d �ƒ�}�|��i �i�|�ƒ�~�|��`�|��`�nn�|�d�j�o�|��i�|��i �d�<|��`�nG�|�d �j�o,�|��i�i�|��i�i�ƒ��i�d �ƒ�ƒ�|��`�n�t�d�|�‚�d��S(���Ns���dsml:s���Illegal namei���RF���s���directory-entriesi����R+���RG���RI���s���utf-8R-���R.���s���oc-values���Unknown tag %s(���RK���RL���RM���RH���R���RN���R?���t���handleRP���RQ���RT���RS���RV���R9���t���decodestringRU���t���stripR"���RR���t���appendRW���RX���R5���(���R���RK���RH���R"���(����(����R���t ���endElementÍ���s:���� " c���������C���sR���|��i�i�d�ƒ�o�|��i�|�|��_�n(�|��i�i�d�ƒ�o�|��i�|�|��_�n�d��S(���NRX���RU���(���R���t���__dict__R���RX���t���chRU���(���R���R`���(����(����R���t ���charactersð���s����( ���R;���R<���t���__doc__R���RD���RE���RY���R^���Ra���(����(����(����R���R=���¥���s���� #t ���DSMLParserc�����������B���s/���t��Z�d��Z�e�d�d�„�Z�d�„��Z�d�„��Z�RS(���sô��� Base class for a DSMLv1 parser. Applications should sub-class this class and override method handle() to implement something meaningful. Public class attributes: records_read Counter for records processed so far i����c���������C���s”���|�|��_�|�|��_�t�t�t�i�|�p�g��ƒ�ƒ�|��_ �d�|��_�d�|��_ �t�i�i�ƒ��|��_�|��i�i�t�i�i�i�d�ƒ�|�|��ƒ�}�|��i�i�|�ƒ�d�S(���s_�� Parameters: input_file File-object to read the LDIF input from ignored_attr_types Attributes with these attribute type names will be ignored. max_entries If non-zero specifies the maximum number of entries to be read from f. line_sep String used as line separator i����N(���NN(���t ���input_fileR���t���_input_filet���max_entriest���_max_entriesR���R���R ���R���t���ignored_attr_typest���_ignored_attr_typesR���t���_current_recordt���records_readR@���RA���t���make_parsert���_parsert ���setFeatureRB���t���feature_namespacest���ContentHandlerClasst���content_handlert���setContentHandler(���R���Rd���Rp���Rh���Rf���Rq���(����(����R���R�����s����� " c���������O���s'���d�k��}�|�i��|�ƒ�|�i��|�ƒ�d�S(���s}��� Process a single content LDIF record. This method should be implemented by applications using LDIFParser. N(���t���pprintt���argst���kwargs(���R���Rt���Ru���Rs���(����(����R���RZ��� ��s����� c���������C���s���|��i�i�|��i�ƒ�d�S(���s5��� Continously read and parse DSML records N(���R���Rm���t���parseRe���(���R���(����(����R���Rv���)��s�����(���R;���R<���Rb���R���R���RZ���Rv���(����(����(����R���Rc���ù���s���� (���R���s���&(���R���s���<(���R���s���"(���R ���s���'(���Rb���t���__version__R ���R9���R���R ���R���R���t���xml.saxR@���t���xml.sax.handlert���ImportErrorRA���RB���RC���R=���Rc���( ���R@���R���R ���R9���R=���R ���Rc���R���Rw���R���(����(����R���t���?���s��� tT