api: deprecate UserItem.CSVImport.validate_file_for_import in favor of a safer replacement
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 52/100
Direzione di ricerca
Locate UserItem.CSVImport and its validate_file_for_import entry point, then inspect the samples/ callers and the existing _redact_password_column flow. Add the structured replacement and adapt the old method with its deprecation warning, ensuring the samples use the new method. Done means callers receive structured errors without raw field values while the legacy return shape remains available.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
validate_file_for_import is public API and its current shape invited the class of bug that #1829 patched. Proposing an additive replacement plus a deprecation on the existing method - no breaking change now, removal on the next major version.
Current signature:
def validate_file_for_import(csv_file, logger) -> tuple[int, list[str]]
Two problems with the shape:
- Logger as a parameter made #1829 possible in the first place - a caller-supplied verbose logger could receive credential material. Prefer a module logger with documented levels.
- Returning raw invalid lines forces callers to re-parse to give a useful error, and hands credential-bearing rows back to the caller (mitigated by
_redact_password_columnbut the shape invites the bug).
Proposed replacement:
@dataclass(frozen=True)
class CsvImportError:
row: int
column: ColumnType | None
reason: str # never the raw field value
@dataclass
class CsvImportResult:
valid_count: int
errors: list[CsvImportError]
@staticmethod
def validate_import_file(csv_file) -> CsvImportResult: ...
Migration:
- Add
validate_import_filereturning the structured result. - Reimplement
validate_file_for_importas a thin wrapper that emitsDeprecationWarningand adapts back to the old return shape. - Update
samples/to use the new method. - Remove the deprecated method on the next major version bump.
🤖 Generated with Claude Code
- Lingua principale
- Python
- Stelle
- 716
- Fork
- 446
- Merge medio
- 8g 8h
- PR unite (30g)
- 2
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di tableau/server-client-python
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
tableau/server-client-python#1865 ·
-
in-progress
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
tableau/server-client-python#1829 · 1 commento ·
-
enhancement gap needs investigation
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
tableau/server-client-python#1322 · 1 commento ·
-
[Type2] Allow Incremental Refresh type schedules to be added via `server.schedules.add_to_schedule` Apertahelp wanted Server-Side Enhancement ui-exists
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
tableau/server-client-python#1101 · 3 commenti ·
-
enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
tableau/server-client-python#783 · 5 commenti ·
Tutte le issue di tableau/server-client-python
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
-
🐛 Bug 🔔 Pending processing
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
jumpserver/jumpserver#17584 ·