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
ba0cf42c
Commit
ba0cf42c
authored
Sep 09, 2015
by
Marius Gedminas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Python 3: use six.string_types instead of basestring
Reduces the number of failing tests from 35 to 17.
parent
3a50393c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
lib/ansible/template/__init__.py
+3
-2
No files found.
lib/ansible/template/__init__.py
View file @
ba0cf42c
...
@@ -22,6 +22,7 @@ __metaclass__ = type
...
@@ -22,6 +22,7 @@ __metaclass__ = type
import
ast
import
ast
import
re
import
re
from
six
import
string_types
from
jinja2
import
Environment
from
jinja2
import
Environment
from
jinja2.loaders
import
FileSystemLoader
from
jinja2.loaders
import
FileSystemLoader
from
jinja2.exceptions
import
TemplateSyntaxError
,
UndefinedError
from
jinja2.exceptions
import
TemplateSyntaxError
,
UndefinedError
...
@@ -227,7 +228,7 @@ class Templar:
...
@@ -227,7 +228,7 @@ class Templar:
if
convert_bare
:
if
convert_bare
:
variable
=
self
.
_convert_bare_variable
(
variable
)
variable
=
self
.
_convert_bare_variable
(
variable
)
if
isinstance
(
variable
,
basestring
):
if
isinstance
(
variable
,
string_types
):
result
=
variable
result
=
variable
if
self
.
_contains_vars
(
variable
):
if
self
.
_contains_vars
(
variable
):
...
@@ -289,7 +290,7 @@ class Templar:
...
@@ -289,7 +290,7 @@ class Templar:
in jinja2 variable braces so that it is evaluated properly.
in jinja2 variable braces so that it is evaluated properly.
'''
'''
if
isinstance
(
variable
,
basestring
):
if
isinstance
(
variable
,
string_types
):
contains_filters
=
"|"
in
variable
contains_filters
=
"|"
in
variable
first_part
=
variable
.
split
(
"|"
)[
0
]
.
split
(
"."
)[
0
]
.
split
(
"["
)[
0
]
first_part
=
variable
.
split
(
"|"
)[
0
]
.
split
(
"."
)[
0
]
.
split
(
"["
)[
0
]
if
(
contains_filters
or
first_part
in
self
.
_available_variables
)
and
self
.
environment
.
variable_start_string
not
in
variable
:
if
(
contains_filters
or
first_part
in
self
.
_available_variables
)
and
self
.
environment
.
variable_start_string
not
in
variable
:
...
...
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