403Webshell
Server IP : 182.53.201.61  /  Your IP : 216.73.217.175
Web Server : Apache/2.2.15 (Fedora)
System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686
User : apache ( 48)
PHP Version : 5.3.3
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python2.6/site-packages/cupshelpers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyc
ߠJc@sddkZddkZddkZddkZddkZddkZddkZddklZdfdYZ	dZ
dZdfd	YZd
Z
dZdZd
ZdZdZedjoendS(iNi(t_debugprinttPrintercBseZddgZdZdZdZdZdZdZdZ	d	Z
d
ZdZddZdd
ZdZdZdZdZdZeddZddZddZdZRS(toptionstlocalcKs5||_||_g|_|i|d|_dS(s
        @param name: printer name
        @type name: string
        @param connection: CUPS connection
        @type connection: CUPS.Connection object
        @param kw: printer attributes
        @type kw: dict indexed by string
        N(tnamet
connectiont
class_memberstupdatetNonet_ppd(tselfRRtkw((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyt__init__s
				
cCs(|idjoti|indS(N(R	Rtostunlink(R
((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyt__del__+scCsd|iS(Ns<cupshelpers.Printer "%s">(R(R
((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyt__repr__/sc
Csd}d}t|}xtiD]~}|i|oh|||}||ijoq%n|djo
d}nt||t|itt|@q%q%WdS(NcSs|itititiS(N(t	translatetstringt	maketranstascii_uppercasetascii_lowercase(tstr((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyt_ascii_lower4st
CUPS_PRINTER_tclasstis_class(	tlentcupst__dict__t
startswitht_flags_blacklisttsetattrtboolttypetgetattr(R
Rtprefixt
prefix_lengthRt	attr_name((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyt
_expand_flags2s	


	cKs$|idd|_|itij|_|idd|_|idd|_|idd|_|idd|_	|idd|_
|id	d|_|id
d|_t|it
jo|ig|_n|i|idjo|i|_n|`||_dS(s
        Update object from printer attributes.

        @param kw: printer attributes
        @type kw: dict indexed by string
        s
printer-stateis
device-uritsprinter-infosprinter-is-sharedsprinter-locationsprinter-make-and-modelsprinter-typesprinter-uri-supportedN(tgettstateRtIPP_PRINTER_STOPPEDtenabledt
device_uritinfoRt	is_sharedtlocationtmake_and_modelR"t
uri_supportedtlistR't
not_sharedtother_attributes(R
R((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyRFs 
c	Cs|ii|i}h|_h|_hdddgfd6ddddddgfd	6|_xL|iD]>\}}|id
o|td
 }|djoqln|i	|ddp|ii	|dpd}t|tot
d|}n||i|<|i|do%||d}||f|i|<qql|idoI|djo<|djo/|d
jo"|ido||i|<qlqlW|i	dd\|_|_|i	ddg|_|i	dd|_|i	ddg|_|i	d
dpd|_|i	ddg|_t|_g|_|ido|d|_t|_n"|ido|d|_ndi|i|_|i|dS( s
        Fetch further attributes for the printer.

        Normally only a small set of attributes is fetched.  This
        method is for fetching more.
        tFalsetTruet	landscapetnonetsinglessingle-thicktdoublesdouble-thickspage-borders-defaults
job-sheetssprinter-error-policysprinter-op-policys
notify-eventssdocument-formatsnotify-lease-durations
-supportedR(cSs|d|S(t,((txty((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyt<lambda>ssjob-sheets-defaultsrequesting-user-name-sjob-sheets-supportedsprinter-error-policy-supportedtdefaultsprinter-op-policy-supportedsrequesting-user-name-allowedsrequesting-user-name-denieds, N(s
job-sheetssprinter-error-policysprinter-op-policys
notify-eventssdocument-formatsnotify-lease-duration(R9R9(RtgetPrinterAttributesRt
attributesR5tpossible_attributest	iteritemstendswithRR)Rt
isinstanceR3treducethas_keyRtjob_sheet_startt
job_sheet_endtjob_sheets_supportedterror_policyterror_policy_supportedt	op_policytop_policy_supportedR7t
default_allowtexcept_usersR6tjointexcept_users_stringR(R
tattrstkeytvalueRt	supported((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyt
getAttributes^sd		





		

cCsn|ididpdS|idd}|idd}|idd}|djo
d}n|S(	sc
        Find out which server defines this printer.

        @returns: server URI or None
        isipp://it/t:slocalhost.localdomaint	localhostN(R2RRtsplit(R
turi((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyt	getServers

cCsd}|idjopy.|ii|i|_ti|i}Wqtij
o,\}}|tijo
t	}qqXn|t	jo&|idjoti|i}n|S(s
        Obtain the printer's PPD.

        @returns: cups.PPD object, or False for raw queues
        @raise cups.IPPError: IPP error
        N(
RR	RtgetPPDRRtPPDtIPPErrort
IPP_NOT_FOUNDR6(R
tresulttetm((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyR_s
cCslt|to?titi}|djot|i|d}qOn|ii|i	||dS(s
        Set a printer's option.

        @param name: option name
        @type name: string
        @param value: option value
        @type value: option-specific
        t.N(
RFtfloattlocaletnl_langinfot	RADIXCHARRtreplaceRtaddPrinterOptionDefaultR(R
RRVt	radixchar((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyt	setOptions
	
 cCs|ii|i|dS(sh
        Unset a printer's option.

        @param name: option name
        @type name: string
        N(RtdeletePrinterOptionDefaultR(R
R((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pytunsetOptionscCsY|o|ii|in8|o|ii|id|n|ii|idS(s
        Set the printer's enabled state.

        @param on: whether it will be enabled
        @type on: bool
        @param reason: reason for this state
        @type reason: string
        treasonN(Rt
enablePrinterRtdisablePrinter(R
tonRq((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyt
setEnableds
	cCsY|o|ii|in8|o|ii|id|n|ii|idS(s
        Set the printer's accepting state.

        @param on: whether it will be accepting
        @type on: bool
        @param reason: reason for this state
        @type reason: string
        RqN(Rt
acceptJobsRt
rejectJobs(R
RtRq((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pytsetAcceptings
	cCs|ii|i|dS(sy
        Set the printer's shared state.

        @param on: whether it will be accepting
        @type on: bool
        N(RtsetPrinterSharedR(R
Rt((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyt	setSharedscCs|ii|i|dS(ss
        Set the printer's error policy.

        @param policy: error policy
        @type policy: string
        N(RtsetPrinterErrorPolicyR(R
tpolicy((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pytsetErrorPolicyscCs|ii|i|dS(s{
        Set the printer's operation policy.

        @param policy: operation policy
        @type policy: string
        N(RtsetPrinterOpPolicyR(R
R|((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pytsetOperationPolicyscCs|ii|i||dS(s
        Set the printer's job sheets.

        @param start: start sheet
        @type start: string
        @param end: end sheet
        @type end: string
        N(RtsetPrinterJobSheetsR(R
tstarttend((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pytsetJobSheetss	c	Cst|to|i}g}|D]}||idq'~}g}x|D]}|i|qSWg}|D]}||iqu~}td|}n|o|ii|i	|n|ii
|i	|dS(s
        Set access control list.

        @param allow: whether to allow by default, otherwise deny
        @type allow: bool
        @param except_users: exception list
        @type except_users: string list
        R<N(RFRR\textendtstriptfilterRRtsetPrinterUsersDeniedRtsetPrinterUsersAllowed(R
tallowRQtuserst_[1]tut_[2]((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyt	setAccess)s	*'c
Csg}y|ii}Wntij
o|SXx|iD]\}}y%|d}||idd}Wn
q@nX||ijoq@n|p!|idoG|ddjo6|i||djot
||joPqq@q@W|S(s
        Find out whether jobs are queued for this printer.

        @param only_tests: whether to restrict search to test pages
        @type only_tests: bool
        @returns: list of job IDs
        sjob-printer-uriRYisjob-names	Test PageN(RtgetJobsRRaRDtrindexRRHtappendRR(R
t
only_teststlimittrettjobstidRTR]((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyt
jobsQueued@s*


 
cCsg}y|iidd}Wntij
o|SXx|iD]\}}y%|d}||idd}Wn
qFnX||ijoqFn|idtiti	joqFn|i
||djot||joPqFqFW|S(so
        Find out whether there are preserved jobs for this printer.

        @return: list of job IDs
        t
which_jobst	completedsjob-printer-uriRYis	job-stateN(
RRRRaRDRRR)tIPP_JOB_PENDINGtIPP_JOB_COMPLETEDRRR(R
RRRRRTR]((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyt
jobsPreserved`s*

	
 	cCs|idtd|S(sl
        Find out whether test jobs are queued for this printer.

        @returns: list of job IDs
        RR(RR7(R
R((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyttestsQueued}scCs|ii|iti\}}ti|y d}|ii|d|Wn?ti	j
o0\}|ti
jotSti	|nXti|d}|i
d|i}t}d}xk|D]c}	|	idoM|	idd}
|
|ijod|	d	||<t}n|d7}qqW|ow|i
d|i||iti|dtiy|ii|d|Wqti	j
o
\}tSXn|S(
s9
        Set this printer as the system default.
        s/admin/conf/lpoptionstfdsr+isDefault t isDest i(Rt
setDefaultRttempfiletmkstempR
tremovetgetFileRt	HTTPErrortHTTP_NOT_FOUNDR6tfdopentseekt	readlinesRR\R7t
writelinesttruncatetlseektSEEK_SETtputFile(R
ttmpfdttmpfnametresourcetstftlinestchangedtitlineR((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pytsetAsDefaultsB






N(t__name__t
__module__RRRRR'RRXR^R_RnRpRRuRxRzR}RRRR6RRRR(((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyRs,						D													 cCs|i}|i}xd|iD]V\}}t|||}|||<|i|o|||_|iiq%q%W|S(s
    Obtain a list of printers.

    @param connection: CUPS connection
    @type connection: CUPS.Connection object
    @returns: L{Printer} list
    (tgetPrinterst
getClassesRDRRHRtsort(RtprinterstclassesRtprinter((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyRs


cCs4h}|id}xM|D]E}|iddjoqn|idd\}}|||<qW|ido|id|dn|ido|id|dn|id	o|id
|d	nx9ddd
ddd
dddg	D]}|i|dqW|d
id|d
<|S(s
    Parse an IEEE 1284 Device ID, so that it may be indexed by field name.

    @param id: IEEE 1284 Device ID, without the two leading length bytes
    @type id: string
    @returns: dict indexed by field name
    t;RZiitMANUFACTURERtMFGtMODELtMDLsCOMMAND SETtCMDtCLStDEStSNtStPtJR(R<(R\tfindRHt
setdefault(Rtid_dicttpiecestpieceRRV((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyt
parseDeviceIDs&"tDevicecBs)eZdZdZdZdZRS(s.
    This class represents a CUPS device.
    cKs||_|idd|_|idd|_|idd|_|idd|_|id}|d|_t|d	j|_	t
|i|_d
S(s~
        @param uri: device URI
        @type uri: string
        @param kw: device attributes
        @type kw: dict
        sdevice-classtUnknownsdevice-infoR(sdevice-make-and-models	device-idRZiiN(R]R)tdevice_classR.R1RR\R"RRRR(R
R]Rt
uri_pieces((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyRs	
cCsd|iS(Ns<cupshelpers.Device "%s">(R](R
((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyRscCsh|djodS|i|ijo|iodSdS|io|i|ijo|idjodS|idjodS|idjodS|idjodS|idjp|idjodS|idjp|idjodS|idjodS|idjodSntt|it|i}|pt|i|i}n|S(	s9
        Compare devices by order of preference.
        iitserialtparallelthpthpfaxtusbN(RRR"tcmpR!RR.(R
totherRc((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyt__cmp__s6

  	!(RRt__doc__RRR(((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyRs		cKsy|i|}xc|iD]U\}}t||}|||<|idjo |idjo|i|_qqW|S(s
    Obtain a list of available CUPS devices.

    @param connection: CUPS connection
    @type connection: cups.Connection object
    @returns: a list of L{Device} objects
    @raise cups.IPPError: IPP Error
    R(t
getDevicesRDRR.R1(RRtdevicesR]tdatatdevice((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyR s	

 cCsB|i||i||idjo|i|ndS(s
    Set a new printer enabled, accepting jobs, and (if necessary) the
    default printer.

    @param connection: CUPS connection
    @type connection: cups.Connection object
    @param name: printer name
    @type name: string
    @raise cups.IPPError: IPP error
    N(RrRvt
getDefaultRR(RR((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pytactivateNewPrinter1s

csfdfd}x||D]}|idjoq+n|i|i}|os|i|ijo`|i}xT|iD]E}|d|jo.|i|i|td|i|fqqWq+q+WdS(s
    Copy default options between PPDs.

    @param ppd1: source PPD
    @type ppd1: cups.PPD object
    @param ppd2: destination PPD
    @type ppd2: cups.PPD object
    cs5|i}x$|iD]}|i|qW|S(N(Rt	subgroupsR(tgroupRtg(tgetPPDGroupOptions(s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyRLs


c3s4x-|iD]"}x|D]}|VqWq
WdS(N(toptionGroups(tppdRtoption(R(s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pytiteratePPDOptionsRs


t
PageRegiontchoicesset %s = %sN(tkeywordt
findOptiontuit	defchoicetchoicest
markOptionR(tppd1tppd2RRt
new_optionRVR((Rs;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pytcopyPPDOptionsCs	
	
cCsd}ddddddg}x%|D]}||jo
d}q%q%Wy"|id	|td
|Wntd|nXdS(
s
    Set the PPD page size according to locale.

    @param ppd: PPD
    @type ppd: cups.PPD object
    @param language: language, as given by the first element of
    locale.setlocale
    @type language: string
    tA4tCtPOSIXtenten_USten_CAtfr_CAtLettertPageSizesset PageSize = %ss*Failed to set PageSize (%s not available?)N(RR(Rtlanguagetsizetletterteach((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pytsetPPDPageSizebs
cCsdd}g}g}d2}}|id}|o|iidd}|idd}|idd	}|id
d}|idd
jp|idd
jo
d}n|id}x
|D]}	|	iid}
x|
D]}|iid}|d}||}|pPntii	|djovt
|}
d}d}x[||
joI||}|i|o!|t
|}||}Pn|d7}qbWqqW|pPqqWn|p|oti
\}}ti||i|ti|dtiti|d}d}x|iD]q}|i|o[|t
|iid}y|id\}}}Wn
qKnX||d}qKqKWn|o|o|id}|d
jo|| }nhdd6dd6d2d6dd6dd6dd6d d 6d!d"6d#d$6d#d#6d%d%6d&d&6d&d'6d(d(6d)d*6d)d+6d,d-6d,d.6d,d/6d,d06}y||}Wn
d2}nX|o%td1||f|i|q|i|n||fS(3s
    Check that all relevant executables for a PPD are installed.

    @param ppd: PPD
    @type ppd: cups.PPD object
    @returns: string list pair, representing missing packages and
    missing executables
    s
/usr/bin:/binc)SsO|djodS|id}|djo|| }nt|djodS|ddjo?ti|tiotd||Std	|dSn|id
djodS|d3jodSxc|idD]R}|iti	i
ti	i
|}ti|tiotd||SqWtd2||fdS(4Nt-tbuiltint%iittrueRYs	%s: founds
%s: NOT foundt=RZRft[taliastbindtbreaktcdtcontinuetdeclaretechotelsetevaltexectexittexporttfitiftkilltletRtpopdtprintftpushdtpwdtreadtreadonlytsettshifttshopttsourcettesttthenttrapR"tulimittumasktunaliastunsettwaits%s: NOT found in %s('RZRfR
saliasRRRRRRRsevalsexecsexitRRRskillRslocalRRR spwdsreadR#ssetR%R&ssourceR(R)R*stypeR+sumaskR-R.swait(RRR
taccesstX_OKRRR\trstriptpathtsep(RR3tpt	componenttfile((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyt	pathchecks>


#	tFoomaticRIPCommandLines&&
R(s&quot;t"s&lt;t<s&gt;t>t(it&Rt|Ritgsis-sIjsServer=trs*cupsFilter:s+/usr/lib/cups/filter:/usr/lib64/cups/filterR
tghostscripttperlsfoo2oak-wrappertpnm2ppatc2050tc2070tcjettlxtlm1100tmin12xxwsesc-mt	pbm2l2030tpbm2l7ktpbm2lexthpijst
gutenprintsijsgutenprint.5.0sijsgutenprint.5.2sgutenprint-cupssrastertogutenprint.5.0srastertogutenprint.5.2tcommandtoepsontcommandtocanons%s included in package %sN(RtfindAttrRVRkRR\RR
R3tbasenameRRRRRtwriteFdRRRRRR(RR8tpkgs_to_installtexes_to_installtexetexepathtattrtcmdlinetpipestpipetcmdstcmdtargstargntargitsearchtargRRRRtmimetypetcostR5tpkgstpkg((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pytmissingPackagesAndExecutablesys$











cCs<ti}x)t|iD]}|iG|iGHqWdS(N(Rt
ConnectionRt
itervaluesR]R(tcR((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyt_mainst__main__(RtpprintR
RtreRRhR(RRRRRRRRRRhRlR(((s;/usr/lib/python2.6/site-packages/cupshelpers/cupshelpers.pyt<module>sH		A						


Youez - 2016 - github.com/yon3zu
LinuXploit