Commit 124e39ca authored by Stéphane Raimbault's avatar Stéphane Raimbault

White spaces cleanup in all Python files

- removed trailing spaces
- removed spaces on empty line
- removed empty lines at EOF
- potdiff.py is executable
parent 4da996ca
......@@ -19,9 +19,8 @@
# along with Damned Lies; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from django import template
register = template.Library()
class SplitListNode(template.Node):
......@@ -31,10 +30,10 @@ class SplitListNode(template.Node):
self.new_list = new_list
def split_seq(self, list, cols=2):
start = 0
for i in xrange(cols):
stop = start + len(list[i::cols])
yield list[start:stop]
start = 0
for i in xrange(cols):
stop = start + len(list[i::cols])
yield list[start:stop]
start = stop
def render(self, context):
......
......@@ -97,7 +97,7 @@ def imerge_sorted_by_field(object_list1, object_list2, field):
[6, 5, 4, 4, 4, 2, 1, 1]
"""
import operator
if field is not None and field[0] == '-':
# Reverse the sort order
field = field[1:]
......@@ -106,7 +106,7 @@ def imerge_sorted_by_field(object_list1, object_list2, field):
op = operator.lt
iter1, iter2 = iter(object_list1), iter(object_list2)
# Too many try/except couples to my taste but I don't know how to filter the
# StopIteration to find the source.
......
......@@ -27,7 +27,7 @@ from django.contrib.auth import login, authenticate, logout
from django.conf import settings
from people.models import Person
from teams.models import Role
from people.forms import RegistrationForm
from people.forms import RegistrationForm
def index(request):
......@@ -115,4 +115,3 @@ def activate_account(request, key):
person.activate()
Person.clean_unactivated_accounts()
return site_login(request, msgs=[_("Your account has been activated.")])
......@@ -19,24 +19,24 @@ class Language(models.Model):
return _(self.name)
else:
return self.locale
def bugs_url_enter(self):
return "http://bugzilla.gnome.org/enter_bug.cgi?product=l10n&component=%s%%20[%s]" % (self.name, self.locale)
def bugs_url_show(self):
return "http://bugzilla.gnome.org/buglist.cgi?product=l10n&component=%s%%20[%s]&bug_status=NEW&bug_status=REOPENED&bug_status=ASSIGNED&bug_status=UNCONFIRMED" % (self.name, self.locale)
return "http://bugzilla.gnome.org/buglist.cgi?product=l10n&component=%s%%20[%s]&bug_status=NEW&bug_status=REOPENED&bug_status=ASSIGNED&bug_status=UNCONFIRMED" % (self.name, self.locale)
def get_release_stats(self):
# FIXME Here be dragons
""" Get summary stats for all releases """
from stats.models import Release
releases = Release.objects.all().order_by('status', '-name')
stats = []
for rel in releases:
stats.append(rel.total_for_lang(self))
return stats
def get_team_url(self):
if self.team:
return self.team.get_absolute_url()
......
......@@ -90,7 +90,7 @@ def language_release_tar(request, locale, release_name, dtype):
for f in file_list:
tar_file.add(f, os.path.basename(f))
tar_file.close()
return HttpResponseRedirect("/POT/tar/%s" % tar_filename)
def language_release_xml(request, locale, release_name):
......@@ -141,7 +141,7 @@ def language_release_xml(request, locale, release_name):
content += "</module>"
except:
pass
if catname != 'default':
content += "</category>"
content += "</stats>"
......
......@@ -21,7 +21,7 @@ class RegistrationForm(forms.Form):
help_text=ugettext_lazy(u'At least 7 characters'))
password2 = forms.CharField(widget=forms.PasswordInput(render_value=False),
label=ugettext_lazy(u'Confirm password:'), required=False)
def clean_username(self):
""" Validate the username (correctness and uniqueness)"""
try:
......@@ -37,7 +37,7 @@ class RegistrationForm(forms.Form):
openid_url = cleaned_data.get('openid_url')
if not password1 and not openid_url:
raise forms.ValidationError(_(u'You must either provide an OpenID or a password'))
if password1 and password1 != password2:
raise forms.ValidationError(_(u'The passwords do not match'))
return cleaned_data
......@@ -64,7 +64,7 @@ class RegistrationForm(forms.Form):
current_site = Site.objects.get_current()
subject = settings.EMAIL_SUBJECT_PREFIX + _(u'Account activation')
message = _(u"This is a confirmation that your registration on %s succeeded. To activate your account, please click on the link below or copy and paste it in a browser.") % current_site.name
message += "\n\nhttp://%s%s\n\n" % (current_site.domain, str(reverse("register_activation", kwargs={'key': activation_key})))
message += "\n\nhttp://%s%s\n\n" % (current_site.domain, str(reverse("register_activation", kwargs={'key': activation_key})))
message += _(u"Administrators of %s" % current_site.name)
send_mail(subject, message, settings.DEFAULT_FROM_EMAIL,
......
......@@ -50,7 +50,7 @@ class Person(User):
@classmethod
def clean_unactivated_accounts(cls):
accounts = cls.objects.filter(activation_key__isnull=False,
accounts = cls.objects.filter(activation_key__isnull=False,
date_joined__lt=(datetime.datetime.now()-datetime.timedelta(days=10))).exclude(activation_key='')
for account in accounts:
account.delete()
......@@ -60,12 +60,12 @@ class Person(User):
self.password = None
self.set_unusable_password()
super(User, self).save()
def activate(self):
self.activation_key = None
self.is_active = True
self.save()
def no_spam_email(self):
return obfuscate_email(self.email)
......@@ -96,7 +96,7 @@ class Person(User):
return True
except:
return False
def is_committer(self, team):
try:
self.role_set.get(team__id=team.id, role__in=['committer', 'coordinator'])
......
......@@ -24,4 +24,3 @@ urlpatterns = patterns('people.views',
urlpatterns += patterns('django.views.generic.list_detail',
url(r'^$', 'object_list', dict(info_dict_list), name='persons-view'),
)
......@@ -99,7 +99,7 @@ def person_team_join(request):
context_instance = RequestContext(request)
transaction.commit()
return render_to_response('people/person_team_join_form.html', context,
return render_to_response('people/person_team_join_form.html', context,
context_instance=context_instance)
@login_required
......@@ -114,7 +114,7 @@ def person_team_leave(request, team_slug):
# Message no i18n'ed, should never happen under normal conditions
person.message_set.create(message="You are not a member of this team.")
# redirect to normal person detail
return HttpResponseRedirect(urlresolvers.reverse('person-username-view',
return HttpResponseRedirect(urlresolvers.reverse('person-username-view',
args=(person.username,)))
@login_required
......@@ -138,4 +138,3 @@ def person_password_change(request):
}
return render_to_response('people/person_password_change_form.html', context,
context_instance=RequestContext(request))
......@@ -33,7 +33,7 @@ DATABASE_PORT = '' # Set to empty string for default. Not used with
# 'read_default_file': '/etc/mysql/my.cnf',
# 'init_command': 'SET storage_engine=INNODB'
# }
#
#
# Please refer to the README file to create an UTF-8 database with MySQL.
EMAIL_HOST = 'localhost'
......@@ -140,5 +140,5 @@ if USE_DJANGO_EVOLUTION:
INSTALLED_APPS += ('django_evolution',)
if USE_DEBUG_TOOLBAR:
MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
INSTALLED_APPS += ('debug_toolbar',)
......@@ -36,7 +36,7 @@ class ModuleAdmin(admin.ModelAdmin):
fieldsets = (
(None, {
'fields': (('name','description'),
'homepage', 'comment',
'homepage', 'comment',
('bugs_base', 'bugs_product', 'bugs_component'),
('vcs_type', 'vcs_root', 'vcs_web'),
'maintainers')
......
......@@ -28,7 +28,7 @@ class ModuleBranchForm(forms.Form):
label=branch.name)
self.fields[branch.name+'_cat'] = forms.ChoiceField(choices=CATEGORY_CHOICES)
self.branch_fields.append((branch.name, branch.name+'_cat'))
self.fields['new_branch'] = forms.CharField(required=False)
self.fields['new_branch_release'] = ReleaseField(queryset=Release.objects.all())
self.fields['new_branch_category'] = forms.ChoiceField(choices=CATEGORY_CHOICES)
......@@ -36,4 +36,3 @@ class ModuleBranchForm(forms.Form):
def get_branches(self):
for rel_field, cat_field in self.branch_fields:
yield (self[rel_field], self[cat_field])
......@@ -6,7 +6,7 @@ import shutil
class Command(NoArgsCommand):
help = "Compile translations of djamnedlies"
args = ""
output_transaction = False
def handle(self, **options):
......@@ -20,7 +20,6 @@ class Command(NoArgsCommand):
if not os.path.isdir(localedir):
os.makedirs(localedir)
shutil.copy(os.path.join(podir, pofile), os.path.join(localedir, 'django.po'))
# Run compilemessages -l ll
compilemessages.compile_messages()
......@@ -24,7 +24,7 @@ from stats.models import Release, Category, Module
class Command(BaseCommand):
help = "Copy an existing release and use trunk branches"
args = "RELEASE_TO_COPY, NEW_RELEASE"
output_transaction = False
def handle(self, *args, **options):
......@@ -35,10 +35,10 @@ class Command(BaseCommand):
rel_to_copy = Release.objects.get(name=args[0])
except:
raise CommandError("No release named '%s'" % args[0])
new_rel = Release(name=args[1], description=args[1], string_frozen=False, status=rel_to_copy.status)
new_rel.save()
for cat in rel_to_copy.category_set.all():
if not cat.branch.is_head():
mod = Module.objects.get(pk=cat.branch.module.id)
......@@ -46,6 +46,5 @@ class Command(BaseCommand):
else:
branch = cat.branch
new_rel.category_set.add(Category(release=new_rel, branch=branch, name=cat.name))
print "New release '%s' created" % args[1]
print "New release '%s' created" % args[1]
......@@ -15,12 +15,12 @@ class Command(BaseCommand):
old_branch_dirs = []
for branch in module.branch_set.all():
old_branch_dirs.append(branch.co_path())
module.vcs_type = "git"
module.vcs_root = "git://git.gnome.org/%s" % module.name
module.vcs_web = "http://git.gnome.org/cgit/%s/" % module.name
module.save()
# Checkout new git repo with master branch
head_branch = Branch.objects.get(module__name=module.name, name='HEAD')
head_branch.name = "master"
......@@ -29,7 +29,7 @@ class Command(BaseCommand):
except Exception, e:
print "Unable to save master branch for module '%s': %s" % (module.name, e)
continue
for branch in module.branch_set.exclude(name='master'):
# Checkout branch (other than master)
cmd = "cd \"%(localdir)s\" && git checkout --track -b %(branch)s origin/%(branch)s" % {
......@@ -42,8 +42,7 @@ class Command(BaseCommand):
print "Unable to checkout branch '%s' of module '%s': %s" % (branch.name, module.name, e)
continue
branch.update_stats(force=False)
# delete old checkouts
for branch_dir in old_branch_dirs:
shutil.rmtree(branch_dir)
......@@ -8,13 +8,13 @@ from stats.models import Module, Branch
class Command(BaseCommand):
help = "Update statistics about po file"
args = "[MODULE [BRANCH]]"
option_list = BaseCommand.option_list + (
make_option('--force', action='store_true', dest='force', default=False,
help="force statistics generation, even if files didn't change"),
make_option('--non-gnome', action='store_true', dest='non-gnome', default=False,
help="generate statistics for non-gnome modules (externally hosted)"),
)
)
output_transaction = False
......@@ -41,7 +41,7 @@ class Command(BaseCommand):
print >> sys.stderr, "Error during updating, mail sent to admins"
finally:
self.release_lock_for_module(module_arg, branch_arg)
elif len(args) == 1:
# Update all branches of a module
module_arg = args[0]
......@@ -51,7 +51,7 @@ class Command(BaseCommand):
try:
self.get_lock_for_module(module_arg, branch.name)
branch.update_stats(options['force'])
except:
except:
print "Error while updating stats for %s (branch '%s')" % (module_arg, branch.name)
finally:
self.release_lock_for_module(module_arg, branch.name)
......@@ -74,7 +74,7 @@ class Command(BaseCommand):
self.release_lock_for_module(mod.name, branch.name)
return "Update completed."
# Weird things happen when multiple updates run in parallel for the same module
# We use filesystem directories creation/deletion to act as global lock mecanism
def get_lock_for_module(self, module_name, branch_name):
......@@ -90,4 +90,3 @@ class Command(BaseCommand):
def release_lock_for_module(self, module_name, branch_name):
dirpath = os.path.join("/tmp", "updating-%s" % (module_name,))
os.rmdir(dirpath)
......@@ -9,11 +9,11 @@ from django.conf import settings
class Command(BaseCommand):
help = "Update translations of djamnedlies ('en' is a special case, and generate damned-lies.pot)"
args = "LANG_CODE"
#option_list = BaseCommand.option_list + (
# make_option('--pot', action='store_true', dest='pot', default=False,
# help="create a pot file"),
#)
#)
output_transaction = False
......@@ -33,15 +33,15 @@ class Command(BaseCommand):
shutil.copy(pofile, os.path.join(localedir, 'django.po'))
else:
pofile = os.path.join(podir, 'damned-lies.pot')
# Extract DB translatable strings into database-content.py
dbfile = os.path.join(os.path.abspath('.'), 'database-content.py')
f=open(dbfile, 'w')
query = """SELECT description FROM team UNION
SELECT name from language WHERE name <> locale UNION
SELECT description FROM domain UNION
SELECT description FROM module WHERE description <> name UNION
SELECT comment FROM module WHERE comment IS NOT NULL AND comment <> '' UNION
query = """SELECT description FROM team UNION
SELECT name from language WHERE name <> locale UNION
SELECT description FROM domain UNION
SELECT description FROM module WHERE description <> name UNION
SELECT comment FROM module WHERE comment IS NOT NULL AND comment <> '' UNION
SELECT description FROM "release" """
cursor = connection.cursor()
if settings.DATABASE_ENGINE == 'mysql':
......@@ -54,13 +54,11 @@ class Command(BaseCommand):
# Run makemessages -l ll
makemessages.make_messages(lang_code, verbosity=2, extensions=['.html'])
# Delete database-content.py
os.unlink(dbfile)
# Copy locale/ll/LC_MESSAGES/django.po to po/ll.po
shutil.copy(os.path.join(localedir, 'django.po'), pofile)
return "po file for language '%s' updated." % lang_code
return "po file for language '%s' updated." % lang_code
This diff is collapsed.
......@@ -76,7 +76,7 @@ def _parse_contents(contents):
if len(contents) and contents[-1] != "\n": contents += "\n"
# state machine for parsing PO files
msgid = ""; msgstr = ""; msgctxt = ""; comment = ""; plural = "";
msgid = ""; msgstr = ""; msgctxt = ""; comment = ""; plural = "";
in_msgid = in_msgstr = in_msgctxt = in_msgid_plural = in_plural = 0
result = []
......@@ -90,7 +90,7 @@ def _parse_contents(contents):
if line == "":
if in_msgstr and msgid != "":
onemsg = ""
if msgctxt: onemsg += ('"' + msgctxt + '"::')
onemsg += ('"' + msgid + '"')
if plural: onemsg += ('/"' + plural + '"')
......@@ -148,4 +148,3 @@ def _parse_contents(contents):
if __name__ == "__main__":
import sys
print "\n".join(diff(sys.argv[1], sys.argv[2]))
import django.dispatch
pot_has_changed = django.dispatch.Signal(providing_args=["potfile", "branch", "domain"])
......@@ -4,7 +4,7 @@ register = template.Library()
@register.filter
def linked_with(value, arg):
""" This filter returns an object (passed in value) enclosed with his absolute url
""" This filter returns an object (passed in value) enclosed with his absolute url
arg is the linked text """
return "<a href='%s'>%s</a>" % (value.get_absolute_url(), arg)
......@@ -24,13 +24,13 @@ class IfLessNode(template.Node):
self.val2 = val2
self.nodelist_true = nodelist_true
self.nodelist_false = nodelist_false
def render(self, context):
if self.val1.resolve(context) < self.val2.resolve(context):
return self.nodelist_true.render(context)
else:
return self.nodelist_false.render(context)
@register.tag
def ifless(parser, token):
bits = list(token.split_contents())
......
......@@ -30,9 +30,9 @@ class ModuleTestCase(unittest.TestCase):
path = os.path.join(settings.SCRATCHDIR, 'git', 'gnome-hello')
if os.access(path, os.X_OK):
shutil.rmtree(path)
def setUp(self):
# TODO: load bulk data from fixtures
# TODO: load bulk data from fixtures
Branch.checkout_on_creation = False
self.mod = Module(name="gnome-hello",
bugs_base="http://bugzilla.gnome.org",
......@@ -49,23 +49,23 @@ class ModuleTestCase(unittest.TestCase):
self.b = Branch(name='master', module=self.mod)
self.b.save(update_statistics=False)
self.rel = Release(name='gnome-2-24', status='official',
description='GNOME 2.24 (stable)',
string_frozen=True)
self.rel.save()
self.cat = Category(release=self.rel, branch=self.b, name='desktop')
self.cat.save()
def testModuleFunctions(self):
self.assertEquals(self.mod.get_description(), 'gnome-hello')
def testBranchFunctions(self):
self.assertTrue(self.b.is_head())
self.assertEquals(self.b.get_vcs_url(), "git://git.gnome.org/gnome-hello")
self.assertEquals(self.b.get_vcs_web_url(), "http://git.gnome.org/cgit/gnome-hello/")
def testBranchStats(self):
# Check stats
self.b.update_stats(force=True)
......@@ -73,7 +73,7 @@ class ModuleTestCase(unittest.TestCase):
self.assertEquals(fr_po_stat.translated, 40)
fr_doc_stat = Statistics.objects.get(branch=self.b, domain__name='help', language__locale='fr')
self.assertEquals(fr_doc_stat.translated, 36)
def testCreateAndDeleteBranch(self):
Branch.checkout_on_creation = True
# Create branch (include checkout)
......@@ -91,7 +91,7 @@ class ModuleTestCase(unittest.TestCase):
mail.outbox = []
self.rel.string_frozen = True
self.rel.save()
# Create a new file with translation
new_file_path = os.path.join(self.b.co_path(), "dummy_file.py")
new_string = "Dummy string for D-L tests"
......@@ -108,7 +108,7 @@ class ModuleTestCase(unittest.TestCase):
self.assertEquals(len(mail.outbox), 1);
self.assertEquals(mail.outbox[0].subject, "String additions to 'gnome-hello.master'")
self.assertTrue(mail.outbox[0].message().as_string().find(new_string)>-1)
def testIdenticalFigureWarning(self):
""" Detect warning if translated figure is identical to original figure """
self.b.checkout()
......@@ -122,7 +122,7 @@ class ModuleTestCase(unittest.TestCase):
self.assertEquals(ui_stat.po_url(), u"/POT/gnome-hello.master/gnome-hello.master.fr.po");
self.assertEquals(ui_stat.pot_url(), u"/POT/gnome-hello.master/gnome-hello.master.pot");
self.assertEquals(doc_stat.po_url(), u"/POT/gnome-hello.master/docs/gnome-hello-help.master.fr.po");
def testCreateUnexistingBranch(self):
""" Try to create a non-existing branch """
Branch.checkout_on_creation = True
......@@ -130,4 +130,3 @@ class ModuleTestCase(unittest.TestCase):
module = self.mod)
self.assertRaises(ValueError, branch.save)
Branch.checkout_on_creation = False
......@@ -54,7 +54,7 @@ def stripHTML(string):
def run_shell_command(cmd, env=None, input_data=None, raise_on_error=False):
if settings.DEBUG: print >>sys.stderr, cmd
stdin = None
if input_data:
stdin = PIPE
......@@ -69,7 +69,7 @@ def run_shell_command(cmd, env=None, input_data=None, raise_on_error=False):
if settings.DEBUG: print >>sys.stderr, output + errout
if raise_on_error and status != STATUS_OK:
raise OSError(status, errout)
return (status, output, errout)
......@@ -105,7 +105,7 @@ def check_potfiles(po_path):
def generate_doc_pot_file(vcs_path, potbase, moduleid, verbose):
""" Return the pot file for a document-type domain, and the error if any """
errors = []
modulename = read_makefile_variable(vcs_path, "DOC_MODULE")
if not modulename:
......@@ -117,17 +117,17 @@ def generate_doc_pot_file(vcs_path, potbase, moduleid, verbose):
else:
errors.append(("error", ugettext_noop("DOC_MODULE doesn't point to a real file, probably a macro.")))
return "", errors
files = os.path.join("C", modulename + ".xml")
includes = read_makefile_variable(vcs_path, "DOC_INCLUDES")
for f in includes.split(" "):
if f.strip() != "":
files += " %s" % (os.path.join("C", f.strip()))
potfile = os.path.join(vcs_path, "C", potbase + ".pot")
command = "cd \"%s\" && xml2po -o %s -e %s" % (vcs_path, potfile, files)
(status, output, errs) = run_shell_command(command)
if status != STATUS_OK:
errors.append(("error",
ugettext_noop("Error regenerating POT file for document %(file)s:\n<pre>%(cmd)s\n%(output)s</pre>")
......@@ -179,7 +179,7 @@ def pot_diff_status(pota, potb):
# POT generation date always change and produce a 4 line diff
if int(output) <= 4:
return NOT_CHANGED, ""
result_all, result_add_only = potdiff.diff(pota, potb)
if not len(result_all) and not len(result_add_only):
return CHANGED_ONLY_FORMATTING, ""
......@@ -213,7 +213,7 @@ def po_file_stats(pofile, msgfmt_checks = True):
input_file = "-"
else:
raise ValueError("pofile type not recognized")
if msgfmt_checks:
command = "msgfmt -cv -o /dev/null %s" % input_file
else:
......@@ -229,7 +229,7 @@ def po_file_stats(pofile, msgfmt_checks = True):
if msgfmt_checks and input_file != "-" and os.access(pofile, os.X_OK):
res['errors'].append(("warn", ugettext_noop("This PO file has an executable bit set.")))
# msgfmt output stats on stderr
r_tr = re.search(r"([0-9]+) translated", errs)
r_un = re.search(r"([0-9]+) untranslated", errs)
......@@ -237,9 +237,9 @@ def po_file_stats(pofile, msgfmt_checks = True):
if r_tr:
res['translated'] = r_tr.group(1)
if r_un:
if r_un:
res['untranslated'] = r_un.group(1)
if r_fz:
if r_fz:
res['fuzzy'] = r_fz.group(1)
if msgfmt_checks:
......@@ -324,7 +324,7 @@ def check_lang_support(module_path, po_path, lang):
def get_fig_stats(pofile):
""" Extract image strings from pofile and return a list of figures dict {'path':, 'fuzzy':, 'translated':} """
# Extract image strings: beforeline/msgid/msgstr/grep auto output a fourth line
# Extract image strings: beforeline/msgid/msgstr/grep auto output a fourth line
command = "msgcat --no-wrap %(pofile)s| grep -A 1 -B 1 '^msgid \"@@image:'" % locals()
(status, output, errs) = run_shell_command(command)
if status != STATUS_OK:
......@@ -336,7 +336,7 @@ def get_fig_stats(pofile):
re_path = re.compile('^msgid \"@@image: \'([^\']*)\'')
re_hash = re.compile('.*md5=(.*)\"')
figures = []
for i, line in islice(enumerate(lines), 0, None, 4):
fig = {'path': '', 'hash': ''}
fig['fuzzy'] = (line=='#, fuzzy' or line[:8]=='#| msgid')
......@@ -402,6 +402,6 @@ def url_join(base, *args):
class Profiler(object):
def __init__(self):
self.start = time.clock()
def time_spent(self):
return time.clock() - self.start
return time.clock() - self.start
......@@ -50,7 +50,7 @@ def module(request, module_name):
for branch in branches:
branch.get_ui_stats(mandatory_langs=langs)
branch.get_doc_stats(mandatory_langs=langs)
context = {
'pageSection': "module",
'module': mod,
......@@ -69,7 +69,7 @@ def module_branch(request, module_name, branch_name):
'branch': branch,
}
return render_to_response('branch_detail.html', context, context_instance=RequestContext(request))
@login_required
def module_edit_branches(request, module_name):
mod = get_object_or_404(Module, name=module_name)
......@@ -131,7 +131,7 @@ def module_edit_branches(request, module_name):
form = ModuleBranchForm(mod) # Redisplay a clean form
else:
messages.append("Sorry, form is not valid")
else:
else:
form = ModuleBranchForm(mod)
context = {
'module': mod,
......@@ -143,7 +143,7 @@ def module_edit_branches(request, module_name):
def docimages(request, module_name, potbase, branch_name, langcode):
mod = get_object_or_404(Module, name=module_name)
stat = get_object_or_404(Statistics,
branch__module=mod.id,
branch__module=mod.id,
branch__name=branch_name,
domain__name=potbase,
language__locale=langcode)
......
......@@ -14,7 +14,7 @@ class EditMemberRoleForm(forms.Form):
initial=role.role)
self.fields['form_type'] = forms.CharField(widget=forms.HiddenInput,
initial=roles[0].role)
def get_fields(self):
for key, field in self.fields.items():
if key not in ('form_type',):
......
......@@ -65,16 +65,16 @@ class Team(models.Model):
@models.permalink
def get_absolute_url(self):
return ('team_slug', [self.name])
def fill_role(self, role, person):
""" Used by TeamManager to prefill roles in team """
if not self.roles:
self.roles = {'coordinator':[], 'committer':[], 'reviewer':[], 'translator':[]}
self.roles[role].append(person)
def get_description(self):
return _(self.description)
def get_languages(self):
return self.language_set.all()
......@@ -92,7 +92,7 @@ class Team(models.Model):
except:
members = Person.objects.filter(role__team__id=self.id, role__role=role)
return members
def get_committers(self):
return self.get_members_by_role('committer')
......@@ -106,21 +106,21 @@ class FakeTeam(object):