Viewing File: /usr/local/cpanel/3rdparty/mailman/Mailman/versions.pyc

ó
¾}´^c@sÑdZddlZddlmZmZddlmZddlmZddlmZddl	m
Z
ddlmZdd	l
mZd
„Zd„ZgZd„Zd
„Zd„Zd„Zd„ZdS(sRRoutines which rectify an old mailing list with current structure.

The MailList.CheckVersion() method looks for an old .data_version setting in
the loaded structure, and if found calls the Update() routine from this
module, supplying the list and the state last loaded from storage.  The state
is necessary to distinguish from default assignments done in the .InitVars()
methods, before .CheckVersion() is called.

For new versions you should add sections to the UpdateOldVars() and the
UpdateOldUsers() sections, to preserve the sense of settings across structural
changes.  Note that the routines have only one pass - when .CheckVersions()
finds a version change it runs this routine and then updates the data_version
number of the list, and then does a .Save(), so the transformations won't be
run again until another version change is detected.
iÿÿÿÿN(tListTypet
StringType(tmm_cfg(tUtils(tMessage(t_BounceInfo(tUNKNOWN(tsyslogcCsCt|ƒt|ƒt|ƒt||ƒt|ƒt|ƒdS(sHDispose of old vars and user options, mapping to new ones when suitable.N(t
ZapOldVarstUpdateOldUserstNewVarst
UpdateOldVarstCanonicalizeUserOptionstNewRequestsDatabase(tltstored_state((s6/usr/local/cpanel/3rdparty/mailman/Mailman/versions.pytUpdate1s




c
Cs4x-dD]%}t||ƒrt||ƒqqWdS(Nt
num_spawnstfilter_progtclobber_datetpublic_archive_file_dirtprivate_archive_file_dirtarchive_directorytminimum_removal_datet'minimum_post_count_before_bounce_actiontautomatic_bounce_actiontmax_posts_between_bounces(
RRRRRRRRRR(thasattrtdelattr(tmlisttname((s6/usr/local/cpanel/3rdparty/mailman/Mailman/versions.pyR<s
cst||d„}‡fd†}‡‡fd†‰d„‰t|dƒrt|dƒ}t|dƒsv||_n|`nt|dƒstj|_nt|dƒs¸g|_nt|d	ƒsÓg|_	nt|d
ƒsîg|_
nt|dƒs	g|_nt|dƒs'tj|_
nt|d
ƒsEtj|_nt|dƒr=|jrÞx3|jD](}|j|ƒsg|jj|ƒqgqgWx3|jƒD]%}|j|tj||jkƒq Wd|_d|_nJ|jr_x3|jD](}|j|ƒsñ|jj|ƒqñqñWx*|jƒD]}|j|tjdƒq*Wd|_d|_nÉ|jsªx*|jƒD]}|j|tjdƒquWd|_d|_n~x3|jD](}|j|ƒs´|jj|ƒq´q´Wx3|jƒD]%}|j|tj||jkƒqíWd|_d|_|`|`|`nt|dƒr§|j}xF|D]>}|j|ƒrŠ|j|tjdƒq\|j	j|ƒq\W|`n|ddtjƒ|ddƒ|ddƒ|ddƒ|ddƒ|ddƒt|dƒrM|jr4tjr(d|_q=d|_n	d|_t|dƒnt|dƒsrt|dtjƒnt|dƒs—t|dtj ƒnt|d ƒrì|j!rÇ|jrÜd|_qÜn|jrÜd|_nt|d ƒn$|j"d!kr|jrd|_nt#|j$ƒt%krUi}x|j$D]}	d||	<q5W||_$nt#|j&ƒt%krši}
x|j&D]}d|
|<qzW|
|_&nt|d"ƒs¿t|d"tj'ƒnx”|j$j(ƒD]ƒ}|j)ƒ|krt*j+|ƒ|j$|j)ƒ<|j$|=qÏt#|j$|ƒt,krE||j$|j)ƒkrEqÏd|j$|<qÏWx”|j&j(ƒD]ƒ}|j)ƒ|kr§t*j+|ƒ|j&|j)ƒ<|j&|=qft#|j&|ƒt,krÜ||j&|j)ƒkrÜqfd|j&|<qfW|d#d$krd|j-d%ƒrdg|_.xL|d%D]=\}
}}}t*j/|ƒ}|j.j|
|||fƒq Wn|d#d&krë|j0d'kr®t*j1d'ƒd(kr®||d)d(ƒq®n|j0d*krët*j1d*ƒd(krè||d+d(ƒqèqën|d,d-tj2ƒd.S(/s‹Transform old variable values into new ones, deleting old ones.
    stored_state is last snapshot from file, as opposed to from InitVars().cSs}t||ƒrJ|j|ƒs:t||t||ƒƒnt||ƒnt||ƒry|tk	ryt|||ƒndS(s&Use specified old value if new value is not in stored state.

        If the old attr does not exist, and no newdefault is specified, the
        new attr is *not* created - so either specify a default or be positive
        that the old attr exists - or don't depend on the new attr.

        N(Rthas_keytsetattrtgetattrRt	uniqueval(toldnametnewnamet
newdefaultRtstate((s6/usr/local/cpanel/3rdparty/mailman/Mailman/versions.pytPreferStoredPs	csdx]t|ƒD]O}|jdƒr(q
nˆt||ƒ||ƒ}|r
t|||ƒq
q
WdS(sÝIf the character set for a list's preferred_language has changed,
        attempt to recode old string values into the new character set.

        mlist is the list, f is the old charset and t is the new charset.
        t_N(tdirt
startswithR!R (Rtftttxtnv(tdoitem(s6/usr/local/cpanel/3rdparty/mailman/Mailman/versions.pytrecode`sc	s‡t}t|tƒr%ˆ|||ƒSt|tƒr‘xItt|ƒƒD]5}ˆ||||ƒ}|rGt}|||<qGqGW|rŠ|SdSnòt|tƒrd}x]tt|ƒƒD]I}ˆ||||ƒ}|rñt}||f7}q¹|||f7}q¹W|r|SdSnlt|t	ƒrxE|j
ƒD]7\}}ˆ|||ƒ}|r3t}|||<q3q3W|rx|SdSndSdS(s›Recursively process lists, tuples and dictionary values and
        convert strings as needed. Return either the updated item or None
        if no change.N((tFalset
isinstancetstrtlisttrangetlentTruetNonettupletdicttitems(	tvR+R,tchangedtiR.tnttktov(tconvertR/(s6/usr/local/cpanel/3rdparty/mailman/Mailman/versions.pyR/msBcSs‰yt||ƒ}t}Wntk
r2t}nXyt||ƒt}Wntk
rct}nX|r|r|j|dƒSdSdS(sbThis does the actual character set conversion of the string s
        from charset f to charset t.treplaceN(tunicodeR7t
ValueErrorR1tencodeR8(tsR+R,tutis_ftis_t((s6/usr/local/cpanel/3rdparty/mailman/Mailman/versions.pyRB˜s







tdont_respond_to_post_requeststrespond_to_post_requeststdefault_member_moderationtaccept_these_nonmembersthold_these_nonmemberstreject_these_nonmemberstdiscard_these_nonmemberstforward_auto_discardstgeneric_nonmember_actiont	moderatediitforbidden_posterstreminders_to_adminst
umbrella_listtauto_subscribetopen_subscribetclosedtprivate_rostert!mimimum_post_count_before_removalt'mimimum_post_count_before_bounce_actiontbad_posterstautomatically_removeRit
administriviatadmin_member_chunksizetposters_includes_membersi
tadmin_notify_mchangestdata_versionijttopicsiltrosutf-8s
iso-8859-2truskoi8-rtauthor_is_listtfrom_is_listN(3R"RR!RLRKRt!DEFAULT_DEFAULT_MEMBER_MODERATIONRMRNRORPRQtDEFAULT_FORWARD_AUTO_DISCARDSRRt DEFAULT_GENERIC_NONMEMBER_ACTIONRSRTtposterstisMembertappendt
getMemberstsetMemberOptiontModeratetmember_posting_onlyRUtDEFAULT_UMBRELLA_LISTRYtALLOW_OPEN_SUBSCRIBEtsubscribe_policyRR tDEFAULT_ADMINISTRIVIAtDEFAULT_ADMIN_MEMBER_CHUNKSIZERbRdttypetmembersRtdigest_memberstDEFAULT_ADMIN_NOTIFY_MCHANGEStkeystlowerRtLCDomainRRRetstrip_verbose_patterntpreferred_languaget
GetCharSettDEFAULT_FROM_IS_LIST(RRR'R0toldvaltaddrtmembert
forbiddensRztmtdmemberstdmR@Rtpatterntdescriptiont	emptyflag((RBR/s6/usr/local/cpanel/3rdparty/mailman/Mailman/versions.pyRLs
+	
	9										
		




				
				

2
	#	cCsO|d„}|ddƒ|ddƒ|ddƒ|ddƒ|ddƒ|d	dƒ|d
dƒ|diƒ|d
iƒ|ddƒ|dtjƒ|dgƒ|dtjƒ|ddƒ|ddRƒ|ddRƒ|dgƒ|dgƒ|ddƒ|ddƒ|diƒ|diƒ|ddƒ|dtjƒ|dtjƒ|dtjƒ|d tjƒ|d!d"ƒ|d#d"ƒ|d$d"ƒ|d%tjƒ|d&tj	ƒ|d'tj
ƒ|d(tjƒ|d)tjƒ|d*tj
ƒ|d+tjƒ|d,tjƒ|d-gƒ|d.tjƒ|d/tjƒ|d0tjƒ|d1tjƒ|d2tjƒ|d3iƒ|d4dƒ|d5dƒ|d6tjƒ|d7tjƒ|d8tjƒ|d9dƒ|d:gƒ|d;tjƒ|d<tjƒ|d=tjƒ|d>tjƒ|d?tjƒ|d@tjƒ|dAdƒ|dBiƒ|dCd"ƒtj|j ƒdDkršd}ndE}|dF|ƒ|dGdƒ|dHgƒ|dIdƒ|dJtj!ƒ|dKgƒ|dLdƒ|dMdƒ|dNtj"ƒ|dOtj#ƒ|dPtj$ƒ|dQtj%ƒdRS(Ss9Add defaults for these new variables if they don't exist.cSs&t||ƒs"t|||ƒndS(N(RR (tattrtinitvalR((s6/usr/local/cpanel/3rdparty/mailman/Mailman/versions.pytadd_only_if_missing¥stautorespond_postingsitautorespond_admintautorespond_requeststautoresponse_postings_textttautoresponse_admin_texttautoresponse_request_texttautoresponse_graceperiodiZtpostings_responsestadmin_responsestreply_goes_to_listRtavailable_languagestdigest_volume_frequencytdigest_last_sent_attmod_passwordt
post_passwordt	moderatorRettopics_enabledttopics_bodylines_limititone_last_digestt	usernamestpersonalizetfirst_strip_reply_totsubscribe_auto_approvaltunsubscribe_policytsend_goodbye_msgtinclude_rfc2369_headersitinclude_list_post_headertinclude_sender_headertbounce_score_thresholdtbounce_info_stale_aftert bounce_you_are_disabled_warningst)bounce_you_are_disabled_warnings_intervalt&bounce_unrecognized_goes_to_list_ownert'bounce_notify_owner_on_bounce_incrementtbounce_notify_owner_on_disabletbounce_notify_owner_on_removaltban_listtfilter_mime_typestpass_mime_typestfilter_contenttconvert_html_to_plaintextt
filter_actiontdelivery_statustmember_moderation_actiontmember_moderation_noticetdmarc_moderation_actiont"dmarc_quarantine_moderation_actiontdmarc_none_moderation_actiontdmarc_moderation_noticetdmarc_moderation_addressestdmarc_wrapped_message_texttmember_verbosity_thresholdtmember_verbosity_intervaltequivalent_domainstnew_member_optionstdrop_cct	emergencythold_and_cmd_autoresponsestnews_prefix_subject_toosus-asciiitencode_ascii_prefixestnews_moderationtheader_filter_rulestscrub_nondigesttfilter_filename_extensionstpass_filename_extensionstmax_days_to_holdtnonmember_rejection_noticetcollapse_alternativestregular_exclude_liststregular_include_liststregular_exclude_ignoreN(&RtDEFAULT_SERVER_LANGUAGEtDEFAULT_DIGEST_VOLUME_FREQUENCYR8tDEFAULT_FIRST_STRIP_REPLY_TOtDEFAULT_SUBSCRIBE_AUTO_APPROVALtDEFAULT_UNSUBSCRIBE_POLICYtDEFAULT_SEND_GOODBYE_MSGtDEFAULT_BOUNCE_SCORE_THRESHOLDtDEFAULT_BOUNCE_INFO_STALE_AFTERt(DEFAULT_BOUNCE_YOU_ARE_DISABLED_WARNINGSt1DEFAULT_BOUNCE_YOU_ARE_DISABLED_WARNINGS_INTERVALt.DEFAULT_BOUNCE_UNRECOGNIZED_GOES_TO_LIST_OWNERt/DEFAULT_BOUNCE_NOTIFY_OWNER_ON_BOUNCE_INCREMENTt&DEFAULT_BOUNCE_NOTIFY_OWNER_ON_DISABLEt&DEFAULT_BOUNCE_NOTIFY_OWNER_ON_REMOVALtDEFAULT_FILTER_MIME_TYPEStDEFAULT_PASS_MIME_TYPEStDEFAULT_FILTER_CONTENTt!DEFAULT_CONVERT_HTML_TO_PLAINTEXTtDEFAULT_FILTER_ACTIONtDEFAULT_DMARC_MODERATION_ACTIONt*DEFAULT_DMARC_QUARANTINE_MODERATION_ACTIONt$DEFAULT_DMARC_NONE_MODERATION_ACTIONt"DEFAULT_DMARC_WRAPPED_MESSAGE_TEXTt"DEFAULT_MEMBER_VERBOSITY_THRESHOLDt!DEFAULT_MEMBER_VERBOSITY_INTERVALtDEFAULT_EQUIVALENT_DOMAINStDEFAULT_NEW_MEMBER_OPTIONStDEFAULT_DROP_CCRR‚Rt"DEFAULT_FILTER_FILENAME_EXTENSIONStDEFAULT_COLLAPSE_ALTERNATIVEStDEFAULT_REGULAR_EXCLUDE_LISTStDEFAULT_REGULAR_INCLUDE_LISTStDEFAULT_REGULAR_EXCLUDE_IGNORE(RRRF((s6/usr/local/cpanel/3rdparty/mailman/Mailman/versions.pyR
£sØ





















































	










cCs“i}x-|jjƒD]\}}|||jƒ<qW||_xM|jjƒD]<}|j|ƒs~t|j|ƒtƒrO|j|=qOqOWdS(s(Transform sense of changed user options.N(	t	passwordsR;R~tbounce_infoR}RnR2t
getBounceInfoR(RRúR@R<Rˆ((s6/usr/local/cpanel/3rdparty/mailman/Mailman/versions.pyR	"s	
cCs)t|ddƒdkrdSi}xq|jjƒD]`\}}|dkrPq2n|jƒ}d}|j|ƒr~||}n||O}|||<q2W||_xz|jjƒD]i\}}|j|ƒsÚ|j|=q¯n|j|tj	ƒr¯|j
|tƒ|j|tj	dƒq¯q¯Wd|_
dS(sFix up the user options.tuseropts_versioniNi(R!tuser_optionsR;R8R~RRntgetMemberOptionRtDisableDeliverytsetDeliveryStatusRRqRý(RtoptionsR@R<tlcusertflags((s6/usr/local/cpanel/3rdparty/mailman/Mailman/versions.pyR3s*

	
c
Cst|diƒ}|sdSxë|jƒD]Ý\}}|dkr›xM|D]E}|d\}}|d}tj|tjƒ}|j||ƒqHW||=q)|dkríx9|D]1\}	}	}
}}|j|d||
tjƒq®W||=q)t	dd	||j
ƒƒq)WdS(
s?With version 1.2, we use a new pending request database schema.trequestsNtpostiit
add_memberR•terrorsDVERY BAD NEWS.  Unknown pending request type `%s' found for list: %s(R!R;temailtmessage_from_stringRtHoldMessagetHoldSubscriptionRRÙRt
internal_name(
RtrR@R<tptauthorttexttreasontmsgtigntdigestR…tpassword((s6/usr/local/cpanel/3rdparty/mailman/Mailman/versions.pyR
Ws&





(t__doc__R	ttypesRRtMailmanRRRtMailman.BouncerRtMailman.MemberAdaptorRtMailman.Logging.SyslogRRRR"RR
R	RR
(((s6/usr/local/cpanel/3rdparty/mailman/Mailman/versions.pyt<module>!s"			ÿX			$
Back to Directory File Manager