GeezerVison is showing github.com — Merge pull request #108 from tableau/development · dev-mkc19/document-api-python@96d8967
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: CHANGELOG.md +6Lines changed: 6 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +## 05 (01 November 2016) | | 2 | + | | 3 | +* Added ability to set the port for connections (#97) | | 4 | +* Added ability to read and write caption for datasources (#99) | | 5 | +* Added documentation | | 6 | + | 1 | 7 | ## 0.4 (07 October 2016) | 2 | 8 |
| 3 | 9 | * Add ability to remove repository location (#86) | |
Collapse file Copy file name to clipboardExpand all lines: contributing.md -33Lines changed: 0 additions & 33 deletions Collapse file Copy file name to clipboard +1Lines changed: 1 addition & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +docs/docs/contributing.md |
Collapse file Copy file name to clipboardExpand all lines: docs/_config.yml +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | # Site settings | 2 | 2 | title: Tableau Document API | 3 | | -email: jdominguez@tableau.com | | 3 | +email: github@tableau.com | 4 | 4 | description: Programmatically update your Tableau workbooks and data sources. | 5 | 5 | baseurl: "/document-api-python" | 6 | 6 | permalinks: pretty | |
Collapse file Copy file name to clipboardExpand all lines: docs/_layouts/docs.html +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 17 | 17 | <div class="content .col-xs-12 .col-sm-8 .col-md-9"> | 18 | 18 | <h1>{{ page.title }}</h1> | 19 | 19 | <div class="edit-container"> | 20 | | - <a href="https://github.com/tableau/document-api-python/edit/master/{{ page.path }}" class="edit-links"><span class="glyphicon glyphicon-pencil"></span> Edit this page</a> | | 20 | + <a href="https://github.com/tableau/document-api-python/edit/master/docs/{{ page.path }}" class="edit-links"><span class="glyphicon glyphicon-pencil"></span> Edit this page</a> | 21 | 21 | | 22 | 22 | <a href="https://github.com/tableau/document-api-python/issues" class="edit-links"><span class="glyphicon glyphicon-flag"></span> Submit an issue</a> | 23 | 23 | </div> | |
Collapse file Copy file name to clipboardExpand all lines: docs/docs/contributing.md +1Lines changed: 1 addition & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 2 | 2 | title: Contributing | 3 | 3 | layout: docs | 4 | 4 | --- | | 5 | +# Contributing | 5 | 6 |
| 6 | 7 | We welcome contributions to this project! | 7 | 8 |
| |
Collapse file Copy file name to clipboardExpand all lines: docs/docs/dev-guide.md +34-18Lines changed: 34 additions & 18 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -3,51 +3,67 @@ title: Developer Guide | 3 | 3 | layout: docs | 4 | 4 | --- | 5 | 5 |
| 6 | | -### Making your first patch | | 6 | +<<<<<<< 6ee666bf06d5ab59931100b3955779c35693e33f | | 7 | +## Submitting your first patch | 7 | 8 |
| 8 | | -1. Make sure you've signed the CLA | | 9 | +1. Make sure you have [signed the CLA](http://tableau.github.io/#contributor-license-agreement-cla) | 9 | 10 |
| 10 | | -1. Clone the repo | | 11 | +1. Fork the repository. | | 12 | + | | 13 | + We follow the "Fork and Pull" model as described [here](https://help.github.com/articles/about-collaborative-development-models/). | | 14 | + | | 15 | +1. Clone your fork: | 11 | 16 |
| 12 | 17 | ```shell | 13 | | - git clone http://github.com/tableau/document-api-python | | 18 | + git clone http://github.com/<your_username>/document-api-python | 14 | 19 | ``` | 15 | 20 |
| 16 | | -1. Run the tests to make sure everything is peachy | | 21 | +1. Run the tests to make sure everything is peachy: | 17 | 22 |
| 18 | 23 | ```shell | 19 | 24 | python setup.py test | 20 | 25 | ``` | 21 | 26 |
| 22 | 27 | 1. Set up the feature, fix, or documentation branch. | 23 | 28 |
| 24 | | - It is recommended to use the format [issue#]-[type]-[description] (e.g. 13-fix-connection-bug) | | 29 | + It is recommended to use the format issue#-type-description (e.g. 13-fix-connection-bug) like so: | 25 | 30 |
| 26 | 31 | ```shell | 27 | 32 | git checkout -b 13-feature-new-stuff | 28 | 33 | ``` | 29 | 34 |
| 30 | | -1. Code and Commit! | | 35 | +1. Code and commit! | | 36 | + | | 37 | + Here's a quick checklist for ensuring a good pull request: | | 38 | + | | 39 | + - Only touch the minimal amount of files possible while still accomplishing the goal. | | 40 | + - Ensure all indentation is done as 4-spaces and your editor is set to unix line endings. | | 41 | + - The code matches PEP8 style guides. If you cloned the repo you can run `pycodestyle .` | | 42 | + - Keep commit messages clean and descriptive. | | 43 | + If the PR is accepted it will get 'Squashed' into a single commit before merging, the commit messages will be used to generate the Merge commit message. | 31 | 44 |
| 32 | | - Here's a quick checklist for ensuring a good diff: | | 45 | +1. Add tests. | 33 | 46 |
| 34 | | - - The diff touches the minimal amount of files possible while still fufilling the purpose of the diff | 35 | | - - The diff uses Unix line endings | 36 | | - - The diff adheres to our PEP8 style guides. If you've cloned the repo you can run `pycodestyle .` | | 47 | + All of our tests live under the `test/` folder in the repository. | | 48 | + We use `unittest` and the built-in test runner `python setup.py test`. | | 49 | + If a test needs a static file, like a twb/twbx, it should live under `test/assets/` | 37 | 50 |
| 38 | | -1. Add Tests | | 51 | +1. Update the documentation. | 39 | 52 |
| 40 | | -1. Update Documentation | | 53 | + Our documentation is written in markdown and built with Jekyll on Github Pages. All of the documentation source files can be found in `docs/docs`. | 41 | 54 |
| 42 | | - Our documentation is written in markdown and built with [Mkdocs](http://www.mkdocs.org). More information on how to update and build the docs can be found [here](#updating-documentation) | | 55 | + When adding a new feature or improving existing functionality we may ask that you update the documentation along with your code. | | 56 | + | | 57 | + If you are just making a PR for documentation updates (adding new docs, fixing typos, improving wording) the easiest method is to use the built in `Edit this file` in the Github UI | 43 | 58 |
| 44 | | -1. Run the tests again and make sure they pass! | | 59 | +1. Submit to your fork. | 45 | 60 |
| 46 | | -1. Submit to your fork | | 61 | +1. Make a PR as described [here](https://help.github.com/articles/creating-a-pull-request-from-a-fork/) against the 'development' branch. | 47 | 62 |
| 48 | | -1. Submit a PR | | 63 | +1. Wait for a review and address any feedback. | | 64 | + While we try and stay on top of all issues and PRs it might take a few days for someone to respond. Politely pinging the PR after a few days with no response is OK, we'll try and respond with a timeline as soon as we are able. | 49 | 65 |
| 50 | | -1. Wait for a review, and address any feedback. | | 66 | +1. That's it! When the PR has received :rocket:'s from members of the core team they will merge the PR | 51 | 67 |
| 52 | 68 | <!-- | 53 | 69 | ### Updating Documentation | |
Collapse file Copy file name to clipboardExpand all lines: setup.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 5 | 5 |
| 6 | 6 | setup( | 7 | 7 | name='tableaudocumentapi', | 8 | | - version='0.4', | | 8 | + version='0.5', | 9 | 9 | author='Tableau', | 10 | 10 | | 11 | 11 | url='https://github.com/tableau/document-api-python', | |
Collapse file Copy file name to clipboardExpand all lines: tableaudocumentapi/connection.py +22-1Lines changed: 22 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -30,18 +30,20 @@ def __init__(self, connxml): | 30 | 30 | self._username = connxml.get('username') | 31 | 31 | self._authentication = connxml.get('authentication') | 32 | 32 | self._class = connxml.get('class') | | 33 | + self._port = connxml.get('port', None) | 33 | 34 |
| 34 | 35 | def __repr__(self): | 35 | 36 | return "'<Connection server='{}' dbname='{}' @ {}>'".format(self._server, self._dbname, hex(id(self))) | 36 | 37 |
| 37 | 38 | @classmethod | 38 | | - def from_attributes(cls, server, dbname, username, dbclass, authentication=''): | | 39 | + def from_attributes(cls, server, dbname, username, dbclass, port=None, authentication=''): | 39 | 40 | root = ET.Element('connection', authentication=authentication) | 40 | 41 | xml = cls(root) | 41 | 42 | xml.server = server | 42 | 43 | xml.dbname = dbname | 43 | 44 | xml.username = username | 44 | 45 | xml.dbclass = dbclass | | 46 | + xml.port = port | 45 | 47 |
| 46 | 48 | return xml | 47 | 49 |
| @@ -133,3 +135,22 @@ def dbclass(self, value): | 133 | 135 |
| 134 | 136 | self._class = value | 135 | 137 | self._connectionXML.set('class', value) | | 138 | + | | 139 | + ########### | | 140 | + # port | | 141 | + ########### | | 142 | + @property | | 143 | + def port(self): | | 144 | + return self._port | | 145 | + | | 146 | + @port.setter | | 147 | + def port(self, value): | | 148 | + self._port = value | | 149 | + # If port is None we remove the element and don't write it to XML | | 150 | + if value is None: | | 151 | + try: | | 152 | + del self._connectionXML.attrib['port'] | | 153 | + except KeyError: | | 154 | + pass | | 155 | + else: | | 156 | + self._connectionXML.set('port', value) |
Collapse file Copy file name to clipboardExpand all lines: tableaudocumentapi/datasource.py +15Lines changed: 15 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -137,6 +137,7 @@ def __init__(self, dsxml, filename=None): | 137 | 137 | self._name = self._datasourceXML.get('name') or self._datasourceXML.get( | 138 | 138 | 'formatted-name') # TDS files don't have a name attribute | 139 | 139 | self._version = self._datasourceXML.get('version') | | 140 | + self._caption = self._datasourceXML.get('caption', '') | 140 | 141 | self._connection_parser = ConnectionParser( | 141 | 142 | self._datasourceXML, version=self._version) | 142 | 143 | self._connections = self._connection_parser.get_connections() | @@ -207,6 +208,20 @@ def name(self): | 207 | 208 | def version(self): | 208 | 209 | return self._version | 209 | 210 |
| | 211 | + @property | | 212 | + def caption(self): | | 213 | + return self._caption | | 214 | + | | 215 | + @caption.setter | | 216 | + def caption(self, value): | | 217 | + self._datasourceXML.set('caption', value) | | 218 | + self._caption = value | | 219 | + | | 220 | + @caption.deleter | | 221 | + def caption(self): | | 222 | + del self._datasourceXML.attrib['caption'] | | 223 | + self._caption = '' | | 224 | + | 210 | 225 | ########### | 211 | 226 | # connections | 212 | 227 | ########### | |
|