Initial commit: MCP Hub Community Edition v3.0.0
Community edition generated from private repo via sync pipeline. Includes 9 plugins (WordPress, WooCommerce, WP Advanced, Gitea, n8n, Supabase, OpenPanel, Appwrite, Directus) with ~587 tools. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
27
plugins/openpanel/handlers/utils.py
Normal file
27
plugins/openpanel/handlers/utils.py
Normal file
@@ -0,0 +1,27 @@
|
||||
"""Utility functions for OpenPanel handlers"""
|
||||
|
||||
from plugins.openpanel.client import OpenPanelClient
|
||||
|
||||
def get_project_id(client: OpenPanelClient, project_id: str | None) -> str:
|
||||
"""
|
||||
Get effective project_id, using default if not provided.
|
||||
|
||||
Args:
|
||||
client: OpenPanel client with potential default_project_id
|
||||
project_id: Explicitly provided project_id (may be None)
|
||||
|
||||
Returns:
|
||||
Effective project_id to use
|
||||
|
||||
Raises:
|
||||
ValueError: If no project_id available
|
||||
"""
|
||||
if project_id:
|
||||
return project_id
|
||||
if client.default_project_id:
|
||||
return client.default_project_id
|
||||
raise ValueError(
|
||||
"project_id is required. Either provide it as a parameter or configure "
|
||||
"OPENPANEL_SITE1_PROJECT_ID in environment variables. "
|
||||
"You can find your Project ID in OpenPanel Dashboard → Project Settings."
|
||||
)
|
||||
Reference in New Issue
Block a user