removing cgi fieldstorage keys

2006-04-18 Thread Kun
i don't know what happened but all of a sudden, my cgi.fieldstorage has two extra keys, 'x' and 'y', does anyone know how i can remove them in python? -- http://mail.python.org/mailman/listinfo/python-list

scanning for numerals / letters

2006-04-18 Thread Kun
I have the following if statement that checks if a form is empty: if form.has_key("date") and form["date"].value != "": date=form['date'].value else: print "ERROR: No date entered!" raise Exception I would also like to add another if statement checking if 'da

Re: scanning through page and replacing all instances of 00:00:00.00

2006-04-17 Thread Kun
Tim Chase wrote: >> for col in range(0, numcols): >> print "", record[col], "" > > This is the point at which you want to intercept the column data and > make your change: > > print "", str(record[col]).replace("00:00:00.0", ""), " > If it's possible/plausible that other fie

Re: scanning through page and replacing all instances of 00:00:00.00

2006-04-17 Thread Kun
[EMAIL PROTECTED] wrote: > Kun> i have the following python-cgi which extracts data from a mysql > Kun> table, how do i parse the date so that it doesn't display the time > Kun> '00:00:00.00'? > > I have no idea which column in your table is a da

Re: scanning through page and replacing all instances of 00:00:00.00

2006-04-17 Thread Kun
Fredrik Lundh wrote: > "Kun" wrote: > >> because in my sql database, the date is only 'date' (as in -mm-dd), >> only when i extract it with my python-cgi does the date turn into >> (-mm-dd 00:00:00.00), thus i figured the best way to fix thi

Re: scanning through page and replacing all instances of 00:00:00.00

2006-04-17 Thread Kun
Fredrik Lundh wrote: > "Kun" wrote: > >> I have a python-cgi file that pulls data from an sql database, i am >> wondering what is the easiest way to remove all instances of >> '00:00:00.00' in my date column. >> >> how would i writ

scanning through page and replacing all instances of 00:00:00.00

2006-04-17 Thread Kun
I have a python-cgi file that pulls data from an sql database, i am wondering what is the easiest way to remove all instances of '00:00:00.00' in my date column. how would i write a python script to scan the entire page and delete all instances of '00:00:00.00', would i use regular expressions?

attaching an excel file using MIME in smtp

2006-04-16 Thread Kun
does anyone know how to attach an excel file to send out using smtplib and MIME? -- http://mail.python.org/mailman/listinfo/python-list

Re: passing string from one file to another

2006-04-16 Thread Kun
I V wrote: > Kun wrote: >> mail currently gets the body from an input box. >> >> this is where mail.py gets invoked: > > OK, I'm a bit confused. Where is the "initial python program" in all > this? You seem to have an one python program (mail.py) and

Re: passing string from one file to another

2006-04-16 Thread Kun
I V wrote: > Kun wrote: >> This works fine but instead of typing in a 'body', i would like the >> initial python program to just send a string as the body of the email. >> now normally i'd just set the msg in the mail.py file equal to the >> string, howeve

Re: passing string from one file to another

2006-04-16 Thread Kun
Kun wrote: > I have a python-cgi form whose sole purpose is to email. > > It has the fields 'to', 'from', 'subject', 'body', etc. and if the user > fills them out and clicks submit, it will invoke another file called > mail.py which use

passing string from one file to another

2006-04-16 Thread Kun
I have a python-cgi form whose sole purpose is to email. It has the fields 'to', 'from', 'subject', 'body', etc. and if the user fills them out and clicks submit, it will invoke another file called mail.py which uses smtplib to send the message. This works fine but instead of typing in a 'body'

Re: filling today's date in a form

2006-04-16 Thread Kun
Felipe Almeida Lessa wrote: > Em Dom, 2006-04-16 às 19:22 -0400, Kun escreveu: >> i have a form > > Which kind of form? Which toolkit? > >> which takes in inputs for a mysql query. one of the inputs >> is 'date'. normally, a user has to manually ent

filling today's date in a form

2006-04-16 Thread Kun
i have a form which takes in inputs for a mysql query. one of the inputs is 'date'. normally, a user has to manually enter a date, but i am wondering if there is a way to create a button which would automatically insert today's date in the date form field if the user chooses to use today's dat

Sending part of a page as the body of an email

2006-04-15 Thread Kun
I currently have a python-cgi script that extracts data from a mysql table. I would like to save this data as a string and send it to a recipient via email. I know how to send email using the smtp lib, but what I do not know his how to save a portion of the page as a string. Any pointers? --

Re: multiple parameters in if statement...

2006-04-15 Thread Kun
[EMAIL PROTECTED] wrote: > Kun wrote: >> I am trying to make an if-statement that will not do anything and print >> 'nothing entered' if there is nothing entered in a form. I have the >> following code that does that, however, now even if I enter something > &

multiple parameters in if statement

2006-04-15 Thread Kun
I am trying to make an if-statement that will not do anything and print 'nothing entered' if there is nothing entered in a form. I have the following code that does that, however, now even if I enter something into the form, the code still outputs 'nothing entered'. This violates the if state

turning python-cgi into an html output

2006-04-11 Thread Kun
i have a python cgi script that displays tables from a mysql database in html. the problem is, i want to use excel's web query to pull this data and the web query doesn't read .py files. thus i am wondering what is the easiest way to just turn my .py html output into a .html output. you can c

modifying html input date for mysql, reg ex or string interpolation?

2006-04-11 Thread Kun
I have an html form that takes dates and inserts them into a mysql file. Currently, users have to type in dates in the -mm-dd format. As of now, this process works with the sql. However, I would like to make this process easier by: 1) providing drop down menus for year, month, and date

using regex to remove $ sign

2006-04-11 Thread Kun
i have an html/cgi input that takes in values to a mysql database, however, if i stick in $20 instead of 20, it crashes the program because of the extra $ sign. I was wondering if anyone has a quick regular expression in python to remove the $-sign if it is present in the input. -- http://mail

pulling data from html and putting it in mysql database

2006-04-04 Thread Kun
i have the following simple html that asks for a price: -- http://mail.python.org/mailman/listinfo/python-list

Re: sending emails to a list of recipients [update]

2006-03-25 Thread Kun
Kun wrote: > i have the following code: > > -- > import smtplib > > from email.MIMEText import MIMEText > fp = open('confirmation.txt', 'rb') > msg = MIMEText(fp.read()) > > From = '[EMAIL PROTECTED]'

sending emails to a list of recipients

2006-03-25 Thread Kun
i have the following code: -- import smtplib from email.MIMEText import MIMEText fp = open('confirmation.txt', 'rb') msg = MIMEText(fp.read()) From = '[EMAIL PROTECTED]' msg['Subject'] = 'Purchase Confirmation' msg ['From'] = From msg['To'] = emails s = smtplib

using regex to pull out email addresses

2006-03-25 Thread Kun
i have a regular expression that searches a string and plucks out email addresses however it doesn't work for email addresses w/a subdomain e.g. [EMAIL PROTECTED] emails = re.findall('([EMAIL PROTECTED])', senderlist) <-- my code is there any way to modify that to include email addresses that

simple string search and replace

2006-03-25 Thread Kun
hey guys, here's my code, senders = [('460 (BODY[HEADER.FIELDS (FROM)] {46}', 'From: Friend <[EMAIL PROTECTED]>\r\n\r\n'), ')', ('462 (BODY[HEADER.FIELDS (FROM)] {37}', 'From: Kun <[EMAIL PROTECTED]>\r\n\r\n'), ')

send email to string of emails

2006-03-24 Thread Kun
the code below outputs a string of emails (e.g. ['[EMAIL PROTECTED]', '[EMAIL PROTECTED]'] i would like to somehow send an email to everyone on the string of emails telling them 'thanks for emailing me' anyone know how to do this? much thanks ahead of time. from imaplib import * import getpas

Re: newbie parsing question

2006-03-24 Thread Kun
[EMAIL PROTECTED] wrote: > Use Regular expressions > http://docs.python.org/lib/module-re.html > i tried to parse (below) with the regular expression: emails = re.findall('\S*\s([EMAIL PROTECTED])', senders) and got the following error: Traceback (most recent call last): File "/Life/School/H

newbie parsing question

2006-03-24 Thread Kun
i have a list of that is: [('460 (BODY[HEADER.FIELDS (FROM)] {46}', 'From: Friend <[EMAIL PROTECTED]>\r\n\r\n'), ')', ('462 (BODY[HEADER.FIELDS (FROM)] {37}', 'From: Kun <[EMAIL PROTECTED]>\r\n\r\n'), ')'] how do i p

Re: imap folder scanner

2006-03-24 Thread Kun
what is the best way to parse the email address out of the entire string. sample string: >>> print status, senders OK [('460 (BODY[HEADER.FIELDS (FROM)] {46}', 'From: Friend <[EMAIL PROTECTED]>\r\n\r\n'), ')', ('462 (BODY[HEADER.FIELDS (FROM)]

Re: imap folder scanner

2006-03-24 Thread Kun
#x27; > mail['Subject'] = "Spam machine" > mail['To'] = to = '[EMAIL PROTECTED]' > server = smtplib.SMTP('localhost') > errors = server.sendmail(fro, to, mail.as_string()) > server.quit() > > That

Re: UPDATE imap folder scanner

2006-03-23 Thread Kun
Okay So I got the 'search' part to work, which outputs me a long list of message numbers. how do i use that list of message numbers to fetch the 'from' address for each one and send them a confirmation email? is this some sort for loop? any help would be greatly appreci

imap folder scanner

2006-03-23 Thread Kun
Hey guys, I would like to have a code in python (as simple as possible) to scan a specific folder in my mailbox and if the subject is equal to, say, 'BIKES', I would like to have the code automatically send the SENDER an email saying something like "We have received your Email". Furthermore, I