Skip to content
This repository
Browse code

Minor docstring adjustment

  • Loading branch information...
commit 839cc32d62a275da5df977ef47815ba421089d81 1 parent 7e08855
David Winterbottom authored July 26, 2012
4  oscar/apps/checkout/views.py
@@ -358,7 +358,7 @@ class PaymentDetailsView(OrderPlacementMixin, TemplateView):
358 358
     thing.  This is to make it easier to subclass and override just one component of
359 359
     functionality.
360 360
 
361  
-    Almost all projects will need to subclass and customise this class.
  361
+    All projects will need to subclass and customise this class.
362 362
     """
363 363
     template_name = 'checkout/payment_details.html'
364 364
     template_name_preview = 'checkout/preview.html'
@@ -396,7 +396,7 @@ def post(self, request, *args, **kwargs):
396 396
         then the method can call submit()
397 397
         """
398 398
         error_response = self.get_error_response()
399  
-        
  399
+
400 400
         if error_response:
401 401
             return error_response
402 402
         if self.preview:
38  oscar/apps/payment/forms.py
@@ -65,15 +65,15 @@ def clean(self, value):
65 65
         """Check if given CC number is valid and one of the
66 66
            card types we accept"""
67 67
         non_decimal = re.compile(r'\D+')
68  
-        value = non_decimal.sub('', value.strip())    
69  
-           
  68
+        value = non_decimal.sub('', value.strip())
  69
+
70 70
         if value and not luhn(value):
71 71
             raise forms.ValidationError(_("Please enter a valid credit card number."))
72 72
         return super(BankcardNumberField, self).clean(value)
73 73
 
74 74
 
75 75
 class BankcardMonthWidget(forms.MultiWidget):
76  
-    """ 
  76
+    """
77 77
     Widget containing two select boxes for selecting the month and year
78 78
     """
79 79
     def decompress(self, value):
@@ -95,12 +95,11 @@ class BankcardMonthField(forms.MultiValueField):
95 95
     num_years = 5
96 96
 
97 97
     def __init__(self, *args, **kwargs):
98  
-        
99 98
         # Allow the number of years to be specified
100 99
         if 'num_years' in kwargs:
101 100
             self.num_years = kwargs['num_years']
102 101
             del kwargs['num_years']
103  
-        
  102
+
104 103
         errors = self.default_error_messages.copy()
105 104
         if 'error_messages' in kwargs:
106 105
             errors.update(kwargs['error_messages'])
@@ -110,13 +109,13 @@ def __init__(self, *args, **kwargs):
110 109
             forms.ChoiceField(choices=self.year_choices(),
111 110
                 error_messages={'invalid': errors['invalid_year']}),
112 111
         )
113  
-        
  112
+
114 113
         super(BankcardMonthField, self).__init__(fields, *args, **kwargs)
115 114
         self.widget = BankcardMonthWidget(widgets = [fields[0].widget, fields[1].widget])
116  
-        
  115
+
117 116
     def month_choices(self):
118 117
         return []
119  
-    
  118
+
120 119
     def year_choices(self):
121 120
         return []
122 121
 
@@ -150,8 +149,8 @@ def compress(self, data_list):
150 149
             # find last day of the month
151 150
             day = monthrange(year, month)[1]
152 151
             return date(year, month, day)
153  
-        return None 
154  
-    
  152
+        return None
  153
+
155 154
 
156 155
 class BankcardStartingMonthField(BankcardMonthField):
157 156
     """
@@ -184,11 +183,10 @@ def compress(self, data_list):
184 183
             year = int(data_list[1])
185 184
             month = int(data_list[0])
186 185
             return date(year, month, 1)
187  
-        return None 
188  
-    
  186
+        return None
  187
+
189 188
 
190 189
 class BankcardForm(forms.ModelForm):
191  
-    
192 190
     number = BankcardNumberField(max_length=20, widget=forms.TextInput(attrs={'autocomplete':'off'}),
193 191
                                  label=_("Card number"))
194 192
     name = forms.CharField(max_length=128, label=_("Name on card"))
@@ -196,12 +194,12 @@ class BankcardForm(forms.ModelForm):
196 194
                                   regex=r'^\d{3,4}$', widget=forms.TextInput(attrs={'size': '5'}))
197 195
     start_month = BankcardStartingMonthField(label=_("Valid from"), required=False)
198 196
     expiry_month = BankcardExpiryMonthField(required=True, label=_("Valid to"))
199  
-    
  197
+
200 198
     class Meta:
201 199
         model = BankcardModel
202 200
         exclude = ('user', 'partner_reference')
203 201
         fields = ('number', 'name', 'start_month', 'expiry_month', 'cvv_number')
204  
-        
  202
+
205 203
     def get_bankcard_obj(self):
206 204
         """
207 205
         Returns a Bankcard object for use in payment processing.
@@ -215,17 +213,17 @@ def get_bankcard_obj(self):
215 213
         if self.cleaned_data['start_month']:
216 214
             kwargs['start_date'] = self.cleaned_data['start_month'].strftime("%m/%y")
217 215
         return Bankcard(**kwargs)
218  
-    
  216
+
219 217
 
220 218
 class BillingAddressForm(forms.ModelForm):
221  
-    
  219
+
222 220
     def __init__(self, *args, **kwargs):
223 221
         super(BillingAddressForm,self ).__init__(*args, **kwargs)
224  
-        self.set_country_queryset() 
225  
-        
  222
+        self.set_country_queryset()
  223
+
226 224
     def set_country_queryset(self):
227 225
         self.fields['country'].queryset = Country._default_manager.all()
228  
-    
  226
+
229 227
     class Meta:
230 228
         model = BillingAddress
231 229
         exclude = ('search_text',)

0 notes on commit 839cc32

Please sign in to comment.
Something went wrong with that request. Please try again.