Skip to content

URL Registration Research and Prototype #10

@whisper67265

Description

@whisper67265

Problem

Beyond format handlers, the plugin may need to register custom URL endpoints with Weblate (e.g., a /boost-endpoint/ for webhook receivers or API extensions). Django's URL routing is typically configured at startup via ROOT_URLCONF, but a plugin can't modify that directly. Research is needed to determine the best approach — AppConfig.ready() monkey-patching, middleware injection, or Weblate's own addon URL hooks — and prototype the chosen solution.

Acceptance Criteria

  • At least 3 URL registration approaches are researched and documented with pros/cons: (a) AppConfig.ready() + ROOT_URLCONF override, (b) middleware-based URL injection, (c) Weblate addon get_urls() if available
  • A working prototype demonstrates at least one approach: a custom URL endpoint responds with a 200 when accessed in the running Weblate instance
  • The chosen approach is documented in README.md with rationale, limitations, and upgrade-safety analysis (will it break on Weblate version bumps?)
  • If no approach is viable without forking Weblate, that finding is documented with a recommended alternative (e.g., a sidecar service)

Implementation Notes

  • Check if Weblate's Addon base class exposes a get_urls() or similar hook — this would be the cleanest path.
  • AppConfig.ready() is the standard Django plugin entrypoint. Modifying ROOT_URLCONF from there is possible but fragile — it runs before URL patterns are finalized, and Weblate may override it.
  • Alternative: use Django middleware to intercept specific paths before they hit Weblate's URL resolver.
  • This is research-heavy: allocate time for reading Weblate and Django source, not just coding. The prototype can be minimal (a single view returning HttpResponse("ok")).
  • Document findings even if the prototype doesn't fully work — this feeds into the 3-week horizon URL endpoint item.

References

  • Related files: README.md, src/boost_weblate/apps.py (AppConfig), src/boost_weblate/urls.py (prototype)
  • Upstream: Django AppConfig.ready() docs, Weblate Addon base class source, Weblate urls.py

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions