equal
deleted
inserted
replaced
275 |
275 |
276 return user_account |
276 return user_account |
277 return wrapped |
277 return wrapped |
278 |
278 |
279 |
279 |
|
280 def clean_ascii_only(field_name): |
|
281 """Clean method for cleaning a field that may only contain ASCII-characters. |
|
282 """ |
|
283 @check_field_is_empty(field_name) |
|
284 def wrapper(self): |
|
285 """Decorator wrapper method. |
|
286 """ |
|
287 value = self.cleaned_data.get(field_name) |
|
288 |
|
289 try: |
|
290 # encode to ASCII |
|
291 value = value.encode("ascii") |
|
292 except UnicodeEncodeError: |
|
293 # can not encode as ASCII |
|
294 raise forms.ValidationError("Only ASCII characters are allowed") |
|
295 |
|
296 return value |
|
297 return wrapper |
|
298 |
|
299 |
280 def clean_feed_url(self): |
300 def clean_feed_url(self): |
281 """Clean method for cleaning feed url. |
301 """Clean method for cleaning feed url. |
282 """ |
302 """ |
283 |
303 |
284 feed_url = self.cleaned_data.get('feed_url') |
304 feed_url = self.cleaned_data.get('feed_url') |
313 content = content.strip().replace('\r\n', '\n') |
333 content = content.strip().replace('\r\n', '\n') |
314 |
334 |
315 return content |
335 return content |
316 |
336 |
317 return wrapped |
337 return wrapped |
|
338 |
318 |
339 |
319 def clean_url(field_name): |
340 def clean_url(field_name): |
320 """Clean method for cleaning a field belonging to a LinkProperty. |
341 """Clean method for cleaning a field belonging to a LinkProperty. |
321 """ |
342 """ |
322 |
343 |