unsupported operand type(s) for +: 'NoneType' and 'str'

by Radim Novotny last modified Dec 30, 2008 05:49 PM
This error is raised when ReferenceField is used in IB

If you are using ReferenceField (and maybe in other cases too) this error is raised when viewing newly created item. Error is raised from the getCurrentUrl python script (/portal_skins/plone_scripts in ZMI).

request = context.REQUEST
url = request.get('ACTUAL_URL', request.get('URL', None))
query = request.get('QUERY_STRING','')
if query:
    query = '?'+query
return url+query

In case of url is None, mentioned error is raised.

Customize this script and change to:

... ... ...
if query:
    query = '?'+query
if url:
    return url+query
else:
    return context.portal_url()