usage.csv escapes only limited characters

Bug #1158383 reported by Eric Peterson
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Medium
Tihomir Trifonov

Bug Description

horizon / openstack_dashboard / dashboards / admin / overview / templates / overview / usage.csv

Has escapes in there for limited CSV characters. However, there are still some characters (like line breaks) that can cause this template to not render csv data correctly.

Suggestion:
Using the native python csv library (http://docs.python.org/2/library/csv.html) and a more generic template like this:
{% autoescape off %}{{ csv }}{% endautoescape %}

Seems to work with a much larger set of csv data combinations.

Revision history for this message
Gabriel Hurley (gabriel-hurley) wrote :

I have to admit, I personally never touch the CSV feature in Horizon so I tend not to think about it much. That's a very good suggestion though. We'll definitely get that in H. Thanks!

Changed in horizon:
importance: Undecided → Medium
milestone: none → havana-1
status: New → Confirmed
Revision history for this message
Lin Hua Cheng (lin-hua-cheng) wrote :

As part of this change, we should also look into StreamingHttpResponse added in Django 1.5. This is useful for generating large CSV file.

https://docs.djangoproject.com/en/1.5/ref/request-response/#django.http.StreamingHttpResponse

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/29443

Changed in horizon:
assignee: nobody → Tihomir Trifonov (ttrifonov)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/29443
Committed: http://github.com/openstack/horizon/commit/a4e583cffbd2dbe2e431c306c389a0b0815073e1
Submitter: Jenkins
Branch: master

commit a4e583cffbd2dbe2e431c306c389a0b0815073e1
Author: Tihomir Trifonov <email address hidden>
Date: Wed May 22 11:02:04 2013 +0300

    Improvements in csv export for usage data

    Added a csv writer using the 'csv' library to format
    properly exported data - escaping, encoding etc.
    Added a HttpResponse-based class to handle csv generation
    Added translation for the CSV columns and template.
    Improved consistency for exported data - now passing project name
    instead of project id for csv export. Also added both project name/id
    in the header of a project usage export.

    Fix bug #1158383

    Renamed few occurencies of 'tenant' to project.

    Also added a new 'project' in nova_data.py, which required
    some refactoring of few tests, that didn't consider the current project
    for project-based calls.

    Note: I've added a StreamingHttpResponse example,
    which is introduced in Django 1.5+ and being advised in the ticket.
    However, my opinion is that at the moment we don't need this - it is
    too complicated for the current usage.

    Change-Id: Ic00626b273921fa5c6c89704b3a9e08b252aaeb0

Changed in horizon:
status: In Progress → Fix Committed
Revision history for this message
Julie Pichon (jpichon) wrote :

Reopening as the commit was reverted in ef26414b8d77827dc4d174acfe11699544a397e4 after a few regressions were discovered.

Changed in horizon:
status: Fix Committed → Triaged
milestone: havana-1 → havana-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/33947

Changed in horizon:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/33947
Committed: http://github.com/openstack/horizon/commit/0c0153a037594c6c98025f698e8593a01ed0ea2d
Submitter: Jenkins
Branch: master

commit 0c0153a037594c6c98025f698e8593a01ed0ea2d
Author: Tihomir Trifonov <email address hidden>
Date: Fri Jun 21 13:48:43 2013 +0300

    Improvements in csv export for usage data

    Added a csv writer using the 'csv' library to format
    properly exported data - escaping, encoding etc.
    Added a HttpResponse-based class to handle csv generation
    Added translation for the CSV columns and template.

    Fix bug #1158383

    Renamed few occurencies of 'tenant' to 'project'.

    Also added a new 'project' in nova_data.py, which required
    some refactoring of few tests, that didn't consider the current project
    for project-based calls.

    Note: I've added a StreamingHttpResponse example,
    which is introduced in Django 1.5+ and being advised in the ticket.
    However, my opinion is that at the moment we don't need this - it is
    too complicated for the current usage.

    Change-Id: I18bd70a23b7b8389c7c0f96dbf8794fea5e1e75b

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: havana-2 → 2013.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.