'Remove a Bookmark for an Incident
S3Method for interactive requests'

@staticmethod
def incident_remove_bookmark(r, **attr):

    incident_id = r.id
    user = current.auth.user
    user_id = (user and user.id)
    if ((not incident_id) or (not user_id)):
        raise HTTP(405, current.ERROR.BAD_METHOD)
    s3db = current.s3db
    ltable = s3db.event_bookmark
    query = ((ltable.incident_id == incident_id) & (ltable.user_id == user_id))
    exists = current.db(query).select(ltable.id, ltable.deleted, limitby=(0, 1)).first()
    if (exists and (not exists.deleted)):
        resource = s3db.resource('event_bookmark', id=exists.id)
        resource.delete()
    output = current.xml.json_message(True, 200, current.T('Bookmark    Removed'))
    current.response.headers['Content-Type'] = 'application/json'
    return output
