'Calculate the \'name\' field used by Map popups'

@staticmethod
def project_location_onaccept(form):

    form_vars = form.vars
    id = form_vars.get('id')
    if (form_vars.get('location_id') and form_vars.get('project_id')):
        name = current.s3db.project_location_represent(None, form_vars)
    elif id:
        name = current.s3db.project_location_represent(id)
    else:
        return None
    if (len(name) > 512):
        name = (name[:509] + '...')
    db = current.db
    db((db.project_location.id == id)).update(name=name)
