Re: Don't Want Visitor To See Nuttin'

2011-03-11 Thread Victor Subervi
On Fri, Mar 11, 2011 at 3:54 AM, Ian Kelly ian.g.ke...@gmail.com wrote: On Wed, Mar 9, 2011 at 2:01 PM, Victor Subervi victorsube...@gmail.com wrote: titleMaya 2012: Transform At the Source/title Yow. You're designing a Maya 2012 website to help some travel company bilk gullible people

Re: Don't Want Visitor To See Nuttin'

2011-03-11 Thread Victor Subervi
On Fri, Mar 11, 2011 at 4:26 AM, Dennis Lee Bieber wlfr...@ix.netcom.comwrote: On Thu, 10 Mar 2011 18:00:10 -0800 (PST), alex23 wuwe...@gmail.com declaimed the following in gmane.comp.python.general: He's comp.lang.python's version of Sisyphus. Or maybe Sisyphus' boulder...I forget where I

Re: Don't Want Visitor To See Nuttin'

2011-03-10 Thread Victor Subervi
On Wed, Mar 9, 2011 at 5:33 PM, Ian hobso...@gmail.com wrote: On 09/03/2011 21:01, Victor Subervi wrote: The problem is that it prints Content-Type: text/html to the screen If you can see what is intended to be a header, then it follows that you are not sending the header correctly. Sorry

Re: Don't Want Visitor To See Nuttin'

2011-03-10 Thread Victor Subervi
On Thu, Mar 10, 2011 at 8:50 PM, Benjamin Kaplan benjamin.kap...@case.eduwrote: print Content-Type: text/html print print ''' !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html head and this has worked

Re: How Translate This PHP

2011-03-09 Thread Victor Subervi
On Sun, Mar 6, 2011 at 12:00 PM, Noah Hall enali...@gmail.com wrote: On Sun, Mar 6, 2011 at 3:11 PM, Victor Subervi victorsube...@gmail.com wrote: Ah. I thought I had to return something! Well, based on what you asked, you would've, but based on the code, all it was doing is printing

Re: Absolutely Insane Problem with Gmail

2011-03-06 Thread Victor Subervi
On Sat, Mar 5, 2011 at 11:11 PM, Littlefield, Tyler ty...@tysdomain.comwrote: ourEmail = ' myemaila...@gmail.com' ourEmail = ' q...@xxx.com' You redefine this twice. Right. The second definition, of course, overwrites the first. That is deliberate. I simply comment out the second when

How Translate This PHP

2011-03-06 Thread Victor Subervi
Hi; How do I translate this PHP code? if($ok){ echo returnValue=1; }else{ echo returnValue=0; } In other words, when the email successfully sends, send back both the name of the variable and its value. TIA, Beno -- http://mail.python.org/mailman/listinfo/python-list

Re: How Translate This PHP

2011-03-06 Thread Victor Subervi
On Sun, Mar 6, 2011 at 10:53 AM, Noah Hall enali...@gmail.com wrote: On Sun, Mar 6, 2011 at 2:45 PM, Victor Subervi victorsube...@gmail.com wrote: Hi; How do I translate this PHP code? if($ok){ echo returnValue=1; }else{ echo returnValue=0; } From the code provided

Absolutely Insane Problem with Gmail

2011-03-05 Thread Victor Subervi
Hi; I have this code: #!/usr/bin/python import sys, os, string import cgitb; cgitb.enable() import cgi cwd = os.getcwd() dirs = string.split(cwd, '/') dirs = dirs[1:-1] backLevel = '/' + string.join(dirs, '/') sys.path.append(cwd) sys.path.append(backLevel) import string form =

Re: Communicating from Flash to Python

2011-03-04 Thread Victor Subervi
On Fri, Mar 4, 2011 at 2:57 AM, Godson Gera godso...@gmail.com wrote: You can use PyAMF http://pyamf.org Thanks! Beno -- http://mail.python.org/mailman/listinfo/python-list

Communicating from Flash to Python

2011-03-03 Thread Victor Subervi
Hi; I have an AS3 script that is supposed to communicate with a python script and I don't think it is. The python script is to email. How can I trouble-shoot this? Beno -- http://mail.python.org/mailman/listinfo/python-list

OT: Need Interactivity With the Browser

2011-02-16 Thread Victor Subervi
Hi; I would like to build a component where the user can go to a page, say he'd like to upload so many (x) number of photos, click a button and without leaving the page have three sets of upload widgets pop up. I think this is done with Json; however, I can't find much info or tutorials on the

Another MySQLdb Q

2011-02-16 Thread Victor Subervi
Hi; I have this code: db = MySQLdb.connect(host, user, passwd, db) cursor= db.cursor() cursor.execute(sql, id) db.commit() It throws no errors and gives every indication that it executes the command. I've printed out the command and the id and executed it successfully in mysql...but not

Problem w/ MySQLdb

2011-02-15 Thread Victor Subervi
Hi; I have a function that calls the following class: #!/usr/bin/python import sys,os sys.path.append(os.getcwd()) import MySQLdb from login import login import re, string def buildTableColorShortOptions(): user, passwd, db, host = login() database = MySQLdb.connect(host, user, passwd, db)

Re: Problem w/ MySQLdb

2011-02-15 Thread Victor Subervi
It's been too long since I've worked on this. Yep, I forgot to commit. Thanks, Beno On Tue, Feb 15, 2011 at 5:21 PM, Jerry Hill malaclyp...@gmail.com wrote: On Tue, Feb 15, 2011 at 3:24 PM, Victor Subervi victorsube...@gmail.com wrote: It builds the table but fails from the first insertion

Re: Printing from Web Page

2010-11-21 Thread Victor Subervi
On Sun, Nov 21, 2010 at 5:35 AM, FELD Boris lothiral...@gmail.com wrote: I think the best way to do this is using css with specific media type. Take a look at : http://martybugs.net/articles/print.cgi Oh, man, this is perfect! Thanks! beno --

Printing from Web Page

2010-11-20 Thread Victor Subervi
Hi; I need to be able to print something from a Web page: not the entire page but what I specify. I am writing the page and the client is surfing to it. How do I do this? TIA, beno -- http://mail.python.org/mailman/listinfo/python-list

MySQL Query Problem

2010-09-17 Thread Victor Subervi
Hi; I have this code: cursor.execute('insert into Passengers values (Null, %s, %s, %s, %s, %s, %s, %s, %s, no, n/a)', (curr_flight, curr_customer, name, curr_sex, curr_weight, price, curr_rt, curr_confirmation)) Now, when I print it out, add quotes where necessary and enter it in at a

Re: MySQL Query Problem

2010-09-17 Thread Victor Subervi
/a | +++-+-+--++---++--+--+---+ 2 rows in set (0.00 sec) Please explain why it does that! TIA, beno On Fri, Sep 17, 2010 at 8:51 AM, Victor Subervi victorsube...@gmail.comwrote: Hi; I have this code: cursor.execute('insert into Passengers

Re: MySQL Query Problem

2010-09-17 Thread Victor Subervi
I rebooted MySQL and it now works fine ;) On Fri, Sep 17, 2010 at 9:26 AM, Victor Subervi victorsube...@gmail.comwrote: Here's some more data: print 'insert into Passengers values (Null, %s, %s, %s, %s, %s, %s, %s, %s, no, n/a)' % (curr_flight, curr_customer, name, curr_sex

Re: MySQL Problem

2010-09-03 Thread Victor Subervi
On Thu, Sep 2, 2010 at 3:02 PM, Ian hobso...@gmaiil.com wrote: On 02/09/2010 19:34, Victor Subervi wrote: for some reason running the command through python *omits* this one data!! The only difference is that a flag in spreadsheets (Temp) is set to 1. Why on earth doesn't it work in python

Re: MySQL Problem

2010-09-03 Thread Victor Subervi
This is an addendum to my last post. Please observe the following: mysql select * from spreadsheets where Temp=1; +-++---+-++--+ | ID | Client | Multi | Item| Markup | Temp |

Re: MySQL Problem

2010-09-03 Thread Victor Subervi
On Fri, Sep 3, 2010 at 9:25 AM, Richard Arts arts.rich...@gmail.com wrote: These are also mere suggestions. The statements you use in your print statement and the one you use to feed the cursor differ slightly. The latter is missing quotes around your search criterium. Isn't it possible to

MySQL Problem

2010-09-02 Thread Victor Subervi
Hi; I have this code: print 'select * from spreadsheets s join products p on p.Item=s.Item join productsCategories pc on p.ID=pc.ProductsID join categories c on pc.CategoryID=c.ID where s.Client=%s order by c.Category, c.Parent' % (client,) cursor.execute('select * from spreadsheets s

Re: Reversing a List

2010-09-02 Thread Victor Subervi
On Wed, Sep 1, 2010 at 9:26 AM, Shashwat Anand anand.shash...@gmail.comwrote: On Wed, Sep 1, 2010 at 6:45 PM, Matt Saxton m...@scotweb.co.uk wrote: On Wed, 1 Sep 2010 09:00:03 -0400 Victor Subervi victorsube...@gmail.com wrote: Hi; I have this code: cursor.execute('describe

Reversing a List

2010-09-01 Thread Victor Subervi
Hi; I have this code: cursor.execute('describe products;') cols = [item[0] for item in cursor] cols = cols.reverse() cols.append('Delete') cols = cols.reverse() Unfortunately, the list doesn't reverse. If I print cols after the first reverse(), it prints None. Please advise. Also, is

Re: Reversing a List

2010-09-01 Thread Victor Subervi
On Wed, Sep 1, 2010 at 9:17 AM, Shashank Singh shashank.sunny.si...@gmail.com wrote: reverse reverses in-place l = [1, 2, 3] r = l.reverse() r is None True l [3, 2, 1] Ah. Thanks! beno -- http://mail.python.org/mailman/listinfo/python-list

MySQL One More Again

2010-07-16 Thread Victor Subervi
Hi; I have the following code: cursor.execute('select MyTable from optionsDetails where Store=%s', (store,)) options_tables = [item[0] for item in cursor] for table in options_tables: cursor.execute('select * from %' % table) You can already see what my question is. One of

Re: MySQL One More Again

2010-07-16 Thread Victor Subervi
On Fri, Jul 16, 2010 at 10:09 AM, MRAB pyt...@mrabarnett.plus.com wrote: Victor Subervi wrote: Hi; I have the following code: cursor.execute('select MyTable from optionsDetails where Store=%s', (store,)) options_tables = [item[0] for item in cursor] for table in options_tables

Re: Is This Open To SQL Injection?

2010-07-08 Thread Victor Subervi
On Wed, Jul 7, 2010 at 2:22 PM, Stephen Hansen me+list/pyt...@ixokai.iowrote: First, its always best to be explicit with insert statements. Meaning, don't rely on the underlining structure of a table, as in: INSERT INTO YourRandomTable VALUES (my, value, here); Instead, do: INSERT INTO

Re: Is This Open To SQL Injection?

2010-07-08 Thread Victor Subervi
On Thu, Jul 8, 2010 at 10:45 AM, Stephen Hansen me+list/pyt...@ixokai.iowrote: On 7/8/10 6:20 AM, Victor Subervi wrote: However, I now have another error. Here is my current command: cursor.execute(insert into personalDataKeys (Store, User, useFirstName, useLastName, usePhone

Re: Is This Open To SQL Injection?

2010-07-08 Thread Victor Subervi
I've come to the realization that I don't need FKs at all here. Essentially, what I need to do is consult personalDataKeys simply to determine what data should be loaded into and retrieved from personalData. I was mistaken because the data are not interdependent, it only appeared that way

Is This Open To SQL Injection?

2010-07-07 Thread Victor Subervi
Hi; I have this code: sql = 'insert into personalDataKeys values (%s, %s, %s)' % (store, user, ', %s'.join('%s' * len(col_vals)) cursor.execute(sql, col_vals) Is this open to injection attacks? If so, how correct? TIA, beno -- http://mail.python.org/mailman/listinfo/python-list

Re: More MySQL Stuff

2010-06-29 Thread Victor Subervi
On Mon, Jun 28, 2010 at 2:24 PM, Emile van Sebille em...@fenx.com wrote: On 6/28/2010 9:10 AM Victor Subervi said... Any other suggestions? http://www.databaseanswers.org/tutorial4_db_schema/index.htm Thanks. Good tutorial. beno -- http://mail.python.org/mailman/listinfo/python-list

More MySQL Stuff

2010-06-28 Thread Victor Subervi
Hi; So I'm launching into a major rewrite of my shopping cart because I've finally woken up to the challenge of injection attacks. One of my major problems is that many column names are determined when the shopping cart is built. For example, how many photos are to be uploaded is determined that

Re: More MySQL Stuff

2010-06-28 Thread Victor Subervi
On Mon, Jun 28, 2010 at 12:11 PM, Stephen Hansen me+list/pyt...@ixokai.iowrote: On 6/28/10 9:10 AM, Victor Subervi wrote: Hi; So I'm launching into a major rewrite of my shopping cart because I've finally woken up to the challenge of injection attacks. One of my major problems is that many

Re: Another MySQL Problem

2010-06-26 Thread Victor Subervi
On Fri, Jun 25, 2010 at 2:15 AM, Dennis Lee Bieber wlfr...@ix.netcom.comwrote: On Thu, 24 Jun 2010 09:59:41 -0430, Victor Subervi victorsube...@gmail.com declaimed the following in gmane.comp.python.general: I could have sworn the concept had been brought up some 8 months ago

Re: Another MySQL Problem

2010-06-24 Thread Victor Subervi
On Thu, Jun 24, 2010 at 1:56 AM, John Nagle na...@animats.com wrote: On 6/23/2010 10:59 PM, Dennis Lee Bieber wrote: On Wed, 23 Jun 2010 11:58:24 -0430, Victor Subervi victorsube...@gmail.com declaimed the following in gmane.comp.python.general: When I have this code

Re: Another MySQL Problem

2010-06-24 Thread Victor Subervi
On Thu, Jun 24, 2010 at 9:34 AM, Stephen Hansen me+list/pyt...@ixokai.iowrote: On Thu, Jun 24, 2010 at 4:47 AM, Victor Subervi victorsube...@gmail.comwrote: On Thu, Jun 24, 2010 at 1:56 AM, John Nagle na...@animats.com wrote: Yes. Please post your CREATE statements, so we can see your

Another MySQL Problem

2010-06-23 Thread Victor Subervi
Hi; I have this line: cursor.execute('select clientEmail from clients where client=%s', (string.replace(client, '_', ' '))) clientEmail = cursor.fetchone()[0] cursor.execute('select * from %s' % (client)) client = Lincoln_Properties With the replacement, the interpreter complains that

Re: Another MySQL Problem

2010-06-23 Thread Victor Subervi
On Wed, Jun 23, 2010 at 10:25 AM, Stephen Hansen me+list/pyt...@ixokai.iowrote: On 6/23/10 6:45 AM, Victor Subervi wrote: Hi; I have this line: cursor.execute('select clientEmail from clients where client=%s', (string.replace(client, '_', ' '))) clientEmail = cursor.fetchone()[0

Re: Another MySQL Problem

2010-06-23 Thread Victor Subervi
Ok, let's start all over again. When I have this code: cursor.execute('select clientEmail from clients where client=%s', (client.replace('_', ' '),)) clientEmail = cursor.fetchone()[0] I get this error: /var/www/html/globalsolutionsgroup.vi/mailSpreadsheet.py 67 /body 68 /html'''

Re: Another MySQL Problem

2010-06-23 Thread Victor Subervi
On Wed, Jun 23, 2010 at 12:51 PM, Stephen Hansen ixo...@ixokai.io wrote: The problem is not this line but: File /var/www/html/globalsolutionsgroup.vi/mailSpreadsheet.py, line 38, in mailSpreadsheet cursor.execute('select * from %s', (client,)) This one. Yes, can't use the comma,

Re: If Not CGI...

2010-06-21 Thread Victor Subervi
I really can't begin to thank you guys enough. Great information, goes without saying. A lot to consider. I would like to explore rewriting the shopping cart in Django. The reality of the matter may make it difficult. Working literally from the time I awake to when I go to sleep and not having

Re: If Not CGI...

2010-06-21 Thread Victor Subervi
On Mon, Jun 21, 2010 at 9:03 AM, Tim Chase python.l...@tim.thechases.comwrote: On 06/21/2010 07:40 AM, Victor Subervi wrote: I would like to explore rewriting the shopping cart in Django. The reality of the matter may make it difficult. Working literally from the time I awake to when I go

If Not CGI...

2010-06-19 Thread Victor Subervi
Hi; I've caught a lot of flack (imagine that) about using CGI. I understand there are several other options, to wit: mod_python, fastcgi and wcgi. I've messed around with mod_python without luck. What are your suggestions? TIA. beno -- http://mail.python.org/mailman/listinfo/python-list

Re: Deformed Form

2010-06-16 Thread Victor Subervi
Stephen Hansen suggests running this line before running or testing code: python -m compileall -f . Noted. Will do. Stephen also mentions, along with many others, that using CGI these days is silly (my word). Noted. I'll switch over, but not today. Got other things more pressing ;) DavidA

Re: Deformed Form

2010-06-16 Thread Victor Subervi
On Wed, Jun 16, 2010 at 2:09 PM, Dave Angel da...@ieee.org wrote: Fix any one of them, and I'd probably have kept quiet. Thanks for piping up ;) beno -- http://mail.python.org/mailman/listinfo/python-list

Re: Deformed Form

2010-06-12 Thread Victor Subervi
Stephen Hansen suggests I move the line: new_passengers_curr_customers = int(form.getfirst('new_passengers_curr_customers', 0)) from Script 3 (as he dubs it) to Script 2. Naturally (though he wouldn't have known) that's how I had it at first. After sending the post that finally cleared up the

Re: Deformed Form

2010-06-12 Thread Victor Subervi
On Sat, Jun 12, 2010 at 11:46 AM, Stephen Hansen me+list/pyt...@ixokai.iowrote: On 6/12/10 6:19 AM, Victor Subervi wrote: You will note those very first lines. This also addresses two other responders who believed perhaps I had called the variable from the form in question more than once

Re: Deformed Form

2010-06-12 Thread Victor Subervi
On Sat, Jun 12, 2010 at 1:58 PM, Stephen Hansen me+list/pyt...@ixokai.iowrote: The only suggestion I have is: try dumping all the .pyc's. Interestingly, ls -al reveals *no* *.pyc files. Yeah, that problem caught me once as well. TIA, beno --

Re: Deformed Form

2010-06-11 Thread Victor Subervi
On Thu, Jun 10, 2010 at 2:07 PM, Stephen Hansen me+list/pyt...@ixokai.iowrote: On 6/10/10 10:48 AM, Victor Subervi wrote: Now, create_edit_passengers3() is called by the form/submit button in (you guessed it) create_edit_passengers2.py, the latter containing a var in it which *should

Re: Deformed Form

2010-06-11 Thread Victor Subervi
On Fri, Jun 11, 2010 at 12:24 PM, Stephen Hansen me+list/pyt...@ixokai.iowrote: Sure, if you have some file that two separate scripts import, and in said file you generate some value-- as long as that value will be the same at all times, it'll appear that the two scripts are sharing some

Re: Deformed Form

2010-06-11 Thread Victor Subervi
Ok. Starting over. Here is the script that generates the variable new_passengers_curr_customers: #!/usr/bin/python import cgitb; cgitb.enable() import cgi import sys,os sys.path.append(os.getcwd()) import MySQLdb from login import login from Curr_Passengers_Table import Curr_Passengers_Table

Deformed Form

2010-06-10 Thread Victor Subervi
Hi; I have a script that calls values from the form that calls it. This script imports another script: from New_Passenger import New_Passenger def create_edit_passengers3(): ... new_passengers_curr_customers = New_Passengers_Curr_Customers(customers, flights) if

Re: Deformed Form

2010-06-10 Thread Victor Subervi
On Thu, Jun 10, 2010 at 10:30 AM, Stephen Hansen (L/P) me+list/ pyt...@ixokai.io wrote: On 6/10/10 7:14 AM, Victor Subervi wrote: Hi; I have a script that calls values from the form that calls it. This script imports another script: from New_Passenger import New_Passenger def

Re: Deformed Form

2010-06-10 Thread Victor Subervi
No, I think you've misunderstood because while I thought I was being clear I probably was not. So here is the complete code of create_edit_passengers3.py: #!/usr/bin/python import cgitb; cgitb.enable() import cgi import sys,os sys.path.append(os.getcwd()) import MySQLdb from login import login

capitalize() NOT the same as var[0].upper _ var[1:]

2010-06-08 Thread Victor Subervi
Sorry, Dennis: var = 'colorsShort' var[0].upper + var[1:] = 'ColorsShort' var.capitalize() = 'Colorsshort' beno -- http://mail.python.org/mailman/listinfo/python-list

Re: Where's the List?

2010-06-06 Thread Victor Subervi
On Sat, Jun 5, 2010 at 4:52 PM, Stephen Hansen apt.shan...@gmail.comwrote: cur.execute(sql, [pkg, prodid, tmpTable, quantity] + list(option_values)) Or: cur.execute(sql, (pkg, prodid, tmpTable, quantity) + option_values) I removed the explicit conversion-to-tuple in the first,

Drop Table w/ MySQLdb?

2010-06-06 Thread Victor Subervi
Hi; I tried this: cursor.execute('drop table tmp%s', tmpTable) and got this error: Traceback (most recent call last): File /var/www/html/angrynates.com/cart/cart.py, line 196, in ? cart() File /var/www/html/angrynates.com/cart/cart.py, line 189, in cart cursor.execute('drop

Re: Drop Table w/ MySQLdb?

2010-06-06 Thread Victor Subervi
On Sun, Jun 6, 2010 at 11:40 AM, MRAB pyt...@mrabarnett.plus.com wrote: As has been explained already, SQL might not (and here it clearly does not) let you use placeholders for table or column names, only for values. Oops. Sorry. Thanks. beno --

Re: Another MySQL Question

2010-06-05 Thread Victor Subervi
On Thu, Jun 3, 2010 at 4:09 PM, John Nagle na...@animats.com wrote: The real problem with this is not the Python. It's the approach to SQL. What's going on here is that you have some collection of named options that come in from some external source, and you're trying to handle that by

Where's the List?

2010-06-05 Thread Victor Subervi
Hi; I have this: for order in order_details: store = order[0] prodid = order[1] pkg = order[2] quantity = order[3] if 'PatientID' in order_fields: patientID = order[4] try: option_values = order[5:] except TypeError:

Another MySQL Question

2010-06-03 Thread Victor Subervi
Hi; I have this code: options = '' our_options = [] our_options_string = '' for op in ops: options += '%s varchar(40) not null, ' % (op[0].upper() + op[1:]) our_options.append('%s' % form.getfirst('%s' % op)) our_options_string += '%s, ' % op

Re: Another MySQL Question

2010-06-03 Thread Victor Subervi
On Thu, Jun 3, 2010 at 12:25 PM, MRAB pyt...@mrabarnett.plus.com wrote: So our_options is a list containing two values, which you're putting into a tuple: our_options = [first, second] print len(our_options) 2 value_tuple = (our_options,) print len(value_tuple) 1 In other words,

Re: Another MySQL Question

2010-06-03 Thread Victor Subervi
On Thu, Jun 3, 2010 at 1:48 PM, Dennis Lee Bieber wlfr...@ix.netcom.comwrote: On Thu, 3 Jun 2010 08:49:44 -0400, Victor Subervi victorsube...@gmail.com declaimed the following in gmane.comp.python.general: options += '%s varchar(40) not null, ' % (op[0].upper() + op[1

Opinion On Best Way...

2010-06-02 Thread Victor Subervi
Hi; I have a script in which I currently pass a number of variables to another script through the url in a meta http-equiv tag. This seems both awkward and hackable. I think it would be best to create a temporary mysql table, insert them there, and pull them from the following script. The

Re: Yet Another MySQL Problem

2010-05-28 Thread Victor Subervi
On Thu, May 27, 2010 at 5:47 PM, Tim Chase python.l...@tim.thechases.comwrote: On 05/27/2010 03:32 PM, Victor Subervi wrote: On Thu, May 27, 2010 at 1:15 PM, Tim Chase wrote: That should be: ', '.join(['%s'] * len(values))) Or as I've done in the past: ', '.join('%s

Re: Some More MySQL

2010-05-28 Thread Victor Subervi
On Fri, May 28, 2010 at 2:17 AM, Dennis Lee Bieber wlfr...@ix.netcom.comwrote: On Thu, 27 May 2010 23:22:24 +0100, MRAB pyt...@mrabarnett.plus.com declaimed the following in gmane.comp.python.general: Placeholders which are handled by .execute shouldn't be wrapped in quotes, even is the

Re: Some More MySQL

2010-05-28 Thread Victor Subervi
I still have this code: sql = 'select * from options%s where ID=%%s', (opTable[0].upper() + opTable[1:]) cursor.execute(sql, (id,)) which throws this error: /var/www/html/angrynates.com/cart/enterOptionsPrices2.py 70 print 'All options prices have been successfully updated.'

Yet Another MySQL Problem

2010-05-27 Thread Victor Subervi
Hi; I have this code: sql = insert into %s (%s) values ('%%s'); % (personalDataTable, string.join(cols[1:], ', ')) #cursor.execute(sql, string.join(vals[1:], ', ')) cursor.execute('insert into %s (%s) values (%s);' % (personalDataTable, string.join(cols[1:], ', '),

Re: Yet Another MySQL Problem

2010-05-27 Thread Victor Subervi
On Thu, May 27, 2010 at 8:34 AM, Victor Subervi victorsube...@gmail.comwrote: Hi; I have this code: sql = insert into %s (%s) values ('%%s'); % (personalDataTable, string.join(cols[1:], ', ')) #cursor.execute(sql, string.join(vals[1:], ', ')) cursor.execute('insert into %s (%s

Re: Yet Another MySQL Problem

2010-05-27 Thread Victor Subervi
On Thu, May 27, 2010 at 10:17 AM, Kushal Kumaran kushal.kuma...@gmail.comwrote: On Thu, 2010-05-27 at 08:34 -0400, Victor Subervi wrote: Hi; I have this code: sql = insert into %s (%s) values ('%%s'); % (personalDataTable, string.join(cols[1:], ', ')) #cursor.execute(sql

Re: Yet Another MySQL Problem

2010-05-27 Thread Victor Subervi
On Thu, May 27, 2010 at 12:11 PM, Kushal Kumaran kushal.kuma...@gmail.comwrote: Since I'm in a good mood today, here's a little present: def insert(cursor, table, columns, values): Insert a row into a table. columns must be a list of column names. values must be a list of values for

Re: A Quick MySQL Question

2010-05-27 Thread Victor Subervi
On Thu, May 27, 2010 at 1:37 PM, Dennis Lee Bieber wlfr...@ix.netcom.comwrote: On Wed, 26 May 2010 08:29:21 -0400, Victor Subervi victorsube...@gmail.com declaimed the following in gmane.comp.python.general: valueList = (%value1, %value2, %value3) If I'd coded it correctly

Re: Yet Another MySQL Problem

2010-05-27 Thread Victor Subervi
On Thu, May 27, 2010 at 12:56 PM, MRAB pyt...@mrabarnett.plus.com wrote: Kushal Kumaran wrote: [snip] Since I'm in a good mood today, here's a little present: def insert(cursor, table, columns, values): Insert a row into a table. columns must be a list of column names. values

Some More MySQL

2010-05-27 Thread Victor Subervi
Hi; But what about this? sql = select pic%d from %s where ID='%%s'; % (pic, store) cursor.execute(sql % id) If I try and rewrite the last line like this: cursor.execute(sql, id) it doesn't work. What do? How about this one: cursor.execute(insert into categories (Store,

Re: Some More MySQL

2010-05-27 Thread Victor Subervi
On Thu, May 27, 2010 at 2:54 PM, MRAB pyt...@mrabarnett.plus.com wrote: Victor Subervi wrote: Hi; But what about this? sql = select pic%d from %s where ID='%%s'; % (pic, store) cursor.execute(sql % id) If I try and rewrite the last line like this: cursor.execute(sql, id

Re: Yet Another MySQL Problem

2010-05-27 Thread Victor Subervi
On Thu, May 27, 2010 at 1:15 PM, Tim Chase s...@thechases.com wrote: On 05/27/2010 11:56 AM, MRAB wrote: Kushal Kumaran wrote: ', '.join('%s' * len(values))) That should be: ', '.join(['%s'] * len(values))) Or as I've done in the past: ', '.join('%s' for _ in

Re: A Quick MySQL Question

2010-05-26 Thread Victor Subervi
On Wed, May 26, 2010 at 2:42 AM, Dennis Lee Bieber wlfr...@ix.netcom.comwrote: I was, for that example, assuming that the user input values was being used in a select query and hence wrapped it with wildcard markers so that the phrase would match anywhere in the data field. In said thread

Re: Another Little MySQL Problem

2010-05-26 Thread Victor Subervi
On Wed, May 26, 2010 at 11:25 AM, Kushal Kumaran kushal.kuma...@gmail.comwrote: On Tue, 2010-05-25 at 14:45 -0400, Victor Subervi wrote: Hi; I have this code: clientCursor.execute('select ID from %s' % (personalDataTable)) upds = [itm[0] for itm in clientCursor] print

Re: A Quick MySQL Question

2010-05-25 Thread Victor Subervi
On Tue, May 25, 2010 at 3:50 AM, Dennis Lee Bieber wlfr...@ix.netcom.comwrote: On Mon, 24 May 2010 13:37:58 -0400, Victor Subervi victorsube...@gmail.com declaimed the following in Parameterized queries process the parameters to ensure that they are safe for use in the SQL statement

Another Little MySQL Problem

2010-05-25 Thread Victor Subervi
Hi; I have this code: clientCursor.execute('select ID from %s' % (personalDataTable)) upds = [itm[0] for itm in clientCursor] print input type='hidden' name='upds' value='%s' / % upds The problem is that the values passed are 1L, 2L When I retrieve them on the other end and try

A Quick MySQL Question

2010-05-24 Thread Victor Subervi
Hi; I have the following: #sql = 'alter table %s alter column %s set default %%s;' % (store, col) #cursor.execute(sql, colValue) cursor.execute('alter table %s alter column %s set default %s;' % (store, col, colValue)) database.commit() Now I don't like that third

Re: Another Strange MySQL Problem

2010-05-22 Thread Victor Subervi
On Fri, May 21, 2010 at 2:40 PM, Tim Chase python.l...@tim.thechases.comwrote: On 05/21/2010 12:31 PM, Victor Subervi wrote: cursor.execute('insert into Baggage values (Null, %s, %s, %s, %s)', (flight_id, customer_id, weight, ticket_no)) You're trying to insert stuff

Just To Be Sure...MySQL

2010-05-22 Thread Victor Subervi
Hi; A lister recently responded to my post concerning mysl commands of the following type: cursor.execute('insert into foo values (%s, %s)' % (bar, something)) stating that I need to eliminate the % to prevent injection attacks, thus: cursor.execute('insert into foo values (%s, %s)', (bar,

Another Strange MySQL Problem

2010-05-21 Thread Victor Subervi
Hi; When I try to execute this code from my Python script, I get this error: Traceback (most recent call last): File /var/www/html/creative.vi/clients/sea-flight/reservations/create_edit_bags3.py, line 38, in ? create_edit_bags3() File

Strange MySQL Problem

2010-05-20 Thread Victor Subervi
Hi; I have this code: #!/usr/bin/python import cgitb; cgitb.enable() import cgi import sys,os sys.path.append(os.getcwd()) import MySQLdb from login import login def create_edit_passengers4(): print Content-Type: text/html print print ''' !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0

Re: Strange MySQL Problem

2010-05-20 Thread Victor Subervi
On Thu, May 20, 2010 at 12:56 PM, MRAB pyt...@mrabarnett.plus.com wrote: When performing SQL operations, don't insert the values using Python's string formatting, because that makes it vulnerable to SQL-injection attacks, ie don't do this: cursor.execute(sql_command % values) do this:

Re: Tempering Client Expectations (OT)

2010-04-12 Thread Victor Subervi
On Sat, Apr 10, 2010 at 3:14 PM, Tim Chase python.l...@tim.thechases.comwrote: 1) Preeminently, address second-order ignorance. Tim, throughout this post, you're way out of line. The s/w I have already built for this client works just fine. It's not a matter or not having the tools or not

Re: Refresh Problem

2010-04-12 Thread Victor Subervi
On Sun, Apr 11, 2010 at 4:29 PM, Tim Chase python.l...@tim.thechases.comwrote: On 04/11/2010 02:53 PM, MRAB wrote: Victor Subervi wrote: Hi; I send variables to a script. The script adds appropriate lines into a database of an order to my shopping cart. When I refresh the screen

Re: Refresh Problem

2010-04-12 Thread Victor Subervi
On Mon, Apr 12, 2010 at 9:03 AM, Victor Subervi victorsube...@gmail.comwrote: On Sun, Apr 11, 2010 at 4:29 PM, Tim Chase python.l...@tim.thechases.comwrote: On 04/11/2010 02:53 PM, MRAB wrote: Victor Subervi wrote: Hi; I send variables to a script. The script adds appropriate lines

Re: Tempering Client Expectations (OT)

2010-04-12 Thread Victor Subervi
On Mon, Apr 12, 2010 at 10:29 AM, Tim Chase python.l...@tim.thechases.comwrote: your own inaccurate assumptions and answer those, please. Heh, my wife and I joke that in those can this marriage be saved newspaper columns, every answer boils down to communication is key. Keep the customer

Refresh Problem

2010-04-11 Thread Victor Subervi
Hi; I send variables to a script. The script adds appropriate lines into a database of an order to my shopping cart. When I refresh the screen, as no doubt some customers will do, it re-ads those orders. Now, I can delete them, but that's not the point. I don't want it to re-ad the orders. How do

Tempering Client Expectations (OT)

2010-04-10 Thread Victor Subervi
Hi; I'm working with my first client where I've developed a custom script. I way underbid the project and I ate that as part of my learning experience. We outlined as precisely as I knew how what functionality was needed. Then he went to input data and lo and behold he needed more functionality. I

Help Troubleshooting

2010-03-12 Thread Victor Subervi
Hi; I'm running Pexpect (no discussion list) with the following code: #! /usr/bin/python import pexpect def runVpopmail(whatdo, acct, domain, newpw, oldpw=''): if whatdo == 'vadduser': child = pexpect.spawn('/home/vpopmail/bin/%s %...@%s %s' % (whatdo, acct, domain, newpw)) elif whatdo

Re: Interacting With Another Script

2010-03-11 Thread Victor Subervi
On Wed, Mar 10, 2010 at 10:16 PM, alex23 wuwe...@gmail.com wrote: Victor Subervi victorsube...@gmail.com wrote: There's a program (vpopmail) that has commands which, when called, request input (email address, password, etc.) from the command line. I would like to build a TTW interface

Interacting With Another Script

2010-03-10 Thread Victor Subervi
Hi; There's a program (vpopmail) that has commands which, when called, request input (email address, password, etc.) from the command line. I would like to build a TTW interface for my clients to use that interacts with these commands. It's easy enough for me to get the information from a script,

Email Script

2010-03-02 Thread Victor Subervi
Hi; I have the following code: def my_mail(): user, passwd, db, host = login() database = MySQLdb.connect(host, user, passwd, db) cursor= database.cursor() ourEmail1 = 'mari...@globalsolutionsgroup.vi' ourEmail1 = 'p...@globalsolutionsgroup.vi' ourEmail2 = 'benoismyn...@gmail.com'

Re: Email Script

2010-03-02 Thread Victor Subervi
On Tue, Mar 2, 2010 at 11:48 AM, Victor Subervi victorsube...@gmail.comwrote: Hi; I have the following code: def my_mail(): user, passwd, db, host = login() database = MySQLdb.connect(host, user, passwd, db) cursor= database.cursor() ourEmail1 = 'mari...@globalsolutionsgroup.vi

  1   2   3   4   5   6   >