Use format string for repoweb links

This commit is contained in:
Michal Čihař 2012-02-29 10:03:37 +01:00
parent 2712085c07
commit dd32b9918e

View File

@ -84,6 +84,9 @@ class SubProject(models.Model):
except:
return git.Repo.init(p)
def get_repoweb_link(self, filename, line):
return self.repoweb % {'file': filename, 'line': line}
def configure_repo(self):
'''
Ensures repository is correctly configured and points to current remote.
@ -377,7 +380,7 @@ class Unit(models.Model):
for location in self.location.split(','):
location = location.strip()
filename, line = location.split(':')
link = '%s%s#L%s' % (self.translation.subproject.repoweb, filename, line)
link = self.translation.subproject.get_repoweb_link(filename, line)
ret.append('<a href="%s">%s</a>' % (link, location))
return mark_safe('\n'.join(ret))