Export a .csv file using web.py – (python:))

December 22nd, 2009 No Comments   Posted in Scripts for Testing

This script is for Exporting a csv file and get the browser to recognize that its a csv file and popups the download window with web.py. Lets say we have a database with a table called users and you want to create a csv file that contains all the users with their names and id’s here is how you do it.

class export:
def GET(self):
i = web.input()

users = web.select(’users‘, vars=locals())

csv = []
csv.append(”id,name\n“)
for user in users:
row = []
row.append(user.id)
row.append(user.name)

csv.append(”,“.join(row))
#writer.writerow(row)

#f.close()

web.header(’Content-Type‘,’text/csv‘)
web.header(’Content-disposition‘, ‘attachment; filename=export.csv‘)
print “”.join(csv)
return

  • Share/Bookmark

Tags: ,

Script to see if Perl is working ! :E !

perl01

There are 2 ways to Test if Perl is working properly on your system. More »

  • Share/Bookmark

Tags: , ,

Data Driven testing using selenium !

October 2nd, 2009 No Comments   Posted in Scripts for Testing, Testing Tools

This post will also be in the new blog dedicated to Selenium <- coming soon

You will have to record your script using Selenium IDE in firefox browser

Then export the script in any of the programming languages in which you are comfortable….(Hope you know how to export since you are using that tool now, that’s why you are reading this post :P ) More »

  • Share/Bookmark
Get Adobe Flash playerPlugin by wpburn.com wordpress themes