Skip to content

Regenerate .mo catalogs after #458 backport - #469

Open
jacalata wants to merge 10 commits into
developmentfrom
jac/regen-mo-post-458
Open

Regenerate .mo catalogs after #458 backport#469
jacalata wants to merge 10 commits into
developmentfrom
jac/regen-mo-post-458

Conversation

@jacalata

Copy link
Copy Markdown
Contributor

Second in the #467 backport-split (PR B). Stacked on top of PR A (#467, jac/fix-publish-embed-creds).

What this does

Runs doit localize to regenerate tabcmd/locales/*/LC_MESSAGES/tabcmd.mo from the .properties files. #458 added publish.options.db-server to en/tabcmd_messages_en.properties but did not refresh the compiled English .mo binary — so users currently see the raw msgid key in tabcmd publish --help.

Verification

gettext.translation("tabcmd", localedir="tabcmd/locales", languages=["en"]).gettext("publish.options.db-server") returns the English message, not the raw key.

Stacked-PR notes

  • Base is jac/fix-publish-embed-creds (PR A). Rebase to development after A merges.
  • PR C (guard + tests + review polish) stacks on top of this branch and will add another key (publish.errors.db_server_required), which will require another .mo regeneration in that PR.

🤖 Generated with Claude Code

fujihara and others added 9 commits September 8, 2026 18:01
* Require --db-server for embedded credentials/oauth workbook publishing, fix connections payload

* Translations for publish.options.db-server message

* Simplify changes

* Adjust tests
PR #458 fixed the two publish crashes when using --db-username /
--db-password / --save-db-password, but callers who omit --db-server
still hit a raw ValueError from tableauserverclient's
_add_connections_element. Fail fast in run_command with a clear,
localizable message before we build the ConnectionItem so users get
an actionable error instead of an internal stack trace.

Update the existing no-db-server test to assert the exit path and add
the parallel coverage for the --oauth-username branch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Extend the online publish suite with:

- A positive assertion for the happy path: test_wb_publish_embedded now
  passes --db-server matching the connection host baked into
  EmbeddedCredentials.twb (see-internal-slack). Without a matching
  server_address, tableauserverclient silently drops the embedded
  credentials at publish time, so covering the match is what actually
  proves the fix.
- A negative assertion: test_wb_publish_embedded_missing_db_server_fails
  runs publish with --db-username but no --db-server and expects a
  non-zero exit. The check now fires in run_command before any network
  work, so hardcoded placeholder creds are sufficient.

Threads a db_server keyword through the _publish_creds_args helper and
records the workbook's connection host as a class constant.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Scope the guard to workbook publishes only. Datasource publishes go
through _add_credentials_element on the TSC side, which never requires
server_address, so the previous unconditional check was a regression
for `tabcmd publish live_mysql.tds --db-username ...` and similar.
The guard now checks the target filename extension early (before auth,
for fast failure) and repeats per-file inside the workbook branch of
the loop for the folder-publish case.

Rename the `credentials` parameter of `publish_workbook_file` to
`connection` — it holds a single ConnectionItem, not a list.

Tests:
- Add test_publish_with_oauth_creds covering the oauth branch's
  server_address assignment (previously untested).
- Add test_publish_datasource_with_db_username_no_db_server verifying
  datasource publishes are not blocked when --db-server is omitted.
- Strengthen the e2e negative test to run tabcmd via subprocess.run,
  capture stdout/stderr, and assert on the localized guard message
  (or the raw key when .mo has not been regenerated). Any earlier
  unrelated failure — bad auth, missing asset, session expiry — now
  fails the test rather than passing it.
- Trim the misleading class-constant comment on TWB_FILE_EMBEDDED_
  CONNECTION_SERVER; reword the "before we touch the database" comment
  to reference the guard's contract instead of a specific location.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The success-print branch referenced uniques instead of unique_lines,
breaking doit properties when input files contained no non-'=' non-
codestring lines.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Compiles the new `publish.options.db-server` help-text key added by #458
(backported in PR A) into the runtime gettext catalogs. Without this,
English users see the raw msgid key in `tabcmd publish --help`.

Non-English locales fall back to English until translators supply their
versions.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Base automatically changed from jac/fix-publish-embed-creds to development September 10, 2026 23:09
…ost-458

# Conflicts:
#	tabcmd/locales/de/LC_MESSAGES/tabcmd.mo
#	tabcmd/locales/es/LC_MESSAGES/tabcmd.mo
#	tabcmd/locales/fr/LC_MESSAGES/tabcmd.mo
#	tabcmd/locales/ga/LC_MESSAGES/tabcmd.mo
#	tabcmd/locales/it/LC_MESSAGES/tabcmd.mo
#	tabcmd/locales/ja/LC_MESSAGES/tabcmd.mo
#	tabcmd/locales/ko/LC_MESSAGES/tabcmd.mo
#	tabcmd/locales/pt/LC_MESSAGES/tabcmd.mo
#	tabcmd/locales/sv/LC_MESSAGES/tabcmd.mo
#	tabcmd/locales/zh/LC_MESSAGES/tabcmd.mo
@github-actions

Copy link
Copy Markdown

Coverage

Coverage Report
FileStmtsMissCoverMissing
tabcmd
   __main__.py121212 0%
   _version.py111111 0%
   tabcmd.py151515 0%
   version.py955 44%
tabcmd/commands
   commands.py101010 0%
   constants.py771818 77%
   server.py1351818 87%
tabcmd/commands/auth
   session.py3945050 87%
tabcmd/commands/datasources_and_workbooks
   datasources_and_workbooks_command.py1571818 89%
   datasources_workbooks_views_url_parser.py14255 96%
   delete_command.py601616 73%
   export_command.py1202525 79%
   get_url_command.py1274747 63%
   publish_command.py1252929 77%
   runschedule_command.py2177 67%
tabcmd/commands/extracts
   create_extracts_command.py4288 81%
   decrypt_extracts_command.py2722 93%
   delete_extracts_command.py3766 84%
   encrypt_extracts_command.py2722 93%
   extracts.py2022 90%
   reencrypt_extracts_command.py2722 93%
   refresh_extracts_command.py481010 79%
tabcmd/commands/group
   create_group_command.py2955 83%
   delete_group_command.py2722 93%
tabcmd/commands/project
   create_project_command.py4688 83%
   delete_project_command.py3544 89%
   publish_samples_command.py3044 87%
tabcmd/commands/site
   create_site_command.py3455 85%
   delete_site_command.py2722 93%
   edit_site_command.py3822 95%
   list_command.py771212 84%
   list_sites_command.py2922 93%
tabcmd/commands/user
   add_users_command.py2955 83%
   create_site_users.py581111 81%
   create_users_command.py5999 85%
   delete_site_users_command.py4355 88%
   user_data.py2223131 86%
tabcmd/execution
   _version.py222 0%
   global_options.py12688 94%
   localize.py661111 83%
   logger_config.py6066 90%
   tabcmd_controller.py4277 83%
TOTAL287645984% 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants