@@ -29,10 +29,13 @@ def __init__(self, cf, *args, **kwargs):
2929 q = Q (patch_author__commitfests = cf ) | Q (patch_reviewer__commitfests = cf )
3030 userchoices = [(- 1 , '* All' ), (- 2 , '* None' ), (- 3 , '* Yourself' )] + [
3131 (u .id , '%s %s (%s)' % (u .first_name , u .last_name , u .username ))
32- for u in User .objects .filter (q ).distinct ().order_by ('first_name' , 'last_name' )
32+ for u in User .objects .filter (q )
33+ .distinct ()
34+ .order_by ('first_name' , 'last_name' )
3335 ]
3436 self .fields ['targetversion' ] = forms .ChoiceField (
35- choices = [('-1' , '* All' ), ('-2' , '* None' )] + [(v .id , v .version ) for v in TargetVersion .objects .all ()],
37+ choices = [('-1' , '* All' ), ('-2' , '* None' )]
38+ + [(v .id , v .version ) for v in TargetVersion .objects .all ()],
3639 required = False ,
3740 label = "Target version" ,
3841 )
@@ -88,12 +91,21 @@ def __init__(self, *args, **kwargs):
8891 if 'data' in kwargs and str (field ) in kwargs ['data' ]:
8992 vals .extend ([x for x in kwargs ['data' ].getlist (field )])
9093 self .fields [field ].widget .attrs ['data-selecturl' ] = url
91- self .fields [field ].queryset = self .fields [field ].queryset .filter (pk__in = set (vals ))
92- self .fields [field ].label_from_instance = lambda u : '{} ({})' .format (u .username , u .get_full_name ())
94+ self .fields [field ].queryset = self .fields [field ].queryset .filter (
95+ pk__in = set (vals )
96+ )
97+ self .fields [field ].label_from_instance = lambda u : '{} ({})' .format (
98+ u .username , u .get_full_name ()
99+ )
93100
94101
95102class NewPatchForm (forms .ModelForm ):
96- threadmsgid = forms .CharField (max_length = 200 , required = True , label = 'Specify thread msgid' , widget = ThreadPickWidget )
103+ threadmsgid = forms .CharField (
104+ max_length = 200 ,
105+ required = True ,
106+ label = 'Specify thread msgid' ,
107+ widget = ThreadPickWidget ,
108+ )
97109 # patchfile = forms.FileField(allow_empty_file=False, max_length=50000, label='or upload patch file', required=False, help_text='This may be supported sometime in the future, and would then autogenerate a mail to the hackers list. At such a time, the threadmsgid would no longer be required.')
98110
99111 class Meta :
@@ -115,10 +127,20 @@ def clean_threadmsgid(self):
115127
116128def _fetch_thread_choices (patch ):
117129 for mt in patch .mailthread_set .order_by ('-latestmessage' ):
118- ti = sorted (_archivesAPI ('/message-id.json/%s' % mt .messageid ), key = lambda x : x ['date' ], reverse = True )
130+ ti = sorted (
131+ _archivesAPI ('/message-id.json/%s' % mt .messageid ),
132+ key = lambda x : x ['date' ],
133+ reverse = True ,
134+ )
119135 yield [
120136 mt .subject ,
121- [('%s,%s' % (mt .messageid , t ['msgid' ]), 'From %s at %s' % (t ['from' ], t ['date' ])) for t in ti ],
137+ [
138+ (
139+ '%s,%s' % (mt .messageid , t ['msgid' ]),
140+ 'From %s at %s' % (t ['from' ], t ['date' ]),
141+ )
142+ for t in ti
143+ ],
122144 ]
123145
124146
@@ -130,7 +152,10 @@ def _fetch_thread_choices(patch):
130152
131153def reviewfield (label ):
132154 return forms .MultipleChoiceField (
133- choices = review_state_choices , label = label , widget = forms .CheckboxSelectMultiple , required = False
155+ choices = review_state_choices ,
156+ label = label ,
157+ widget = forms .CheckboxSelectMultiple ,
158+ required = False ,
134159 )
135160
136161
@@ -144,7 +169,9 @@ class CommentForm(forms.Form):
144169 review_doc = reviewfield ('Documentation' )
145170
146171 message = forms .CharField (required = True , widget = forms .Textarea )
147- newstatus = forms .ChoiceField (choices = PatchOnCommitFest .OPEN_STATUS_CHOICES (), label = 'New status' )
172+ newstatus = forms .ChoiceField (
173+ choices = PatchOnCommitFest .OPEN_STATUS_CHOICES (), label = 'New status'
174+ )
148175
149176 def __init__ (self , patch , poc , is_review , * args , ** kwargs ):
150177 super (CommentForm , self ).__init__ (* args , ** kwargs )
@@ -173,8 +200,13 @@ def clean(self):
173200 if self .is_review :
174201 for fn , f in self .fields .items ():
175202 if fn .startswith ('review_' ) and fn in self .cleaned_data :
176- if '1' in self .cleaned_data [fn ] and '0' not in self .cleaned_data [fn ]:
177- self .errors [fn ] = (('Cannot pass a test without performing it!' ),)
203+ if (
204+ '1' in self .cleaned_data [fn ]
205+ and '0' not in self .cleaned_data [fn ]
206+ ):
207+ self .errors [fn ] = (
208+ ('Cannot pass a test without performing it!' ),
209+ )
178210 return self .cleaned_data
179211
180212
0 commit comments