Commit 96a8cd4f authored by Claude Paroz's avatar Claude Paroz

Formatting cleanup

parent 81546603
......@@ -130,7 +130,7 @@ ATOMIC_REQUESTS = True
ROOT_URLCONF = 'damnedlies.urls'
INSTALLED_APPS = (
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
......@@ -145,7 +145,7 @@ INSTALLED_APPS = (
'teams',
'vertimus',
'feeds',
)
]
INTERNAL_IPS=('127.0.0.1',)
......@@ -191,11 +191,11 @@ if DEBUG:
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
if USE_DEBUG_TOOLBAR:
MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
INSTALLED_APPS += ('debug_toolbar',)
MIDDLEWARE.append('debug_toolbar.middleware.DebugToolbarMiddleware')
INSTALLED_APPS.append('debug_toolbar')
if USE_DJANGO_OPENID:
INSTALLED_APPS += ('django_openid_auth',)
INSTALLED_APPS.append('django_openid_auth')
AUTHENTICATION_BACKENDS = (
'django_openid_auth.auth.OpenIDBackend',
'django.contrib.auth.backends.ModelBackend',
......
......@@ -34,7 +34,7 @@ class PeopleTestCase(TestCase):
)
self.assertRedirects(response, reverse('register_success'))
self.assertEqual(Person.objects.filter(username=username).count(), 1)
self.assertEqual(len(mail.outbox), 1);
self.assertEqual(len(mail.outbox), 1)
self.assertIn(_('Account activation'), mail.outbox[0].subject)
def test_activate_account(self):
......
......@@ -286,7 +286,7 @@ class ModuleTestCase(TestCase):
# Regenerate stats (mail should be sent)
self.branch.update_stats(force=False, checkout=False)
# Assertions
self.assertEqual(len(mail.outbox), 1);
self.assertEqual(len(mail.outbox), 1)
self.assertEqual(mail.outbox[0].subject, "[Damned Lies] String additions to 'gnome-hello.master'")
self.assertEqual(mail.outbox[0].extra_headers, {settings.EMAIL_HEADER_NAME: 'stringchange'})
self.assertIn('"%s"' % new_string, mail.outbox[0].body)
......
......@@ -29,10 +29,10 @@ class EditTeamDetailsForm(forms.ModelForm):
except IndexError:
current_coord_pk = None
self.fields['coordinatorship'] = forms.ChoiceField(
label = _("Coordinator"),
choices = all_members,
required = False,
initial = current_coord_pk
label=_("Coordinator"),
choices=all_members,
required=False,
initial=current_coord_pk,
)
def save(self, *args, **kwargs):
......@@ -65,7 +65,8 @@ class EditMemberRoleForm(forms.Form):
self.fields[str(role.pk)] = forms.ChoiceField(
choices=choices,
label='<a href="%s">%s</a>' % (role.person.get_absolute_url(), role.person.name),
initial=role.role)
initial=role.role
)
if roles:
self.fields['form_type'] = forms.CharField(widget=forms.HiddenInput, initial=roles[0].role)
......
......@@ -38,20 +38,23 @@ class AuthorChoiceField(forms.ModelChoiceField):
class ActionForm(forms.Form):
action = forms.ChoiceField(label=_("Action"),
# help_text="Choose an action you want to apply",
action = forms.ChoiceField(
label=_("Action"),
choices=(),
widget=DisablableSelect)
comment = forms.CharField(label=_("Comment"),
# help_text="Leave a comment to explain your action",
widget=DisablableSelect
)
comment = forms.CharField(
label=_("Comment"),
max_length=5000,
required=False,
widget=forms.Textarea(attrs={'rows':8, 'cols':70}))
widget=forms.Textarea(attrs={'rows':8, 'cols':70})
)
author = AuthorChoiceField(label=_("Commit author"), queryset=Person.objects.none(), required=False)
sync_master = forms.BooleanField(
label=_("Sync with master"),
help_text=_("Try to cherry-pick the commit to the master branch"),
required=False)
required=False
)
file = forms.FileField(label=_("File"), required=False,
help_text=_("Upload a .po, .gz, .bz2 or .png file"))
send_to_ml = forms.BooleanField(label=_("Send message to the team mailing list"), required=False)
......
......@@ -101,7 +101,8 @@ class State(models.Model):
The first level is 1."""
assert level > 0, "Level must be greater than 0"
query = ActionArchived.objects.filter(state_db=self).values('sequence').distinct().order_by('-sequence')[level-1:level]
query = ActionArchived.objects.filter(state_db=self).values('sequence').distinct(
).order_by('-sequence')[level-1:level]
sequence = None
if len(query) > 0:
sequence = query[0]['sequence']
......@@ -336,8 +337,7 @@ class ActionAbstract(models.Model):
comment = models.TextField(blank=True, null=True)
sent_to_ml = models.BooleanField(default=False)
file = models.FileField(upload_to=generate_upload_filename, blank=True, null=True)
#up_file = models.OneToOneField(PoFile, null=True, related_name='action_p')
merged_file = models.OneToOneField(PoFile, blank=True, null=True, on_delete=models.SET_NULL) #, related_name='action_m')
merged_file = models.OneToOneField(PoFile, blank=True, null=True, on_delete=models.SET_NULL)
# A comment or a file is required
arg_is_required = False
......@@ -581,6 +581,7 @@ class ActionWC(Action):
class Meta:
proxy = True
class ActionRT(Action):
name = 'RT'
target_state = StateTranslating
......@@ -589,6 +590,7 @@ class ActionRT(Action):
class Meta:
proxy = True
class ActionUT(Action):
name = 'UT'
target_state = StateTranslated
......@@ -598,6 +600,7 @@ class ActionUT(Action):
class Meta:
proxy = True
class ActionRP(Action):
name = 'RP'
target_state = StateProofreading
......@@ -606,6 +609,7 @@ class ActionRP(Action):
class Meta:
proxy = True
class ActionUP(Action):
name = 'UP'
target_state = StateProofread
......@@ -615,6 +619,7 @@ class ActionUP(Action):
class Meta:
proxy = True
class ActionTC(Action):
name = 'TC'
target_state = StateToCommit
......@@ -628,6 +633,7 @@ class ActionTC(Action):
committers = [c.email for c in state.language.team.get_committers()]
self.send_mail_new_state(state, committers)
class ActionCI(Action):
name = 'CI'
target_state = StateCommitted
......@@ -660,6 +666,7 @@ class ActionCI(Action):
super().apply_on(state, form_data) # Mail sent in super
return msg
class ActionRC(Action):
name = 'RC'
target_state = StateCommitting
......@@ -668,6 +675,7 @@ class ActionRC(Action):
class Meta:
proxy = True
class ActionIC(Action):
name = 'IC'
target_state = StateCommitted
......@@ -676,6 +684,7 @@ class ActionIC(Action):
class Meta:
proxy = True
class ActionTR(Action):
name = 'TR'
target_state = StateToReview
......@@ -685,6 +694,7 @@ class ActionTR(Action):
class Meta:
proxy = True
class ActionAA(Action):
name = 'AA'
target_state = StateNone
......@@ -724,6 +734,7 @@ class ActionAA(Action):
action.delete() # The file is also automatically deleted, if it is not referenced elsewhere
class ActionUNDO(Action):
name = 'UNDO'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment