Show CSV

Purpose

This macro is used to show csv data as wiki table

Download & Release Notes

Download

Release Version

Moin Version

Release Notes

ShowCSV-1.6.py

1.6

ShowCSV.py

1.5.8

Syntax

[[ShowCSV]]

optional as argument the extension could be entered, default is '.csv'.

Example

[[ShowCSV]]

Example image

showcsv.png

ReimarBauer

License

Comment

UTF-8

As far as I see this macro is not utf-8 compatible. So it's not possible to integrate csv data with umlauts and other chars. Belive could be fixed if use some other other open method and unicode strings u"..., but well i'm just a pyton newbee.

f = codecs.open("dateiname.txt", "r", "utf-8") 

-- MarcelHäfner 2007-10-09 09:42:03

yeah your are right. Sometimes I do miss thats utf-8 isn't default. We need some more lines from http://docs.python.org/lib/csv-examples.html -- ReimarBauer 2007-10-27 09:32:50

Empty Cells

I've tried this with a CSV file that contained a lot of empty cells, e.g. "a,,,d". The resulting table combined the last cell with a value and all following empty cells. Is this behavior intended? I would have expected that in this case the table just contains empty cells.

BTW, the default extension seems to be '.csv' an not '.nas' as described above.

-- AnkeHeinrich 2007-10-12 07:39:14

ShowCSV2

I changed the macro a bit; so it's now possible to add some delimiter and chose the extension. It works with Python 2.5 and MoinMoin 1.7.x.

Example:

<<ShowCSV2(delimiter=semicolon,extension=csv)>>

Parameters:

Download: ShowCSV2.py

{i} I'm "newbie" to python coding; so mercy for my poor code, thx!

Copyrights

Do what you want; maybe some stuff/ideas could be used for the "official" macro. -- MarcelHäfner 2008-07-21 20:03:50

Discussion

in 1.7 the csv parser can be used.

1 1
2 3

or

1 1
2 3

it can also be used to parse attachments

ID Brief Text Design Manual Coding Test Spec Test Comment
12 Verify IP OK IP IP(A) Diff working?
13 Server Setup OP Check(M) OP OK
14 Audit Trail Check(K) OP Check(M) IP(M)
15 CSV Load OK OK OK
16 Import/Export Check(K) OK OK
17 Summery Status OP OP OK
18 Cyclic Dependency OP Check(A) OP Check(A) Mandatory columns correct?
Manual: Initial Object Status N/A OP N/A N/A
numeric fields OP
Dynamic Lists OK
Jump to beginning OP
dummy.csv

While I was writing the macro JohannesBerg has extended the old csv parser. Later on we have added the sniffer for getting the delimiter. I think the macro is obsolete in 1.7. I have to apologize for not adding this note earlier, I just forgot it.

Anyway if macros are refactored to 1.7 the argument parser should be involved. That makes it much easier. Look for examples at the macro EmbedObject of 1.7 or MacroMarket/HelloWorld-1.7.

-- ReimarBauer 2008-07-21 20:51:36

Thanks to ReimarBauer I found a solution: Just patch your wikiutil.py file and search for   MIMETYPES_MORE  and add there something like:

'.csv': 'text/csv',

bye -- MarcelHäfner 2008-07-22 20:13:15

MoinMoin: MacroMarket/ShowCSV (last edited 2008-07-22 20:13:16 by MarcelHäfner)