diff --git a/apps/humans/models.py b/apps/humans/models.py index b3a56b3787e..1f8fa0c5dc0 100644 --- a/apps/humans/models.py +++ b/apps/humans/models.py @@ -1,6 +1,7 @@ import json import urllib from django.conf import settings +import subprocess GITHUB_REPOS = "https://api.github.com/repos/mozilla/kuma/contributors" @@ -14,20 +15,23 @@ def __init__(self): class HumansTXT: def generate_file(self): githubbers = self.get_github(json.load(urllib.urlopen(GITHUB_REPOS))) + localizers = self.get_mdn() target = open("%s/humans.txt" % settings.HUMANSTXT_ROOT, 'w') - self.write_to_file(githubbers, target, "Contributors on Github") + self.write_to_file(githubbers, target, "Contributors on Github", "Developer") + self.write_to_file(localizers, target, "Localization Contributors", "Localizer") target.close() - def write_to_file(self, humans, target, message): + def write_to_file(self, humans, target, message, role): target.write("%s \n" % message) for h in humans: - target.write("Developer: %s \n" % h.name.encode('ascii', 'ignore')) + target.write("%s: %s \n" % (role, h.name.encode('ascii', 'ignore'))) if(h.website != None): target.write("Website: %s \n" % h.website) - target.write('\n') + target.write('\n') + target.write('\n') def get_github(self, data=None): if not data: @@ -51,3 +55,15 @@ def get_github(self, data=None): humans.append(human) return humans + + def get_mdn(self): + p = subprocess.Popen("svn log --quiet http://svn.mozilla.org/projects/mdn/trunk/locale/ | grep '^r' | awk '{print $3}' | sort | uniq",shell=True,stdout=subprocess.PIPE) + localizers_list = p.communicate()[0].rstrip().split('\n', -1) + + humans = [] + for localizer in localizers_list: + human = Human() + human.name = localizer + humans.append(human) + + return humans