Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
95a58d11
Commit
95a58d11
authored
Sep 10, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly serialize UnsafeProxy objects
Required as part of fix for #12123
parent
a410bf26
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
7 deletions
+20
-7
lib/ansible/vars/unsafe_proxy.py
+20
-7
No files found.
lib/ansible/vars/unsafe_proxy.py
View file @
95a58d11
...
...
@@ -61,13 +61,22 @@ class UnsafeProxy(object):
def
__getattribute__
(
self
,
name
):
if
name
==
'_obj'
:
return
object
.
__getattribute__
(
self
,
"_obj"
)
elif
name
==
'__reduce_ex__'
:
return
object
.
__getattribute__
(
self
,
"__reduce_ex__"
)
elif
name
==
'__UNSAFE__'
:
return
True
else
:
return
getattr
(
object
.
__getattribute__
(
self
,
"_obj"
),
name
)
def
__eq__
(
self
,
obj
):
'''
special handling for == due to the fact that int objects do
not define it, so trying to guess whether we should or should
not override object.__eq__ with the wrapped classes version
causes problems
'''
return
object
.
__getattribute__
(
self
,
"_obj"
)
==
obj
def
__delattr__
(
self
,
name
):
delattr
(
object
.
__getattribute__
(
self
,
"_obj"
),
name
)
def
__setattr__
(
self
,
name
,
value
):
...
...
@@ -76,12 +85,17 @@ class UnsafeProxy(object):
def
__nonzero__
(
self
):
return
bool
(
object
.
__getattribute__
(
self
,
"_obj"
))
def
__str__
(
self
):
#import epdb; epdb.st()
return
str
(
object
.
__getattribute__
(
self
,
"_obj"
))
def
__unicode__
(
self
):
#import epdb; epdb.st()
return
unicode
(
object
.
__getattribute__
(
self
,
"_obj"
))
def
__repr__
(
self
):
return
repr
(
object
.
__getattribute__
(
self
,
"_obj"
))
def
__reduce_ex__
(
self
,
protocol
):
return
(
UnsafeProxy
,
(
self
.
_obj
,))
#
# factories
#
...
...
@@ -94,12 +108,11 @@ class UnsafeProxy(object):
'__imul__'
,
'__int__'
,
'__invert__'
,
'__ior__'
,
'__ipow__'
,
'__irshift__'
,
'__isub__'
,
'__iter__'
,
'__itruediv__'
,
'__ixor__'
,
'__le__'
,
'__len__'
,
'__long__'
,
'__lshift__'
,
'__lt__'
,
'__mod__'
,
'__mul__'
,
'__ne__'
,
'__neg__'
,
'__oct__'
,
'__or__'
,
'__pos__'
,
'__pow__'
,
'__radd__'
,
'__rand__'
,
'__rdiv__'
,
'__rdivmod__'
,
'__reduce__'
,
'__reduce_ex__'
,
'__repr__'
,
'__reversed__'
,
'__rfloordiv__'
,
'__rlshift__'
,
'__rmod__'
,
'__rmul__'
,
'__ror__'
,
'__rpow__'
,
'__rrshift__'
,
'__rshift__'
,
'__rsub__'
,
'__rtruediv__'
,
'__rxor__'
,
'__setitem__'
,
'__setslice__'
,
'__sub__'
,
'__truediv__'
,
'__xor__'
,
'next'
,
'__neg__'
,
'__oct__'
,
'__or__'
,
'__pos__'
,
'__pow__'
,
'__radd__'
,
'__rand__'
,
'__rdiv__'
,
'__rdivmod__'
,
'__repr__'
,
'__reversed__'
,
'__rfloordiv__'
,
'__rlshift__'
,
'__rmod__'
,
'__rmul__'
,
'__ror__'
,
'__rpow__'
,
'__rrshift__'
,
'__rshift__'
,
'__rsub__'
,
'__rtruediv__'
,
'__rxor__'
,
'__setitem__'
,
'__setslice__'
,
'__sub__'
,
'__truediv__'
,
'__xor__'
,
'next'
,
]
@classmethod
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment