python-server-pages

Nested loop syntax in python server pages

I am just trying to write a small web page that can parse some text using a regular expression and return the resulting matches in a table. This is the first I've used python for web development, and I have to say, it looks messy. My question is why do I only get output for the last match in my data set? I figure it has to be because th...

psp (python server pages) code under mod_wsgi?

Is there some way to run .psp (python server pages) code under apache + mod_wsgi? While we are moving towards newer wsgi based frameworks we still have some legacy code written in psp which runs under mod_python. We'd like to be able to run it on the same server that hosts other wsgi based python code. In short - is there a way to supp...

PSP class import + MySQL connect

Ok so im trying to import a class i made which connects to a MySQL database the class code is shown below: class connection def__init__( self ): self.cnx = MySQLdb.connect(user='xxx',host='xxx',passwd='xxx',db='xxx') All of the parameters for the mysql connection are correct and file containg the class is in the same direc...

Python: PSP & HTML tables

I have a python psp page code is shown below. Currently it only prints out the characters in single rows of 60, with the character count in the left column. <table> <% s = ''.join(aa[i] for i in table if i in aa) for i in range(0, len(s), 60): req.write('<tr><td><TT>%04d</td><td><TT>%s</TT></td></tr>' % (i+1, s[i:i+60])); #end %> </...

Python server pages, tables and lists

Hi, I am using MySQL and python server pages to show the data in a database. In the db I have selected this data: a list x =[1, 61, 121, 181, 241, 301] and a list of lists z = (['a','b'],['c','d'],['e','f'],['g','h'],['i','j'],['k','l']) and I would like to put these in a table to look like: 001 a b 061 c d 121 e f 181 g h 241 ...

Python: For loop problem

I have a PSP page with html embedded. I need to place another for loop so i can insert another %s next to background-color: which will instert a appropriate colour to colour in the html table. For example i need to insert for z in colours so it can loop over the colours list and insert the correct colour. Where ever i try to insert the ...

Not able to access parts of imported .PY in a .PSP

I'm trying to load a weather plugin for a website I'm working on. The weather plugin is a separate weather.py file located at /var/www/piss/plugins/base/weather.py. In the PSP it seems to import correctly, but I am unable to access any variables or objects from the weather.py plugin in the PSP. Here's the code I have: ...HTML an...

python server pages : reading text fields

hi , I am very new to PSP(python server pages) and I need some code that can read a textfield in a html file and save it into a file. I want to use multiple text fields and do the same for them. Thanks In Advance ...