Skip to content

Commit 32e4933

Browse files
Stop using str.replace in Version.get_conf_py_path
1 parent 7aca48e commit 32e4933

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

readthedocs/builds/models.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,12 @@ def get_downloads(self, pretty=False):
184184
return data
185185

186186
def get_conf_py_path(self):
187-
conf_py_path = self.project.conf_file(self.slug)
188-
conf_py_path = conf_py_path.replace(
189-
self.project.checkout_path(self.slug), '')
190-
return conf_py_path.replace('conf.py', '')
187+
conf_py_path = self.project.conf_dir(self.slug)
188+
if not conf_py_path.endswith('/'):
189+
conf_py_path += '/'
190+
checkout_prefix = self.project.checkout_path(self.slug)
191+
conf_py_path = conf_py_path[len(checkout_prefix):]
192+
return conf_py_path
191193

192194
def get_build_path(self):
193195
'''Return version build path if path exists, otherwise `None`'''

0 commit comments

Comments
 (0)