MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /proc/self/root/usr/lib/python2.4/site-packages/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/usr/lib/python2.4/site-packages/ldif.pyc
mò
Öbª@c@sídZdZddddgZdkZdkZdkZdkZdkZdkZydk	l
Z
Wn ej
odk
l
Z
nXdZd	Z
ed
e
ZededZeid
eƒZdeƒZhdd<dd<dd<Zhdd<dd<dd<ZddddgZhZxeD]Zdee<q5WdZeieƒZd„Zd„Zd„Zdfd„ƒYZddd„Z dfd „ƒYZ!d!e!fd"„ƒYZ"d#e!fd$„ƒYZ#ddd%„Z$dS(&s+
ldif - generate and parse LDIF data (see RFC 2849)
written by Michael Stroeder <michael@stroeder.com>

See http://python-ldap.sourceforge.net for details.

$Id: ldif.py,v 1.36 2004/05/04 22:28:42 stroeder Exp $

Python compability note:
Tested with Python 2.0+, but should work with Python 1.5.2+.
s0.5.2tldif_patterntAttrTypeandValueLDIFt
CreateLDIFt	ParseLDIFN(sStringIOs[\w;.]+(;[\w_-]+)*s(([^,]|\\,)+|".*?")s	[ ]*=[ ]*s
([ ]*,[ ]*s)*[ ]*s^%s$s>^((dn(:|::) %(dn_pattern)s)|(%(attrtype_pattern)s(:|::) .*)$)+tadditdeleteitreplaceitmodifytmodrdns (^(|
|
| |:|<)|[

€-ÿ]+|[ ]+$)cCsD|djodSnti|ƒ}|djo|idƒ|jS(s!
  returns 1 if s is a LDAP DN
  tiiN(tstdn_regextmatchtrmtNonetgroup(R
R
((t(/usr/lib/python2.4/site-packages/ldif.pytis_dn7s

cCsti|ƒdj	S(sG
  returns 1 if s has to be base-64 encoded because of special chars
  N(tsafe_string_retsearchR
R(R
((Rtneeds_base64AscCs%h}x|D]}d||<q
W|S(sN
  return a dictionary with all items of l being the keys of the dictionary
  N(tdtltiR(RRR((Rt	list_dictHst
LDIFWritercBsMtZdZeddd„Zd„Zd„Zd„Zd„Zd„Z	RS(	sŠ
  Write LDIF entry or change records to file object
  Copy LDIF input to a file output object containing all data retrieved
  via URLs
  iLs
cCsJ||_ttti|pgƒƒ|_||_
||_d|_
dS(s!
    output_file
        file object for output
    base64_attrs
        list of attribute types to be base64-encoded in any case
    cols
        Specifies how many columns a line may have before it's
        folded into many lines.
    line_sep
        String used as line separator
    iN(toutput_filetselft_output_fileRtmaptstringtlowertbase64_attrst
_base64_attrstcolst_colstline_sept	_line_septrecords_written(RRR R"R$((Rt__init__Ys	"		cCsút|ƒ}||ijo'|ii|ƒ|ii|iƒn´|i}|ii|dt	||iƒ!ƒ|ii|iƒxq||joc|iidƒ|ii||t	|||idƒ!ƒ|ii|iƒ||id}q…WdS(s7
    Write string line as one or more folded lines
    it iN(
tlentlinetline_lenRR#RtwriteR%tpostmin(RR*R+R-((Rt_unfoldLDIFLineks	#
+cCs‡|iiti|ƒƒp
t|ƒo;|iti	|ti
ti|ƒddƒgdƒƒn |iti	||gdƒƒdS(sƒ
    Write a single attribute type/value pair

    attr_type
          attribute type
    attr_value
          attribute value
    s
R	s:: s: N(
RR!thas_keyRRt	attr_typeRt
attr_valueR/tjoinRtbase64tencodestring(RR1R2((Rt_unparseAttrTypeandValue€s
);cCsQ|iƒ}|iƒx3|D]+}x"||D]}|i||ƒq/WqWdS(s3
    entry
        dictionary holding an entry
    N(tentrytkeyst
attr_typestsortR1R2RR6(RR7R2R9R1((Rt_unparseEntryRecord•s

c	Cst|dƒ}|djo
d}n!|djo
d}n
td‚|id|ƒx¼|D]´}|djo|\}}n>|djo'|\}}}|it||ƒn
td‚|o%x"|D]}|i||ƒqÌWn|djo|i
id	|iƒq^q^Wd
S(sP
    modlist
        list of additions (2-tuple) or modifications (3-tuple)
    iiRiRsmodlist item of wrong lengtht
changetypes'Subsequent modlist item of wrong lengtht-N(R)tmodlisttmod_lenR<t
ValueErrorRR6tmodtmod_typetmod_valstmod_opt
MOD_OP_STRtmod_valRR,R%(	RR>RFRBR?R<RCRDRA((Rt_unparseChangeRecord s,



	

	
cCs|pdSn|id|ƒt|ƒtijo|i|ƒn1t|ƒtijo|i	|ƒn
t
d‚|ii|i
ƒ|id|_dS(sÙ
    dn
          string-representation of distinguished name
    record
          Either a dictionary holding the LDAP entry {attrtype:record}
          or a list with a modify list like for LDAPObject.modify().
    Ntdns*Argument record must be dictionary or listi(trecordRR6RHttypettypestDictTypeR;tListTypeRGR@RR,R%R&(RRHRI((Rtunparse»s	(
t__name__t
__module__t__doc__RR'R/R6R;RGRN(((RRRs				iLcCsHtƒ}t|||dƒ}|i||ƒ|i	ƒ}|iƒ|S(sþ
  Create LDIF single formatted record including trailing empty line.
  This is a compability function. Use is deprecated!

  dn
        string-representation of distinguished name
  record
        Either a dictionary holding the LDAP entry {attrtype:record}
        or a list with a modify list like for LDAPObject.modify().
  base64_attrs
        list of attribute types to be base64-encoded in any case
  cols
        Specifies how many columns a line may have before it's
        folded into many lines.
  s
N(tStringIOtfRR R"tldif_writerRNRHRItgetvalueR
tclose(RHRIR R"RSRTR
((RRÖs	
t
LDIFParsercBsPtZdZd„Zededd„Zd„Zd„Zd„Zd„Z	RS(	sæ
  Base class for a LDIF 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
  cCsQ|p|Sn?|ddjo|d Sn"|ddjo|d Sn|SdS(sI
    Strip trailing line separators from s, but no other whitespaces
    iþÿÿÿs
iÿÿÿÿs
N(R
(RR
((Rt
_stripLineSepøsis
cCsl||_||_ttti|pgƒƒ|_
ttti|pgƒƒ|_||_d|_dS(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.
    process_url_schemes
        List containing strings with URLs schemes to process with urllib.
        An empty list turns off all URL processing and the attribute
        is ignored completely.
    line_sep
        String used as line separator
    iN(t
input_fileRt_input_filetmax_entriest_max_entriesRRRRtprocess_url_schemest_process_url_schemestignored_attr_typest_ignored_attr_typesR$R%trecords_read(RRYR_R[R]R$((RR's		""	cCsdS(sw
    Process a single content LDIF record. This method should be
    implemented by applications using LDIFParser.
    N((RRHR7((Rthandle$scCsz|i|iƒ}|iiƒ|_xO|ioD|iddjo0||i|idƒ}|iiƒ|_q'W|S(sG
    Unfold several folded lines with trailing space into one line
    iR(iN(RRXt_linet
unfolded_lineRZtreadline(RRd((RR/*scCs˜|iƒ}x)|o!|ddjo|iƒ}qW|p|djp
|djodSnyti|dƒ}Wntj
od
SnX|d|!}|||d!}|djot
i||dƒ}n·|djonti
||dƒ}d}|ioCti|ƒ}|ii|dƒoti|ƒiƒ}qOqŽn<|d	jp
|djo
d
}nti||dƒ}||fS(s^
    Parse a single attribute type and value pair from one or
    more lines of LDIF data
    it#s
s
t:is::s:<s:
R	N(NN(NN(RR/RdRRtindext	colon_posR@R1t
value_specR4tdecodestringR2tstripturlR^turlparsetuR0turllibturlopentreadtlstrip(RRiR2RmR1RoRdRj((Rt_parseAttrTypeandValue5s4"	



!
cCs |iiƒ|_x|ioü|ip|i|ijoÞd
}d
}d
}d
}h}|iƒ\}}x||d
jon|d
joa|djoH|d
jo
td‚nt|ƒptdt|ƒ‚n|}n÷|djo|d
jo
d}nÓ|djoe|d
jo
td‚n|d
jo
td‚nti|ƒptd	t|ƒ‚n|}na|d
joS|iiti|ƒƒo6|i|ƒo||i|ƒqÕ|g||<n|iƒ\}}qpW|o$|i||ƒ|id|_qqWd
S(s1
    Continously read and parse LDIF records
    RHs*Two lines starting with dn: in one record.s8No valid string-representation of distinguished name %s.tversioniR<s/Read changetype: before getting valid dn: line.s2Two lines starting with changetype: in one record.schangetype value %s is invalid.N(RRZReRcR\RaRRuRHR<tmodopR7RtR1R2R@Rtreprtvalid_changetype_dictR0R`RRtappendRb(RRHRvR<R1RuR2R7((RtparseZsB(











*(
RORPRQRXRR'RbR/RtRz(((RRWîs	
			%tLDIFRecordListcBs)tZdZeded„Zd„ZRS(sm
  Collect all records of LDIF input into a single list.
  of 2-tuples (dn,entry). It can be a memory hog!
  icCs&ti|||||ƒg|_dS(s€
    See LDIFParser.__init__()

    Additional Parameters:
    all_records
        List instance for storing parsed records
    N(RWR'RRYR_R[R]tall_records(RRYR_R[R]((RR'”scCs|ii||fƒdS(s<
    Append single record to dictionary of all records.
    N(RR|RyRHR7(RRHR7((RRb£s(RORPRQRR'Rb(((RR{ŽstLDIFCopycBs2tZdZedeeddd„Zd„ZRS(sM
  Copy LDIF input to LDIF output containing all data retrieved
  via URLs
  iiLs
c		Cs5ti|||||ƒt||||ƒ|_dS(s=
    See LDIFParser.__init__() and LDIFWriter.__init__()
    N(
RWR'RRYR_R[R]RRR R"R$t_output_ldif(	RRYRR_R[R]R R"R$((RR'°scCs|ii||ƒdS(s2
    Write single LDIF record to output file.
    N(RR~RNRHR7(RRHR7((RRb¼s(RORPRQRR'Rb(((RR}ªscCs/t|d|d|ddƒ}|iƒ|iS(s]
  Parse LDIF records read from file.
  This is a compability function. Use is deprecated!
  R_R[R]iN(R{RStignore_attrst
maxentriestldif_parserRzR|(RSRR€R((RRÃs
(%RQt__version__t__all__RRnRpR4treRKt	cStringIORRtImportErrortattrtype_patterntattrvalue_patterntrdn_patternt
dn_patterntcompileRtvarsRtMOD_OP_INTEGERREtCHANGE_TYPESRxtcRtSAFE_STRING_PATTERNRRRRRRRWR{R}R(RRRŠRRERƒR4RWRpR{R„RŽRRR‚RRR}RxRRKRRRRRR‰R‡RnRRRˆ((Rt?s>6
!!	
		
„ 

Anon7 - 2021