GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Initial TDSX support. by t8y8 · Pull Request #44 · tableau/document-api-python

Conversation

@t8y8

@t8y8 t8y8 commented Jun 30, 2016

Copy link
Copy Markdown
Contributor

Lots of duplicated code with TWBX's. But it works.

So much so, I wouldn't really want to check this in as-is.

I have a vague idea of an ArchiveFile module to hold all the shared logic, or something along those lines.

Thoughts? @RussTheAerialist

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
t8y8 added 2 commits June 29, 2016 21:15
@t8y8
Initial TDSX support. Lots of duplicated code with TWBX's
9a8f0d1
@t8y8
Refactor all the archive manipulation logic into one module
bd6d3c9
t8y8
t8y8 reviewed Jun 30, 2016
View reviewed changes
Comment thread tableaudocumentapi/archivefile.py
@@ -0,0 +1,67 @@
import contextlib

@t8y8 t8y8 Jun 30, 2016

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

'archivefile' is obviously a terrible name

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@graysonarts graysonarts Jun 30, 2016 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

hah, containerfile? It's only a zip archive because of implementation details. Ultimately, it's a container file format.
(also, I'm horrible at naming things)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@t8y8 t8y8 Jun 30, 2016

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

containerfile works for me.

<Insert joke about naming things is hard here / >

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@benlower benlower Jun 30, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

what exactly are we trying to convey here? just that there is some kind of container (i.e. TDSX or TWBX) vs. a single file (TDS or TWB)?

if these containers will always end in "x" then let's call this xfile.py :)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@graysonarts graysonarts Jun 30, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Oh damn, @benlower with the winning name! we should go with xfiles

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
t8y8 added 2 commits June 30, 2016 09:33
@t8y8
Move save logic into helper function. Remove unused tests and methods…
8385b5c
… from Workbook class
@t8y8
Now find the file by checking if it's a workbook or datasource, and o…
cbcda8f
…pen the file directly from the zip instead of extracting multiple times
graysonarts
graysonarts reviewed Jun 30, 2016
View reviewed changes
Comment thread tableaudocumentapi/containerfile.py Outdated
xml_file = find_file_in_zip(zf, file_type)
xml_tree = ET.parse(os.path.join(temp, xml_file))
with zipfile.ZipFile(filename) as zf:
xml_file = zf.open(find_file_in_zip(zf))

@graysonarts graysonarts Jun 30, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Is this a context object also? Or does it automatically get closed when the zipfile is closed?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@t8y8 t8y8 Jun 30, 2016

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

You're right, it needs to be wrapped in a with

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@graysonarts

graysonarts commented Jun 30, 2016

Copy link
Copy Markdown
Contributor

one small comment about the zt.open usage, but otherwise LGTM.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

t8y8 added 2 commits June 30, 2016 12:12
@t8y8
ZipFile.open should be a context manager
813e079
@t8y8
Missed a spot with the context manager
be4c9c8
@t8y8

t8y8 commented Jun 30, 2016

Copy link
Copy Markdown
Contributor Author

@benlower @RussTheAerialist alright, the code is feeling much better -- but we have one last chance to call that module something else before merging.

Do we want to go with xfile :) ?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@t8y8
The truth is out there...
a885f15
@t8y8
t8y8 merged commit aba2a35 into tableau:development Jun 30, 2016
@t8y8 t8y8 mentioned this pull request Jun 30, 2016
Support for Packaged Files #22
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@t8y8 @graysonarts @benlower
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.