""" Event form resource for the OpenEventDatabase. """ import falcon from oedb.utils.logging import logger class EventFormResource: """ Resource for the event submission form. Handles the /demo/add endpoint. """ def on_get(self, req, resp): """ Handle GET requests to the /demo/add endpoint. Returns an HTML page with a form for adding events. Args: req: The request object. resp: The response object. """ logger.info("Processing GET request to /demo/add") try: # Set content type to HTML resp.content_type = 'text/html' # Create HTML response with form html = """ Add Event - OpenEventDatabase

Add New Event

Category of the event (e.g., sport.match.football, culture.festival)
Series or group the event belongs to (e.g., Euro 2024, Summer Festival 2023)
Specific location name (e.g., Eiffel Tower, Wembley Stadium)
Click on the map to set the event location
""" # Set the response body and status resp.text = html resp.status = falcon.HTTP_200 logger.success("Successfully processed GET request to /demo/add") except Exception as e: logger.error(f"Error processing GET request to /demo/add: {e}") resp.status = falcon.HTTP_500 resp.text = f"Error: {str(e)}" # Create a global instance of EventFormResource event_form = EventFormResource()