Use smart_str more widely with project paths... hopefully this takes

care of the remaining issues
This commit is contained in:
Matthew Jones
2014-12-17 11:06:56 -05:00
parent 844e1b7343
commit edb646fdf9

View File

@@ -162,7 +162,7 @@ class ProjectOptions(models.Model):
results = [] results = []
project_path = self.get_project_path() project_path = self.get_project_path()
if project_path: if project_path:
for dirpath, dirnames, filenames in os.walk(unicode(project_path)): for dirpath, dirnames, filenames in os.walk(smart_str(project_path)):
for filename in filenames: for filename in filenames:
if os.path.splitext(filename)[-1] not in ['.yml', '.yaml']: if os.path.splitext(filename)[-1] not in ['.yml', '.yaml']:
continue continue
@@ -183,7 +183,7 @@ class ProjectOptions(models.Model):
continue continue
if not matched: if not matched:
continue continue
playbook = os.path.relpath(playbook, project_path) playbook = os.path.relpath(playbook, smart_str(project_path))
# Filter files in a roles subdirectory. # Filter files in a roles subdirectory.
if 'roles' in playbook.split(os.sep): if 'roles' in playbook.split(os.sep):
continue continue
@@ -279,7 +279,7 @@ class Project(UnifiedJobTemplate, ProjectOptions):
project_path = self.get_project_path() project_path = self.get_project_path()
if project_path: if project_path:
try: try:
mtime = os.path.getmtime(project_path) mtime = os.path.getmtime(smart_str(project_path))
dt = datetime.datetime.fromtimestamp(mtime) dt = datetime.datetime.fromtimestamp(mtime)
return make_aware(dt, get_default_timezone()) return make_aware(dt, get_default_timezone())
except os.error: except os.error: