Strip spaces from url when creating or updating a source

This commit is contained in:
amercader 2012-08-17 12:24:41 +01:00
parent a17e8208de
commit 8233b2ec23
2 changed files with 3 additions and 1 deletions

View File

@ -29,7 +29,7 @@ def harvest_source_create(context,data_dict):
raise ValidationError(errors,_error_summary(errors))
source = HarvestSource()
source.url = data['url']
source.url = data['url'].strip()
source.type = data['type']
opt = ['active','title','description','user_id','publisher_id','config']

View File

@ -47,6 +47,8 @@ def harvest_source_update(context,data_dict):
fields = ['url','title','type','description','user_id','publisher_id']
for f in fields:
if f in data and data[f] is not None:
if f == 'url':
data[f] = data[f].strip()
source.__setattr__(f,data[f])
if 'active' in data_dict: