-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Summary
The BlogConfig class doesn't validate that required fields (like base_url) are set before they're used. This can lead to cryptic errors when generating feeds or other operations that depend on these fields.
File to update
src/blogtuner/core/blog.py
Current behavior
base_urldefaults toNoneinDEFAULT_BLOG_METADATA- No validation that it's set before use
- Feed generation may fail or produce invalid URLs if
base_urlis missing
Proposed change
Add validation in BlogConfig.from_directory() or create a Pydantic validator:
from pydantic import model_validator
class BlogConfig(BaseModel):
# ... existing fields ...
@model_validator(mode='after')
def validate_required_for_feeds(self) -> Self:
if self.base_url is None:
logger.warning("base_url is not set - feed generation will be disabled")
return selfOr add explicit validation before feed generation:
def generate_feed(self):
if self.base_url is None:
raise ValueError("base_url must be set to generate feeds")
# ... rest of feed generationPriority
Low
Metadata
Metadata
Assignees
Labels
No labels