调整版本并做测试

This commit is contained in:
2026-02-27 17:10:54 +08:00
parent fa673138f6
commit 31be9d0e97
77 changed files with 679 additions and 25 deletions

View File

@@ -0,0 +1,50 @@
#!/usr/bin/env python3.9
# -*- coding: utf-8 -*-
"""
JFinal StringSource - String Source
"""
class StringSource:
"""String source for template loading"""
def __init__(self, content: str, cache_key: str = None):
"""
Initialize string source
Args:
content: Template content
cache_key: Cache key (optional)
"""
self._content = content
self._cache_key = cache_key
def get_content(self) -> str:
"""
Get string content
Returns:
Content as string
"""
return self._content
def is_modified(self) -> bool:
"""
Check if content has been modified
Returns:
Always False for string sources
"""
return False
def get_cache_key(self) -> str:
"""
Get cache key
Returns:
Cache key
"""
return self._cache_key
def __repr__(self) -> str:
content_preview = self._content[:50] + "..." if len(self._content) > 50 else self._content
return f"StringSource('{content_preview}')"