tractatus/pptx-env/lib/python3.12/site-packages/fontTools/ttLib/ttVisitor.py
TheFlow 2298d36bed fix(submissions): restructure Economist package and fix article display
- 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>
2025-10-24 08:47:42 +13:00

32 lines
1 KiB
Python

"""Specialization of fontTools.misc.visitor to work with TTFont."""
from fontTools.misc.visitor import Visitor
from fontTools.ttLib import TTFont
class TTVisitor(Visitor):
def visitAttr(self, obj, attr, value, *args, **kwargs):
if isinstance(value, TTFont):
return False
super().visitAttr(obj, attr, value, *args, **kwargs)
def visit(self, obj, *args, **kwargs):
if hasattr(obj, "ensureDecompiled"):
obj.ensureDecompiled(recurse=False)
super().visit(obj, *args, **kwargs)
@TTVisitor.register(TTFont)
def visit(visitor, font, *args, **kwargs):
# Some objects have links back to TTFont; even though we
# have a check in visitAttr to stop them from recursing
# onto TTFont, sometimes they still do, for example when
# someone overrides visitAttr.
if hasattr(visitor, "font"):
return False
visitor.font = font
for tag in font.keys():
visitor.visit(font[tag], *args, **kwargs)
del visitor.font
return False