ó –­PSc@s²dZddlZddlZddlmZmZddlZddljZddl j Z ddl j Z ddl Z ddlZddlmZdejfd„ƒYZdS(s=module describing a license packaging object This module contains the LicenseAction class, which represents a license packaging object. This contains a payload of the license text, and a single attribute, 'license', which is the name of the license. Licenses are installed on the system in the package's directory.iÿÿÿÿN(tS_IWRITEtS_IREAD(tActionExecutionErrort LicenseActioncBsÏeZdZdgZdZdZdZdZeZ eZ e j eZ eZdd„Zd„Zd„Zd„Zd„Zd„Zd „Zdd „Zd „Zed „ƒZed „ƒZdd„ZRS(s.Class representing a license packaging object.thashtlicensecKs#tjj|||d|_dS(NtNOHASH(tgenerictActiont__init__R(tselftdatatattrs((s9/usr/lib/python2.7/vendor-packages/pkg/actions/license.pyR >scCs[tjtjj|jj|jƒdtj |j ddƒƒ|jj ƒƒ|j d}|dkr›qƒn|j|}|jd||dfƒqƒW|S(swGenerates the indices needed by the search dictionary. See generic.py for a more detailed explanation.RRtcontentN(treverse_indicesR tNonethasattrRMRR.tDEFAULT_HASH_ATTRS(R tidxtindicestattrR((s9/usr/lib/python2.7/vendor-packages/pkg/actions/license.pytgenerate_indices¯s,  c Cs%|j||ƒ}tj|ƒ\}}}yet|dƒP}tj|ƒj} tj|d| dt d|ƒ\} } | |krˆ| SWdQXWn+t k r¼} | j t j kr½‚q½nXzV|sÛ|j |jƒ}n|j|jksót‚|jj||d|d|ƒSWd|jƒXdS(suRetrieves and returns the payload of the license (which should be text). This may require remote retrieval of resources and so this could raise a TransportError or other ApiException. 'alt_pub' is an optional alternate Publisher to use for any required transport operations. trbtlengthtreturn_contentRNR(tget_local_pathR.tget_least_preferred_hashtopenRtstattst_sizeRRJRFRKR:RLt get_publishert publishertprefixtAssertionErrort transportt get_contenttcleanup_downloads( R RNROtalt_pubRR@t hash_attr_valRtfhRcRSttxtRC((s9/usr/lib/python2.7/vendor-packages/pkg/actions/license.pytget_textÀs(     cCst|jdkr;tjj|j|ƒd|jdƒ}n5tjj|j|ƒdtj|jddƒƒ}|S(szReturn an opener for the license text from the local disk or None if the data for the text is not on-disk.islicense.RR (tversionRRRRR RR(R RNROR((s9/usr/lib/python2.7/vendor-packages/pkg/actions/license.pyReäs cCs|jjddƒjƒdkS(s}Returns a boolean value indicating whether this license action requires acceptance of its payload by clients.s must-acceptR ttrue(R tgettlower(R ((s9/usr/lib/python2.7/vendor-packages/pkg/actions/license.pyt must_acceptõscCs|jjddƒjƒdkS(sReturns a boolean value indicating whether this license action requires its payload to be displayed by clients.s must-displayR Rw(R RxRy(R ((s9/usr/lib/python2.7/vendor-packages/pkg/actions/license.pyt must_displayüsc Cs&tjj|d|dd dd ƒd S( s9Performs additional validation of action attributes that for performance or other reasons cannot or should not be done during Action object creation. An ActionError exception (or subclass of) will be raised if any attributes are not valid. This is primarily intended for use during publication or during error handling to provide additional diagonostics. 'fmri' is an optional package FMRI (object or string) indicating what package contained this action.Rt numeric_attrss pkg.csizespkg.sizet single_attrsRSs must-accepts must-displayN(s pkg.csizespkg.size(schashs must-accepts must-display(RRt _validate(R R((s9/usr/lib/python2.7/vendor-packages/pkg/actions/license.pytvalidates (slicense(slicenseN(t__name__t __module__t__doc__t __slots__tnametkey_attrt unique_attrsRZRFt refcountabletglobally_identicalRt _orderdictt ordinalityt has_payloadR[R RRERGRURXRaRuRetpropertyRzR{R(((s9/usr/lib/python2.7/vendor-packages/pkg/actions/license.pyR/s,     5    $ (R‚R:RRhRRRt pkg.digestR.tpkg.miscRt pkg.portableR7RR1tpkg.client.api_errorsRRR(((s9/usr/lib/python2.7/vendor-packages/pkg/actions/license.pyt s