--- a/app/soc/logic/cleaning.py Sun Mar 22 22:06:54 2009 +0000
+++ b/app/soc/logic/cleaning.py Sun Mar 22 22:15:46 2009 +0000
@@ -297,7 +297,7 @@
return wrapper
-def clean_numeric_only(field_name):
+def clean_phone_number(field_name):
"""Clean method for cleaning a field that may only contain numerical values.
"""
@@ -308,6 +308,10 @@
value = self.cleaned_data.get(field_name)
+ # allow for a '+' prefix which means '00'
+ if value[0] == '+':
+ value = '00' + value[1:]
+
if not value.isdigit():
raise forms.ValidationError("Only numerical characters are allowed")
--- a/app/soc/views/models/group.py Sun Mar 22 22:06:54 2009 +0000
+++ b/app/soc/views/models/group.py Sun Mar 22 22:15:46 2009 +0000
@@ -91,7 +91,7 @@
new_params['list_heading'] = 'soc/group/list/heading.html'
new_params['create_extra_dynaproperties'] = {
- 'clean_phone': cleaning.clean_numeric_only('phone'),
+ 'clean_phone': cleaning.clean_phone_number('phone'),
'clean_contact_street': cleaning.clean_ascii_only('contact_street'),
'clean_contact_city': cleaning.clean_ascii_only('contact_city'),
'clean_contact_state': cleaning.clean_ascii_only('contact_state'),
--- a/app/soc/views/models/role.py Sun Mar 22 22:06:54 2009 +0000
+++ b/app/soc/views/models/role.py Sun Mar 22 22:15:46 2009 +0000
@@ -139,7 +139,7 @@
'longitude': forms.fields.FloatField(widget=forms.HiddenInput,
required=False),
'clean_link_id': cleaning.clean_existing_user('link_id'),
- 'clean_phone': cleaning.clean_numeric_only('phone'),
+ 'clean_phone': cleaning.clean_phone_number('phone'),
'clean_res_street': cleaning.clean_ascii_only('res_street'),
'clean_res_city': cleaning.clean_ascii_only('res_city'),
'clean_res_state': cleaning.clean_ascii_only('res_state'),