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

Enable export support for already opened files #125

Closed
wants to merge 8 commits into from

Conversation

jeanferri
Copy link
Contributor

No description provided.

@@ -18,6 +18,7 @@
from __future__ import unicode_literals

import datetime
import StringIO
Copy link
Owner

Choose a reason for hiding this comment

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

The StringIO module is gone on Python 3. We do not support it yet but using io.BytesIO or io.StringIO now will make the migration easier. Could you please change it?

@turicas
Copy link
Owner

turicas commented Oct 9, 2015

Hello, @jeanferri. Thanks for your contribution. :-)

I made two comments, can you please address them?
It would be good to include tests for these cases also. Could you please add one for each format? If you're not used to it or need any help just ask and I'll help you!

And a curiosity: what is your use case to need binary XLS data (instead of writing to the filesystem)? Are you going to use it to stream data over the Web?

Thanks again.

@jeanferri
Copy link
Contributor Author

Ok, I'll try to make compatible also with python3, because we are still using python 2.7 with Plone 4.3, and yes, I'm using it into an web application and it's because I dont need to write it to filesystem.

This last commit fix an error on older versions of urllib, for example, the original python-urllib3 package in the last Ubuntu LTS.

@jeanferri
Copy link
Contributor Author

May it #125 (comment) be like this last commit?

@turicas
Copy link
Owner

turicas commented Oct 14, 2015

@jeanferri, you can just use:

from io import BytesIO

And it will work on Python 2.7 and 3.x. ;-)
(there is no need to support Python < 2.7 in my opinion)

@jeanferri
Copy link
Contributor Author

Ok, you win! ;-)

@jeanferri
Copy link
Contributor Author

This last commit closes #80

@turicas
Copy link
Owner

turicas commented Oct 15, 2015

@jeanferri, I'm working on your branch but on my fork (feature/support-already-opened-files) and already rebased it with develop (I made some changes to develop since you created this PR).
There are some things I need to fix:

  • Do not read the whole CSV file to guess its Dialect (the first KiB may be enough)
  • Use the whole Dialect object instead of delimiter only
  • Add tests for automatic Dialect detection
  • Refactor export code in order to create a function in rows.plugins.utils
  • Add tests for already opened files (JSON, CSV, TXT and XLS plugins)
  • Add support for other plugins and its respective tests (HTML) -- SQLite is not needed

I'll work on this list on the next days.

@turicas
Copy link
Owner

turicas commented Oct 17, 2015

@jeanferri, I updated my branch. There are some tests missing and I'll work on this tomorrow.

@turicas
Copy link
Owner

turicas commented Oct 19, 2015

@jeanferri, I merged my branch into develop (05b0e39), but GitHub didn't detected the change on this PR because I made a git rebase and the commits created were different from this PR, but your code was improved and merged anyway. :) So, I'm closing this PR manually.

Thanks!

@turicas turicas closed this Oct 19, 2015
@turicas turicas self-assigned this Oct 19, 2015
@jeanferri
Copy link
Contributor Author

Ok, thank you! I'll test it and send you another pull request with more things I'm doing... ;-)

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.

None yet

2 participants