Repository navigation
PARAF-550: Formalised the sent filename generation in ISignable.get_filename - #49
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe change formalizes annex filename generation through ChangesFilename generation
Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant SessionUpdate
participant AnnexParent
participant ISignable
participant SignableAdapter
SessionUpdate->>AnnexParent: resolve annex parent
SessionUpdate->>ISignable: obtain parent adapter
ISignable->>SignableAdapter: generate filename
SignableAdapter-->>SessionUpdate: return unique filename
Suggested reviewers: Merge Risk: ⚪ Minimal · up to Filenames remain compatible with the session payload because target identifiers are sent separately. No actionable merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 55.56% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 4 files. (2 skipped: 2 unsupported.)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Coverage Report for CI Build 35195093396Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage decreased (-0.02%) to 86.824%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
3495acf to
24b0d77
Compare
24b0d77 to
5701297
Compare
|
@gbastien J'ai ajouté l'adapter pour facilement renommer les fichiers envoyés au MS. Dans Docs, on ajoute "__" au fichiers convertis dans |
gbastien
left a comment
There was a problem hiding this comment.
Ca me semble OK!
On peut merger comme çà et adapter par la suite si on voit qu'on peut passer un filename + title à part vers Cosi...
Merci pour le boulot!
| # a name already used in the session gets a numbered suffix | ||
| self.assertEqual(adapter.get_filename(annex, existing_files=["annex0"]), u"annex0-1.pdf") | ||
| self.assertEqual(adapter.get_filename(annex, existing_files=["annex0", "annex0-1"]), u"annex0-2.pdf") | ||
| # a __<uid> suffix is kept: imio.zamqp parses it back |
There was a problem hiding this comment.
Ce fonctionnement est propre à dmsmail mais çà pourrait devenir le fonctionnement de base (pas inutile d'avoir l'uid dans le nom du fichier en cas de debug ou autre) mais le problème actuellement c'est que çà apparaît sans doute dans l'interface de Cosi (à vérifier), si il y a la notion de "friendly pdf name" dans Cosi avec possibilité d'afficher un titre qui n'est pas l'id du fichier pdf, çà pourrait rentrer dans le comportement par défaut...
| filename, ext = path.splitext(annex.file.filename) | ||
| new_filename = get_correct_id(existing_files, filename) | ||
| file_data["filename"] = new_filename + ext | ||
| existing_files = [ |
There was a problem hiding this comment.
Ici le if f["uid"] != annex_uid peut être utile si le nom précédent correspond au nouveau nom généré par get_correct_id, donc bien vu, mais on pourrait même ajouter un test :-)

PARAF-550
ISignable.get_filename(annex, existing_files)replaces the hardcodedget_correct_id(...)inadd_files_to_session, so applications can name the files sent to the signing service. It gets the annex, not just its filename, so the adapter owns the whole name.The default implementation reproduces the previous behaviour exactly — no existing test assertion needed updating, and
imio.dms.mailneeds no override.Also:
events.on_categorized_annex_updatednow goes through the adapter too. It recomputed the filename with rawget_correct_id, so any rename silently reverted on the next annex edit.existing_files, so a deduplicated name no longer drifts-1 → -2 → -3on repeated modifications.SignableAdapterregisteredfor="*"inconfigure.zcml(wastesting.zcmlonly), otherwiseISignable(obj)raisesCould not adaptoutsideimio.dms.mail.__<uid>suffix. The signed file comes back under that name andimio.zamqp.dms/consumer.py:301parses the uid out of it to find the file to update — no uid, and the PDF is silently discarded.imio.dms.mailstill owns the suffix (adapters.py:1954); the constraint is documented in the docstring, not enforced.events.pychanges have no test — verified by mutation that the existing suite stays green if they regress.Summary by CodeRabbit
New Features
Bug Fixes