Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
ó
½EYc@sÈdZddlZddlZddlZddlZddlZddlZddlmZejƒZ	iddgd6ddgd	6d
ddgd
6dgd6dgd6dgd6ddgd6dgd6dgd6dgd6dgd6dgd 6d!gd"6d#gd$6d%gd&6d'gd(6d)gd*6d+gd,6d-gd.6d/gd06Z
d1„Zd2ejfd3„ƒYZ
eZd4„Zeed5„Zd6efd7„ƒYZed8„Zd9„Zd:„Zd;„ZdS(<so
Base class for holding contextual information of a request

This class has several uses:

* Used for storing security information in a web request.
* Used for passing contextual details to oslo.log.

Projects should subclass this class if they wish to enhance the request
context or provide additional information in their specific WSGI pipeline
or logging context.
iÿÿÿÿN(t
positionaltHTTP_X_AUTH_TOKENtHTTP_X_STORAGE_TOKENt
auth_tokentHTTP_X_USER_IDtHTTP_X_USERtusertHTTP_X_PROJECT_IDtHTTP_X_TENANT_IDt
HTTP_X_TENANTttenanttHTTP_X_USER_DOMAIN_IDtuser_domaintHTTP_X_PROJECT_DOMAIN_IDtproject_domaintHTTP_X_USER_NAMEt	user_nametHTTP_X_PROJECT_NAMEtHTTP_X_TENANT_NAMEtproject_nametHTTP_X_USER_DOMAIN_NAMEtuser_domain_nametHTTP_X_PROJECT_DOMAIN_NAMEtproject_domain_namesopenstack.request_idt
request_idsopenstack.global_request_idtglobal_request_idtHTTP_X_SERVICE_TOKENt
service_tokentHTTP_X_SERVICE_USER_IDtservice_user_idtHTTP_X_SERVICE_USER_NAMEtservice_user_nametHTTP_X_SERVICE_USER_DOMAIN_IDtservice_user_domain_idtHTTP_X_SERVICE_USER_DOMAIN_NAMEtservice_user_domain_nametHTTP_X_SERVICE_PROJECT_IDtservice_project_idtHTTP_X_SERVICE_PROJECT_NAMEtservice_project_namet HTTP_X_SERVICE_PROJECT_DOMAIN_IDtservice_project_domain_idt"HTTP_X_SERVICE_PROJECT_DOMAIN_NAMEtservice_project_domain_namecCsdtjƒS(sGenerate a unique request id.sreq-%s(tuuidtuuid4(((sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pytgenerate_request_idIst_DeprecatedPolicyValuescBseeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z	d„Z
ed	„ƒZRS(
s)A Dictionary that manages current and deprecated policy values.

    Anything added to this dictionary after initial creation is considered a
    deprecated key that we are trying to move services away from. Accessing
    these values as oslo.policy will do will trigger a DeprecationWarning.
    cCs||_i|_dS(N(t_datat_deprecated(tselftdata((sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pyt__init__Vs	cCspy|j|SWntk
r"nXy|j|}Wntk
rGnXtjd|tƒ|St|ƒ‚dS(NsPolicy enforcement is depending on the value of %s. This key is deprecated. Please update your policy file to use the standard policy values.(R0tKeyErrorR1twarningstwarntDeprecationWarning(R2tktval((sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pyt__getitem__Zs

	cCs||j|<dS(N(R1(R2R9tv((sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pyt__setitem__mscCs|j|=dS(N(R1(R2R9((sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pyt__delitem__pscCs
t|jƒS(N(titert_dict(R2((sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pyt__iter__sscCs
t|jƒS(N(tlenR@(R2((sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pyt__len__vscCs
|jjƒS(N(R@t__str__(R2((sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pyRDyscCs
|jjƒS(N(R@t__repr__(R2((sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pyRE|scCs#|jjƒ}|j|jƒ|S(N(R1tcopytupdateR0(R2td((sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pyR@s(
t__name__t
__module__t__doc__R4R;R=R>RARCRDREtpropertyR@(((sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pyR/Ns								cCsS|rOd}|i|d6|d6}trOtj|dddddd	ƒqOndS(
Ns3Property '%(old_name)s' has moved to '%(new_name)s'told_nametnew_nametversions2.6tremoval_versions3.0t
stackleveli(t_log_deprecation_warningst
debtcollectort	deprecate(RNRMtdeprecated_msg((sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pyt
_moved_msgŠs
cs^ˆsˆ‰n‡‡‡fd†}‡‡‡fd†}‡‡‡fd†}t|||ƒS(Ncstˆˆƒt|ˆƒS(N(RVtgetattr(R2(RNRMttarget(sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pytgetters
cs!tˆˆƒt|ˆ|ƒdS(N(RVtsetattr(R2tvalue(RNRMRX(sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pytsetter¡s
cstˆˆƒt|ˆƒdS(N(RVtdelattr(R2(RNRMRX(sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pytdeleter¥s
(RL(RNRMRXRYR\R^((RNRMRXsI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pyt_moved_property˜s	tRequestContextc BseZdZdZedejƒddddddeeeddeddddddedddddddddddd„ƒZ	e
ddddƒZe
dd	dd
ƒZe
dddd
ƒZ
e
ddddƒZe
ddddƒZe
d
ƒZe
dƒZe
d
ƒZe
dƒZe
dƒZd„Zd„Zd„Zd„Zed„ƒZed„ƒZed„ƒZRS(sÖHelper class to represent useful information about a request context.

    Stores information about the security context under which the user
    accesses the system, as well as additional request information.
    u1{user} {tenant} {domain} {user_domain} {p_domain}tenforcementcCsD||_||_||_||_||_||_||_||_||_||_	||_
||_||_||_
|	|_||_|
p™g|_||_||_||_||_||_||_||_||_||_|pùg|_|
stƒ}
n|
|_||_|s3tƒr@|jƒndS(s·Initialize the RequestContext

        :param overwrite: Set to False to ensure that the greenthread local
                          copy of the index is not overwritten.
        :param is_admin_project: Whether the specified project is specified in
                                 the token as the admin project. Defaults to
                                 True for backwards compatibility.
        :type is_admin_project: bool
        N( t_user_idt_project_idt
_domain_idt_user_domain_idt_project_domain_idRRRtdomain_nameRRtis_admintis_admin_projectt	read_onlytshow_deletedt
resource_uuidtrolesRRRR!R#R%R'R)R+t
service_rolesR.RRtget_currenttupdate_store(R2RRR
tdomainRRRhRjRkRRlt	overwriteRmRRRgRRRiRRRR!R#R%R'R)R+RnR((sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pyR4¶sB*																											t
project_idR
RXRctuser_idRRbt	domain_idRqRdtuser_domain_idRRetproject_domain_idRRfcCs
|t_dS(s(Store the context in the current thread.N(t_request_storetcontext(R2((sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pyRpscCsxti|jd6|jd6|jd6|jd6|jd6|jd6|jd6|jd6|j	d	6|j
d
6|jd6ƒS(sA dictionary of context attributes to enforce policy with.

        oslo.policy enforcement requires a dictionary of attributes
        representing the current logged in user on which it applies policy
        enforcement. This dictionary defines a standard list of attributes that
        should be available for enforcement across services.

        It is expected that services will often have to override this method
        with either deprecated values or additional attributes used by that
        service specific policy.
        RtRvRsRwRmRiRR!R%R)Rn(R/RtRvRsRwRmRiRR!R%R)Rn(R2((sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pytto_policy_valuess









cCsñ|jjd|jpdd|jp'dd|jp6dd|jpEdd|jpTdƒ}i|jd6|jd6|jd6|jd6|jd6|jd6|jd	6|j	d
6|j
d6|jd6|jd
6|j
d6|jd6|d6|jd6S(s*Return a dictionary of context attributes.Rt-R
RqRtp_domainRRhRjRkRRRRlRmt
user_identityRi(tuser_idt_formattformatRtRsRuRvRwRhRjRkRRRRlRmRi(R2tuser_idt((sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pytto_dict9s*












cCsOi|jd6|jd6|jd6|jd6|jd6}|j|jƒƒ|S(s;Return a dictionary of logging specific context attributes.RRRgRR(RRRgRRRGR(R2tvalues((sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pytget_logging_valuesRs




cCs|jp|jS(sReturn a sensible value for global_id to pass on.

        When we want to make a call with to another service, it's
        important that we try to use global_request_id if available,
        and fall back to the locally generated request_id if not.
        (RR(R2((sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pyt	global_id\scKsñ|jd|jdƒƒ|jd|jdƒƒ|jd|jdƒƒ|jd|jdƒƒ|jd|jdƒƒ|jd|jdƒƒ|jd|jdtƒƒ|jd|jdtƒƒ|jd	|jd	tƒƒ|jd
|jd
ƒƒ|jd|jdƒƒ|jd|jdƒƒ|jd
|jd
ƒƒ|jd|jdƒƒ|jd|jdƒƒ|jd|jdƒƒ|jd|jdƒƒ|jd|jdƒƒ|jd|jdtƒƒ||S(s6Construct a context object from a provided dictionary.RRR
RqRRRhRjRkRRRlRmRRRgRRRi(t
setdefaulttgettFalsetTrue(tclsR‚tkwargs((sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pyt	from_dictfs,		c	Kscx[tjƒD]M\}}||kr+q
nx,|D]$}||kr2||||<Pq2q2Wq
Wd|krÆ|jd|jdƒƒ}|r³g|jdƒD]}|jƒ^q›ng}||d<nd|kr"|jdƒ}|rg|jdƒD]}|jƒ^q÷ng}||d<nd|krY|jdd	ƒ}|jƒd	k|d<n||S(
sLoad a context object from a request environment.

        If keyword arguments are provided then they override the values in the
        request environment.

        :param environ: The environment dictionary associated with a request.
        :type environ: dict
        RmtHTTP_X_ROLEStHTTP_X_ROLEt,RntHTTP_X_SERVICE_ROLESRitHTTP_X_IS_ADMIN_PROJECTttrue(t_ENVIRON_HEADERStitemsR†tsplittstriptlower(	R‰tenvironRŠR9tv_listR<Rmtrtis_admin_proj_str((sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pytfrom_environ€s&
4
4
N(RIRJRKR~RtWARNtNoneR‡RˆR4R_R
RRqRRRtRsRuRvRwRpRzRRƒRLR„tclassmethodR‹R›(((sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pyR`¬sl3						

c
Cs(tddddtd|dtƒ}|S(s Create an administrator context.R
RhRkRrN(R`RRˆR‡(RkRy((sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pytget_admin_context¬s		cCs:x3tj|jƒ|ƒD]}t|tƒr|SqWdS(sªFind an arg of type RequestContext and return it.

       This is useful in a couple of decorators where we don't
       know much about the function we're wrapping.
    N(t	itertoolstchainR‚t
isinstanceR`R(tfunctiontargsRŠtarg((sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pyt"get_context_from_function_and_args¶scCs,|st|tƒrtS|jr(tStS(s2Indicates if the request context is a normal user.(R¢R`R‡RhRˆ(Ry((sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pytis_user_contextÄs
	cCsttddƒS(sQReturn this thread's current context

    If no context is set, returns None
    RyN(RWRxR(((sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pyRoÍs(RKtcollectionsR t	threadingR,R6RSRtlocalRxR’R.tMutableMappingR/R‡RRRVRR_tobjectR`RŸR¦R§Ro(((sI/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_context/context.pyt<module>sZ



















	9	ÿ