Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jac/filter spaces #225

Merged
merged 3 commits into from
Feb 2, 2023
Merged

Jac/filter spaces #225

merged 3 commits into from
Feb 2, 2023

Conversation

jacalata
Copy link
Contributor

@jacalata jacalata commented Feb 1, 2023

fixes #176
Example export:

tabcmd export extract-data-access/Sheet1?Parameters.Product=Earl%20Grey,Chamomile --pdf

result contains only two columns for two products.

Write tests for methods in ds_and_wb class, including a failing test that expects the view_filter to be un-encoded
The logic of the fix is in ds_and_wb:82

Also refactored some methods to get consistent order of args.
@github-actions
Copy link

github-actions bot commented Feb 1, 2023

Coverage

Coverage Report
FileStmtsMissCoverMissing
tabcmd
   __main__.py888 0%
   tabcmd.py151515 0%
   version.py633 50%
tabcmd/commands
   commands.py101010 0%
   constants.py6799 87%
   server.py1262525 80%
tabcmd/commands/auth
   session.py3444848 86%
tabcmd/commands/datasources_and_workbooks
   datasources_and_workbooks_command.py1171313 89%
   delete_command.py601616 73%
   export_command.py1252727 78%
   get_url_command.py1906262 67%
   publish_command.py661919 71%
   runschedule_command.py2177 67%
tabcmd/commands/extracts
   create_extracts_command.py4388 81%
   decrypt_extracts_command.py2722 93%
   delete_extracts_command.py3766 84%
   encrypt_extracts_command.py2722 93%
   reencrypt_extracts_command.py2722 93%
   refresh_extracts_command.py682626 62%
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.py2844 86%
tabcmd/commands/site
   create_site_command.py3455 85%
   delete_site_command.py2822 93%
   edit_site_command.py3822 95%
   list_command.py382121 45%
   list_sites_command.py3022 93%
tabcmd/commands/user
   create_site_users.py571010 82%
   create_users_command.py601010 83%
   delete_site_users_command.py4355 88%
   user_data.py2203030 86%
tabcmd/execution
   _version.py222 0%
   global_options.py1472525 83%
   localize.py6788 88%
   logger_config.py4266 86%
   tabcmd_controller.py3344 88%
TOTAL256546382% 

# only applicable for png
logger.warn("Height/width arguments not yet implemented in export")
except AttributeError as ae:
logger.debug("Unexpected: no user or default value is present: {}".format(ae.__str__()))
# Always request high-res images
request_options.image_resolution = "high"

@staticmethod
def apply_pdf_options(request_options: TSC.PDFRequestOptions, args, logger):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you want to reorder the arguments on this method too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes :)

# only applicable for png
logger.warn("Height/width arguments not yet implemented in export")
except AttributeError as ae:
logger.debug("Unexpected: no user or default value is present: {}".format(ae.__str__()))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this messaging correct? What is user in this context?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't expect to get here because argparse should set a default value for these options. The message means there is no user-set value or default value

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooooh, gotcha. English is hard. I read it as "There is no user" || "There is no default value" :) Maybe change user to user-specified?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up just deleting it - I realized that if they aren't set, I would have hit this error well before we get here anyway!

else: # it must be a filter
DatasourcesAndWorkbooks.apply_filter_value(request_options, value, logger)
# the REST API doesn't appear to have the option to disambiguate with "Parameter.<fieldname>"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double checking. The comment says Parameter. but the code uses the plural Parameters.

- removed super defensive exception catching
- stopped sending filters for workbooks
- CR feedback
@jacalata jacalata merged commit c261d76 into development Feb 2, 2023
@jacalata jacalata deleted the jac/filter-spaces branch February 17, 2023 23:10
jacalata added a commit that referenced this pull request Jul 28, 2023
Fixes, code enhancements
* remove lowercase call while parsing csv for adding users
* set user agent (#219)
* Add and clean up logging, always include version in logs (#234, #224)
* Encoding filter values to handle spaces and special chars in filters  (#225)
* replace polling code with library call
* readme updates (#235)
* Read and warn when user sets thumbnail options. (including 'not yet implemented' message for --thumbnail-group)
* freeze tsc dependency (#248)

New functionality
* added new --filter option to pass in un-encoded value for simpler input
* Add --url, --include-all/--embedded-datasources for create/refresh/delete extract commands (#227)
* Add new command for listing content on the site (#230)
* Implement publishing options overwrite/append/replace arguments (including not-yet-implemented message for --replace) (#236)
* implement --proxy, --no-proxy,  --use-certificate option  (#241)
* add --token-file option (#243)

---------

Co-authored-by: Bhuvnesh Singh <bhuvnesh.singh@salesforce.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants