Skip to content

Conversation

@t8y8
Copy link
Collaborator

@t8y8 t8y8 commented Jan 6, 2017

Addresses #55

This is just the decorator, I manually tested with the users.get endpoint and a script.

Once we add the annotation to the actual endpoints this will get automagically covered by all existing tests. I can make a unittest that mocks everything to test this method, but that doesn't feel super useful (It'd literally be testing does < work).

I think I'd like to break it into two PRs, add this method first, and in the second PR add the annotations and and ensure existing tests still pass

Open to feedback on the exception name and where I put this method -- but endpoint felt like the most natural place for it

/cc @RussTheAerialist @LGraber

'''Annotate the minimum supported version for an endpoint.
Checks the version on the server object and does a float comparison.
It will raise an exception if the server vesion is > the version specified.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

'vesion' -> 'version' typo

@wraps(func)
def wrapper(self, *args, **kwargs):
server_version = self.parent_srv.version
if float(server_version) < version:
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use https://docs.python.org/3.6/distutils/apiref.html#module-distutils.version to compare version numbers. Casting to float will break if/when we decide to be more nuanced with your version numbers.

@@ -1,4 +1,4 @@
from .endpoint import Endpoint
from .endpoint import Endpoint, api
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you actually use api anywhere?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oops, this was left over from my manual test script

@t8y8 t8y8 force-pushed the 55-feature-api-decorator branch from 245f88e to 87d0686 Compare January 6, 2017 23:24
Copy link
Contributor

@graysonarts graysonarts left a comment

Choose a reason for hiding this comment

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

🚀

@t8y8 t8y8 merged commit ee7b70b into tableau:development Jan 6, 2017
@t8y8 t8y8 deleted the 55-feature-api-decorator branch January 6, 2017 23:43
bryceglarsen pushed a commit to bryceglarsen/server-client-python that referenced this pull request Dec 28, 2023
* Fix tableau#117 by only attempting files with the right extension inside the archive (tableau#118)

* Commenting and Docstring cleanup. A few very small code cleanups (tableau#120)

Add docstrings and remove clutter. I also made some very tiny tweaks to some code for clarity.

* Small cleanups for various editors. Play nice with built in test-runners (tableau#121)

* Add Py36, update travis to use pycodestyle (tableau#124)

* Add `initial sql` and `query band` support (tableau#123)

Addresses tableau#109 and tableau#110

* Prep for release of 0.6 (tableau#125)

* Prep for release of 0.6

* wordsmithing the changelog
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