- Create Economist SubmissionTracking package correctly: * mainArticle = full blog post content * coverLetter = 216-word SIR— letter * Links to blog post via blogPostId - Archive 'Letter to The Economist' from blog posts (it's the cover letter) - Fix date display on article cards (use published_at) - Target publication already displaying via blue badge Database changes: - Make blogPostId optional in SubmissionTracking model - Economist package ID: 68fa85ae49d4900e7f2ecd83 - Le Monde package ID: 68fa2abd2e6acd5691932150 Next: Enhanced modal with tabs, validation, export 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
34 lines
924 B
Python
34 lines
924 B
Python
from __future__ import annotations
|
|
|
|
import shutil
|
|
import tempfile
|
|
|
|
from ._errors import OperationFailed
|
|
from ._osfs import OSFS
|
|
|
|
|
|
class TempFS(OSFS):
|
|
def __init__(self, auto_clean: bool = True, ignore_clean_errors: bool = True):
|
|
self.auto_clean = auto_clean
|
|
self.ignore_clean_errors = ignore_clean_errors
|
|
self._temp_dir = tempfile.mkdtemp("__temp_fs__")
|
|
self._cleaned = False
|
|
super().__init__(self._temp_dir)
|
|
|
|
def close(self):
|
|
if self.auto_clean:
|
|
self.clean()
|
|
super().close()
|
|
|
|
def clean(self):
|
|
if self._cleaned:
|
|
return
|
|
|
|
try:
|
|
shutil.rmtree(self._temp_dir)
|
|
except Exception as e:
|
|
if not self.ignore_clean_errors:
|
|
raise OperationFailed(
|
|
f"failed to remove temporary directory: {self._temp_dir!r}"
|
|
) from e
|
|
self._cleaned = True
|