I am creating a view to upload a csv file in order to batch-create items based of a custom Dexterity content type I created for my project.
In the schema for my content type, I created a URL field like this:
link = schema.URI (
title=_(u'Link'),
description=_(u"Endereço para acesso pela Internet ao " +
u"texto do ato."),
)
And in the script for the mass creation of such items, I used plone.api like this:
api.content.create(
container=folder_reference,
type='portal_types_name',
title=title,
link=get_cell(row,u"LINK"),
)
The "get_cell" references a helper function to process the CSV file (I followed the example here: http://docs.plone.org/develop/plone/forms/files.html). The get_cell function actually returns the "LINK" column for the current row in the CSV.
Problem is that sometimes the user does not prefixes the URL with "http://", starting the address with "www.". This gives me problems like when I go to the edit form of the created item, the validator complains that the field is not a valid URL.
How should I do to properly validate the field when filling it via plone.api.content.create?