Skip to content

[reverted] feat: Support custom parameters in extra context#15

Merged
SilverRainZ merged 1 commit into
masterfrom
codex/extra-context-params
May 14, 2026
Merged

[reverted] feat: Support custom parameters in extra context#15
SilverRainZ merged 1 commit into
masterfrom
codex/extra-context-params

Conversation

@SilverRainZ
Copy link
Copy Markdown
Member

Summary

ExtraContext.generate() now accepts *args, **kwargs, and load_extra() passes them through from the template. This enables parameterized extra contexts like load_extra('all_docs', count=3).

Changes

  • ExtraContext.generate signature: (self, req, *args, **kwargs)
  • extra_context_loader forwards *args, **kwargs from the template
  • Built-in contexts updated to accept the new signature
  • New test root test-extra-context-params with all_docs example
  • Docs updated with working examples and literalinclude references
  • E2E test and unit test for parameter passing

Usage

@extra_context('all_docs')
class AllDocsExtraContext(ExtraContext):
    def generate(self, req, *args, **kwargs):
        count = args[0] if args else kwargs.get('count', 5)
        return sorted(req.env.all_docs.keys())[:count]
{% set docs = load_extra('all_docs', 3) %}
{% for doc in docs %}
- {{ doc }}
{% endfor %}

ExtraContext.generate() now accepts *args, **kwargs, and load_extra()
passes them through from the template. This enables parameterized
extra contexts like load_extra('all_docs', count=3).

Changes:
- ExtraContext.generate signature: (self, req, *args, **kwargs)
- extra_context_loader forwards *args, **kwargs from the template
- Built-in contexts updated to accept the new signature
- New test root test-extra-context-params with all_docs example
- Docs updated with working examples

Co-authored-by: deepseek-ai <service@deepseek.com>
@SilverRainZ SilverRainZ merged commit 4658cb7 into master May 14, 2026
6 checks passed
@SilverRainZ SilverRainZ changed the title feat: Support custom parameters in extra context [reverted] feat: Support custom parameters in extra context May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant