Decide: should the declaration check follow code in a mixin that sets path or default?

Aperta
#111 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
django, python
Ambito
backend

Direzione di ricerca

Read ADR 0021 Decision 2 and the declaration check, _path_from_module, and import_models paths referenced in the issue. Compare the six reproduced cases and decide how far the check should follow mixin, metaclass, and post-definition behavior. Done means documenting a clear scope decision for which cases the declaration check will reject or leave out of scope.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

The closed namespace (ADR 0021 Decision 2) reads the public names a config class and its mixins hold. Code in a mixin can still give a declaring class a path or default it never wrote, and nothing refuses it. This was found while settling #59. Each case below was reproduced on release/0.1.0a2, and each ends with a declaring class that has a snapshot:

  1. A mixin overrides _path_from_module. Private names are admitted, and Django calls that method to derive path.
  2. A mixin defines __getattr__ that answers path, or an __init__ that sets self.path. Django's hasattr(self, "path") then finds it.
  3. A mixin's __init_subclass__ sets cls.path or cls.default after super().__init_subclass__(), so after the check has run.
  4. The same hook sets them before super(), and _check then reads them as written in the declaring class's own body.
  5. path or default is rebound on a mixin after the class is defined. import_models checks only name and label again.
  6. A metaclass property for default on a base class hides the declaring class's own default.

A decision is needed on how far the check should follow code rather than attributes. Possible directions are refusing dunder hooks other than ready in a mixin, refusing a metaclass, and checking path and default in import_models too. Leaving these out of scope is also possible, since each case takes deliberate code.

Lingua principale
Python
Stelle
1
Fork
0
Merge medio
5h 30m
PR unite (30g)
85

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di stack314/django-neolith

Tutte le issue di stack314/django-neolith

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.