Files
mcphub/plugins/openpanel/handlers/utils.py
airano c73e39f6e4 fix(ci): fix black/ruff failures, add CoC and PR template
- Fix Python formatting (sync no longer strips blank lines from .py files)
- Remove test_community_build.py (tests private sync module)
- Fix ruff warnings in test files
- Add CODE_OF_CONDUCT.md
- Add .github/PULL_REQUEST_TEMPLATE.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 18:19:39 +03:30

29 lines
886 B
Python

"""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."
)