Re: Another Sets Problem

2009-12-29 Thread Victor Subervi
On Tue, Dec 29, 2009 at 9:33 AM, Steve Holden wrote: > That's a bit like being told you have to produce something green, and > then when you do, being told "no, not that green, a light green". So you > produce something a lighter gree and then being told "no, a slightly > redder green". And so on

Re: Another Sets Problem

2009-12-29 Thread Victor Subervi
On Tue, Dec 29, 2009 at 10:16 AM, Steve Holden wrote: > Victor Subervi wrote: > > On Tue, Dec 29, 2009 at 9:33 AM, Steve Holden > <mailto:st...@holdenweb.com>> wrote: > > > > That's a bit like being told you have to produce something green, and > &g

Re: Another Sets Problem

2009-12-29 Thread Victor Subervi
On Tue, Dec 29, 2009 at 12:15 PM, Carsten Haese wrote: > Victor Subervi wrote: > > Once again, it seems nobody is bothering to address this issue. Is it > > beyond your reach as it is beyond mine? I feel compelled to restate the > > problem once again as I did in my origi

Re: Another Sets Problem

2009-12-29 Thread Victor Subervi
On Tue, Dec 29, 2009 at 12:21 PM, MRAB wrote: > Victor Subervi wrote: > > On Tue, Dec 29, 2009 at 6:29 AM, Jean-Michel Pichavant < >> jeanmic...@sequans.com <mailto:jeanmic...@sequans.com>> wrote: >> >>Matt Nordhoff wrote: >> >>Vi

Re: Another Sets Problem

2009-12-29 Thread Victor Subervi
On Tue, Dec 29, 2009 at 12:54 PM, Carsten Haese wrote: > Victor Subervi wrote: > > Since it is difficult to send the inputs but easy to provide the > > outputs, and as opposed to posting the printout, let me direct you here > > to see it first-hand: > > http://angryna

Re: Another Sets Problem

2009-12-29 Thread Victor Subervi
On Tue, Dec 29, 2009 at 1:14 PM, Carsten Haese wrote: > Victor Subervi wrote: > > On Tue, Dec 29, 2009 at 12:54 PM, Carsten Haese > <mailto:carsten.ha...@gmail.com>> wrote: > > > > Victor Subervi wrote: > > > Since it is difficult

Cookies

2009-12-29 Thread Victor Subervi
Hi; I have these lines: cookie = os.environ.get('HTTP_COOKIE') if not cookie: cookie = Cookie.SimpleCookie() cExpires, cPath, cComment, cDomain, cMaxAge, cVersion = myCookie() cookie['lastvisit'] = str(time.time()) cookie['lastvisit']['expires'] = cExpires cookie['lastvisit

Re: Another Sets Problem

2009-12-29 Thread Victor Subervi
On Tue, Dec 29, 2009 at 3:58 PM, Carsten Haese wrote: > Victor Subervi wrote: > > You know I did this before, substituting "f" for "field", and it honestly > wouldn't print but threw a 500 error. Now it works. I don't understand. > > That's

Re: Another Sets Problem

2009-12-29 Thread Victor Subervi
On Tue, Dec 29, 2009 at 4:30 PM, Carsten Haese wrote: > Victor Subervi wrote: > > On Tue, Dec 29, 2009 at 3:58 PM, Carsten Haese > <mailto:carsten.ha...@gmail.com>> wrote: > > > > Victor Subervi wrote: > > > You know I did this be

Re: Another Sets Problem

2009-12-30 Thread Victor Subervi
On Tue, Dec 29, 2009 at 6:08 PM, Emile van Sebille wrote: > On 12/29/2009 12:52 PM Victor Subervi said... > >> On Tue, Dec 29, 2009 at 4:30 PM, Carsten Haese > <mailto:carsten.ha...@gmail.com>> wrote: >>You need to rethink your priorities. Understanding your cod

Re: Cookies

2009-12-30 Thread Victor Subervi
On Tue, Dec 29, 2009 at 3:43 PM, Carsten Haese wrote: > Victor Subervi wrote: > > Hi; > > I have these lines: > > > > cookie = os.environ.get('HTTP_COOKIE') > > if not cookie: > > cookie = Cookie.SimpleCookie() > > cExpires,

Bare Excepts

2009-12-30 Thread Victor Subervi
Hi; I'll trouble-shoot bare excepts as I work on new code. I'll trouble-shoot the others that don't (seem to) cause problems later. Here's a new one: for optionsStore, storeOptions in ourOptions().iteritems(): if store == optionsStore: for option in storeOptions: try:

Re: Bare Excepts

2009-12-30 Thread Victor Subervi
On Wed, Dec 30, 2009 at 9:04 AM, Jean-Michel Pichavant < jeanmic...@sequans.com> wrote: > Victor Subervi wrote: > >> Hi; >> I'll trouble-shoot bare excepts as I work on new code. I'll trouble-shoot >> the others that don't (seem to) cause p

Re: Bare Excepts

2009-12-30 Thread Victor Subervi
On Wed, Dec 30, 2009 at 9:09 AM, Victor Subervi wrote: > >> Anyway, you should definitely use a coding rule checker, like pylint or > pyckeck. It would sometimes point you into the correct direction. For > instance, pylint will tell you that except: pass is often (not always) a

Re: Bare Excepts

2009-12-30 Thread Victor Subervi
On Wed, Dec 30, 2009 at 9:23 AM, Jean-Michel Pichavant < jeanmic...@sequans.com> wrote: > Victor Subervi wrote: > > On Wed, Dec 30, 2009 at 9:09 AM, Victor Subervi > > victorsube...@gmail.com>> wrote: >> >> >>Anyway, you should definitely us

Re: Cookies

2009-12-30 Thread Victor Subervi
On Wed, Dec 30, 2009 at 9:56 AM, Carsten Haese wrote: > So, guess again. The "trivial example" has three more lines of code. One > of them is unlike any line you have in your code. That's the line > responsible for producing the "Set-Cookie" header, and that's the line > you're missing. > So you'

Re: Cookies

2009-12-30 Thread Victor Subervi
On Wed, Dec 30, 2009 at 11:54 AM, Carsten Haese wrote: > Victor Subervi wrote: > > Here again is my code: > > > > #! /usr/bin/python > > > > import string > > import cgitb; cgitb.enable() > > import MySQLdb > > import cgi > > import sys,

Re: Cookies

2009-12-30 Thread Victor Subervi
On Wed, Dec 30, 2009 at 12:19 PM, Steve Holden wrote: > Carsten Haese wrote: > I will point out again, without the least expectation that it will do > any good, that the reason this problem has occurred is that Victor > simply refuses to take the time to absorb the principles of what he is > atte

Re: Bare Excepts

2009-12-30 Thread Victor Subervi
On Wed, Dec 30, 2009 at 12:23 PM, Steve Holden wrote: > Victor Subervi wrote: > > On Wed, Dec 30, 2009 at 9:23 AM, Jean-Michel Pichavant > [...] > > In your example you must lookt at your sql module documentation to > > know which kind of exception it can throw. &

Re: Cookies

2009-12-30 Thread Victor Subervi
On Wed, Dec 30, 2009 at 12:43 PM, Carsten Haese wrote: > Anyway, the likely answer is that you guessed incorrectly. As I said > before, you need to make sure that the cookie is printed as part of the > page headers. I'll give you one last hint: The page header is where > you're printing the "Conte

Re: Cookies

2009-12-30 Thread Victor Subervi
On Wed, Dec 30, 2009 at 12:51 PM, Carsten Haese wrote: > Victor Subervi wrote: > > Comments from a left-brain thinker without any concept of how difficult > > it is for a right-brain thinker to think like you. Care to compare > > poetry? I'd bury you. > > That

Re: Cookies

2009-12-30 Thread Victor Subervi
On Wed, Dec 30, 2009 at 12:51 PM, Carsten Haese wrote: > Victor Subervi wrote: > > Comments from a left-brain thinker without any concept of how difficult > > it is for a right-brain thinker to think like you. Care to compare > > poetry? I'd bury you. > > That

Re: Bare Excepts

2009-12-30 Thread Victor Subervi
On Wed, Dec 30, 2009 at 3:29 PM, Ben Finney > wrote: > samwyse writes: > > > I inherited some code that used bare excepts *everywhere*. There were > > about 4K lines of code, IIRC, and I think that they were more except > > clauses than elses. > > Visual Basic programmers will learn how to writ

Re: Cookies

2009-12-30 Thread Victor Subervi
You know, neither one of those tutorials I followed gave clear, or any, instruction about putting a print cookie statement in the header! How misleading! beno -- http://mail.python.org/mailman/listinfo/python-list

Length of an Unsized Object

2009-12-31 Thread Victor Subervi
Hi; I have this code: sql = 'describe %s %s;' % (optionsStore, option) print sql cursor.execute(sql) descr = cursor.fetchone() if len(descr) is not None: Python complains: *TypeError*: len() of unsized object Please advise how to rewrite the last line so

Re: Cookies

2009-12-31 Thread Victor Subervi
On Thu, Dec 31, 2009 at 1:10 AM, Carsten Haese wrote: > Victor Subervi wrote: > > You know, neither one of those tutorials I followed gave clear, or any, > > instruction about putting a > > print cookie > > statement in the header! How misleading! > > Don't b

Re: Bare Excepts

2009-12-31 Thread Victor Subervi
On Wed, Dec 30, 2009 at 11:00 PM, Steve Holden wrote: > Victor Subervi wrote: > > On Wed, Dec 30, 2009 at 3:29 PM, Ben Finney > > > > <mailto:ben%2bpyt...@benfinney.id.au >> > wrote: > > > > samwyse mailto:samw...@gmail.com>> writes:

Not Incrementing

2009-12-31 Thread Victor Subervi
Hi; This "pseudo-code" snippet was given to me by Dennis on this list (whose last name escapes me): def printTree(allTrees, level=0): tree = [] for aTree in allTrees: for name in sorted(aTree.keys()): tree.append("%s%s" % ("\t" * level, name)) printTree(aTree[name], level + 1)

Re: Length of an Unsized Object

2009-12-31 Thread Victor Subervi
On Thu, Dec 31, 2009 at 12:01 PM, Stephen Hansen wrote: > On Thu, Dec 31, 2009 at 8:09 AM, Victor Subervi > wrote: > >> Hi; >> I have this code: >> >> sql = 'describe %s %s;' % (optionsStore, option) >> print sql >>

Re: Not Incrementing

2009-12-31 Thread Victor Subervi
On Thu, Dec 31, 2009 at 12:19 PM, MRAB wrote: > Victor Subervi wrote: > >> Hi; >> This "pseudo-code" snippet was given to me by Dennis on this list (whose >> last name escapes me): >> >> def printTree(allTrees, level=0): >> tree = []

Re: Not Incrementing

2009-12-31 Thread Victor Subervi
On Thu, Dec 31, 2009 at 1:01 PM, Dave Angel wrote: > Victor Subervi wrote: > >> Hi; >> This "pseudo-code" snippet was given to me by Dennis on this list (whose >> last name escapes me): >> >> def printTree(allTrees, level=0): >> tree = []

Re: Not Incrementing

2009-12-31 Thread Victor Subervi
On Thu, Dec 31, 2009 at 3:01 PM, MRAB wrote: > Victor Subervi wrote: > >> On Thu, Dec 31, 2009 at 1:01 PM, Dave Angel > da...@ieee.org>> wrote: >> >> [snip] > > >>Incidentally, good naming would help to make the code easier to >>debug.

Re: Not Incrementing

2009-12-31 Thread Victor Subervi
On Thu, Dec 31, 2009 at 3:46 PM, MRAB wrote: > Victor Subervi wrote: > >> On Thu, Dec 31, 2009 at 3:01 PM, MRAB > pyt...@mrabarnett.plus.com>> wrote: >> >>Victor Subervi wrote: >> >>On Thu, Dec 31, 2009 at 1:01 PM, Dave Angel >

Re: Cookies

2009-12-31 Thread Victor Subervi
I'm curious. Are there other instances where code needs to be inserted into the header as in the print cookie to get it to be baked on the user's PC? TIA, beno -- http://mail.python.org/mailman/listinfo/python-list

Re: Not Incrementing

2010-01-01 Thread Victor Subervi
On Fri, Jan 1, 2010 at 2:47 AM, Victor Subervi wrote: > On Thu, Dec 31, 2009 at 3:46 PM, MRAB wrote: > >> Victor Subervi wrote: >> >>> On Thu, Dec 31, 2009 at 3:01 PM, MRAB >> pyt...@mrabarnett.plus.com>> wrote: >>> >>>Victor Sube

MySQL Error

2010-01-01 Thread Victor Subervi
Hi; I'm trying to avoid the mortal sin of blank excepts. I intentionally threw this error: Traceback (most recent call last): File "/var/www/html/angrynates.com/cart/createAssociations2.py", line 137, in ? createAssociations2() File "/var/www/html/angrynates.com/cart/createAssociations2.py

Re: MySQL Error

2010-01-01 Thread Victor Subervi
On Fri, Jan 1, 2010 at 12:10 PM, MRAB wrote: > Victor Subervi wrote: > >> Hi; >> I'm trying to avoid the mortal sin of blank excepts. I intentionally threw >> this error: >> >> Traceback (most recent call last): >> File "/var/www/html/

Append Problem

2010-01-02 Thread Victor Subervi
Hi; I have the following code snippet: print 'Original: ', catChains, '' while i < MAXLEVEL: flag = 0 j = 0 while j < len(parents): for chain in catChains: if parents[j] == chain[len(chain)-1]: chain.append(children[j]) print '1: ', catChains, ''

Re: Append Problem

2010-01-02 Thread Victor Subervi
There isn't a tuple is sight there - you are dealing with lists, and you > are modifying the very list you are iterating over. > > Try rewriting the code to create a new list from the old one (i.e. > iterate over catChains and have your code append to an initially empty > list called, for example,

Re: Append Problem

2010-01-02 Thread Victor Subervi
On Sat, Jan 2, 2010 at 10:46 AM, Steve Holden wrote: > > See the .sig. Of course I'm a businessman. > Nice site! In that case, respectfully I disagree! beno -- http://mail.python.org/mailman/listinfo/python-list

Can't Add Variable

2010-01-04 Thread Victor Subervi
Hi; I have this code snippet: sql '''create table if not exists %sCustomerData ( ID tinyint(8) unsigned primary key auto_increment, Email varchar(120) not null, PhoneNumber varchar(20) not null, BillingName varchar(80) not null, BillingAddress1 varchar(100) not nu

Re: Can't Add Variable

2010-01-04 Thread Victor Subervi
On Mon, Jan 4, 2010 at 1:42 PM, Chris Rebert wrote: > On Mon, Jan 4, 2010 at 9:28 AM, Victor Subervi > wrote: > > Hi; > > I have this code snippet: > > > > sql '''create table if not exists %sCustomerData ( > > You're missing an eq

Premature End Of Script Headers

2010-01-04 Thread Victor Subervi
Hi; Here's my entire test script: #!/usr/bin/python def myMail(): print 'Content-type: text/html' print print ''' ''' Here's the error: [Mon Jan 04 12:59:15 2010] [error] [client 66.82.9.61] Premature end of script headers: mail.py, referer: http://angrynates.com/cart/cart2.py [r.

chown'ing by script

2010-01-05 Thread Victor Subervi
Hi; I have a script that is called via the web. This script writes another script that is also called by the web, which in turn needs to have execution privileges. The problem is that the programmatically created file is owned by apache.apache and thus doesn't have execution privileges. I've tried

TypeError

2010-01-05 Thread Victor Subervi
Hi; I get this error: /var/www/html/angrynates.com/christians/cart/simplemail/mail.py 153 154 ''' 155 commitSale() 156 myMail() 157 print ''' commitSale = /var/www/html/angrynates.com/christians/cart/simplemail/mail.py in commitSale() 98 cursor.execute('select max(ID) from %sC

Re: chown'ing by script

2010-01-05 Thread Victor Subervi
On Wed, Jan 6, 2010 at 1:41 AM, Carsten Haese wrote: > Victor Subervi wrote: > > Hi; > > I have a script that is called via the web. This script writes another > > script that is also called by the web, which in turn needs to have > > execution privileges. The problem i

Re: chown'ing by script

2010-01-06 Thread Victor Subervi
On Wed, Jan 6, 2010 at 2:12 AM, alex23 wrote: > Carsten Haese wrote: > > What is the underlying problem you're trying to solve with this > > approach? > > To be paid for developing a web site shopping cart without actually > having to learn Python. > LOL! I've written about 12,000 lines of code

Re: TypeError

2010-01-06 Thread Victor Subervi
On Wed, Jan 6, 2010 at 12:29 PM, MRAB wrote: > Victor Subervi wrote: > >> Hi; >> I get this error: >> >> /var/www/html/angrynates.com/christians/cart/simplemail/mail.py < >> http://angrynates.com/christians/cart/simplemail/mail.py> >> >>

getfirst and re

2010-01-06 Thread Victor Subervi
Hi; I need to do something like the following: pat = re.compile('edit[0-9]*:[0-9]*') check = form.getfirst(pat) (to check things like 'edit0:1') How do I do this? TIA, beno -- The Logos has come to bear http://logos.13gems.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: getfirst and re

2010-01-06 Thread Victor Subervi
On Wed, Jan 6, 2010 at 1:27 PM, Tim Chase wrote: > But if you're using it on HTML form text, regexps are usually the wrong > tool, and you should be using an HTML parser (such as BeautifulSoup) that > knows how to handle odd text and escapings better and more robustly than > regexps will. > I hav

Re: getfirst and re

2010-01-06 Thread Victor Subervi
On Wed, Jan 6, 2010 at 1:59 PM, Tim Chase wrote: > Victor Subervi wrote: > >> On Wed, Jan 6, 2010 at 1:27 PM, Tim Chase > >wrote: >> >> But if you're using it on HTML form text, regexps are usually the wrong >>> tool, and you should be using an HTML p

Re: getfirst and re

2010-01-06 Thread Victor Subervi
On Wed, Jan 6, 2010 at 3:09 PM, Carsten Haese wrote: > Victor Subervi wrote: > > I have an automatically generated HTML form from which I need to extract > > data to the script which this form calls (to which the information is > > sent). > > Ideally, the script that re

Re: getfirst and re

2010-01-08 Thread Victor Subervi
On Wed, Jan 6, 2010 at 2:19 PM, Victor Subervi wrote: > On Wed, Jan 6, 2010 at 3:09 PM, Carsten Haese wrote: > >> Victor Subervi wrote: >> > I have an automatically generated HTML form from which I need to extract >> > data to the script which this form call

Re: getfirst and re

2010-01-08 Thread Victor Subervi
On Fri, Jan 8, 2010 at 10:11 AM, Carsten Haese wrote: > Victor Subervi wrote: > > Code snippet: > > [...] > > > > Error: > > [...] > > What do? > > After eliminating the pieces of your post that have been copied or > quoted from elsewhere, I am left

Re: getfirst and re

2010-01-08 Thread Victor Subervi
On Fri, Jan 8, 2010 at 1:26 PM, Steve Holden wrote: > MRAB wrote: > > Victor Subervi wrote: > > [snip] > >> > >> Code snippet: > >> > >> def cgiFieldStorageToDict(fieldStorage): > >

Re: getfirst and re

2010-01-08 Thread Victor Subervi
On Fri, Jan 8, 2010 at 2:52 PM, Jean-Michel Pichavant < jeanmic...@sequans.com> wrote: > Victor Subervi wrote: > > On Fri, Jan 8, 2010 at 1:26 PM, Steve Holden > st...@holdenweb.com>> wrote: >> >> MRAB wrote: >>> Victor Subervi wrote:

Re: getfirst and re

2010-01-08 Thread Victor Subervi
On Fri, Jan 8, 2010 at 2:52 PM, Jean-Michel Pichavant < jeanmic...@sequans.com> wrote: > Victor Subervi wrote: > > On Fri, Jan 8, 2010 at 1:26 PM, Steve Holden > st...@holdenweb.com>> wrote: >> >> MRAB wrote: >>> Victor Subervi wrote:

Re: getfirst and re

2010-01-08 Thread Victor Subervi
On Fri, Jan 8, 2010 at 3:09 PM, Victor Subervi wrote: > > > On Fri, Jan 8, 2010 at 2:52 PM, Jean-Michel Pichavant < > jeanmic...@sequans.com> wrote: > >> Victor Subervi wrote: >> >> On Fri, Jan 8, 2010 at 1:26 PM, Steve Holden >> st...

Another Screwy Problem

2010-01-08 Thread Victor Subervi
Hi; I have this line of code: sql = 'select Name, Price from %sPackages where ID=%s;' % (store, pid) which prints to this: select Name, Price from productsPackages where ID=1; which when I enter it into the MySQL interpreter gives me this: mysql> select Name, Price from productsPackages where ID=

Re: getfirst and re

2010-01-08 Thread Victor Subervi
On Fri, Jan 8, 2010 at 3:21 PM, MRAB wrote: > Victor Subervi wrote: > > On Fri, Jan 8, 2010 at 1:26 PM, Steve Holden > st...@holdenweb.com>> wrote: >> >> MRAB wrote: >> > Victor Subervi wrote: >> > [snip] >> >> >>

Re: getfirst and re

2010-01-08 Thread Victor Subervi
On Fri, Jan 8, 2010 at 3:37 PM, MRAB wrote: > Victor Subervi wrote: > >> On Fri, Jan 8, 2010 at 3:09 PM, Victor Subervi >> > victorsube...@gmail.com>> wrote: >> >> >> >>On Fri, Jan 8, 2010 at 2:52 PM, Jean-Michel Pichavant >>m

Something More Elegant

2010-01-09 Thread Victor Subervi
Hi; The following code works fine. I would like you to suggest something more simple and elegant: sql = 'select p.ID from %sPackages p join %sCategoriesPackages c where c.CategoryID=%s;' % (store, store, categoryID) cursor.execute(sql) tmp = [itm[0] for itm in cursor] packa

Re: Something More Elegant

2010-01-09 Thread Victor Subervi
On Sat, Jan 9, 2010 at 8:39 AM, Tim Chase wrote: > Victor Subervi wrote: > >> Hi; >> The following code works fine. I would like you to suggest something more >> simple and elegant: >> >> sql = 'select p.ID from %sPackages p join %sCategoriesPackages

Re: Another Screwy Problem

2010-01-09 Thread Victor Subervi
On Sat, Jan 9, 2010 at 9:07 AM, J. Cliff Dyer wrote: > On Sat, 2010-01-09 at 07:59 -0500, Victor Subervi wrote: > > On Fri, Jan 8, 2010 at 4:44 PM, J. Clifford Dyer > > wrote: > > Victor Subervi wrote: > > > Hi; > > > I hav

Re: Something More Elegant

2010-01-09 Thread Victor Subervi
On Sat, Jan 9, 2010 at 9:35 AM, Steve Holden wrote: > But we are now in the realm of theory as far as you are concerned, since > you have already stated several times that you aren't interested in > correcting your design until after you have got the current mess into > production. So good luck

Re: Something More Elegant

2010-01-09 Thread Victor Subervi
On Sat, Jan 9, 2010 at 10:14 AM, Iuri wrote: > And you should use cursor.fetchall() instead of cursor in list > comprehension: > > packageIDs = [itm[0] for itm in cursor.fetchall()] > Now, someone else on this list told me the other. Can you explain the difference? TIA, beno -- http://mail.pyth

Easy Q

2010-01-09 Thread Victor Subervi
Hi; I have a string.join statement on a variable that comes from a cgi.FieldStorage().getlist. The variable may be a list or a single value. I need to treat it differently depending on which it is. How can I distinguish it? len(var) will obviously give me the length of the string if it's a string a

Re: Easy Q

2010-01-09 Thread Victor Subervi
On Sat, Jan 9, 2010 at 11:56 AM, Gary Herron wrote: > Victor Subervi wrote: > >> Hi; >> I have a string.join statement on a variable that comes from a >> cgi.FieldStorage().getlist. The variable may be a list or a single value. I >> need to treat it differently depen

Re: Something More Elegant

2010-01-09 Thread Victor Subervi
On Sat, Jan 9, 2010 at 1:00 PM, Dennis Lee Bieber wrote: > On Sat, 9 Jan 2010 10:28:31 -0500, Victor Subervi > declaimed the following in > gmane.comp.python.general: > > > On Sat, Jan 9, 2010 at 10:14 AM, Iuri wrote: > > > > > And you should use cursor.fet

Academic Question

2010-01-10 Thread Victor Subervi
Hi; The following code that works: #! /usr/bin/python import string import cgitb; cgitb.enable() import cgi import MySQLdb import sys,os from sets import Set import fpformat cwd = os.getcwd() sys.path.append(cwd) from login import login from particulars import ourOptions form = cgi.FieldStorage(

Re: Something More Elegant

2010-01-10 Thread Victor Subervi
On Sat, Jan 9, 2010 at 3:00 PM, Stephen Hansen wrote: > On Sat, Jan 9, 2010 at 7:15 AM, Victor Subervi wrote: > >> On Sat, Jan 9, 2010 at 9:35 AM, Steve Holden wrote: >> >>> But we are now in the realm of theory as far as you are concerned, since >>> you ha

Re: Academic Question

2010-01-11 Thread Victor Subervi
On Sun, Jan 10, 2010 at 3:09 PM, MRAB wrote: > browser = form.getfirst('browser', 'all') >> except: >> browser = headers() >> >> try: > A bare except, and if an exception _does_ occur, they'll be a NameError > because 'headers' isn't defined. > > Oh, not the large halibut again! (I will be c

Re: Easy Q

2010-01-11 Thread Victor Subervi
On Mon, Jan 11, 2010 at 10:00 AM, Jean-Michel Pichavant < jeanmic...@sequans.com> wrote: > Victor Subervi wrote: > > On Sat, Jan 9, 2010 at 11:56 AM, Gary Herron > > gher...@islandtraining.com>> wrote: >> >>Victor Subervi wrote: >> >>

Re: Academic Question

2010-01-11 Thread Victor Subervi
On Mon, Jan 11, 2010 at 11:26 AM, Dave Angel wrote: > Victor Subervi wrote: > >> On Sun, Jan 10, 2010 at 3:09 PM, MRAB wrote: >> >> >> >>> browser = form.getfirst('browser', 'all') >>> >>> >>>> except:

Changing var names

2010-01-15 Thread Victor Subervi
Hi; Well it took me *less than a day* to fix the following problems: -- bare excepts (accidentally left a couple I think) -- sql injection attacks -- recreating tables to make them more reasonable ** "Programming is an ITERATIVE process." ***

Re: Changing var names

2010-01-15 Thread Victor Subervi
On Fri, Jan 15, 2010 at 2:26 PM, Jean-Michel Pichavant < jeanmic...@sequans.com> wrote: > Victor Subervi wrote: > >> Hi; >> Well it took me *less than a day* to fix the following problems: >> -- bare excepts (accidentally left a couple I think) >> -- sql injec

Re: Changing var names

2010-01-15 Thread Victor Subervi
On Fri, Jan 15, 2010 at 3:15 PM, Adam Tauno Williams < awill...@opengroupware.us> wrote: > On Fri, 2010-01-15 at 13:27 -0400, Victor Subervi wrote: > > Hi; > > Well it took me *less than a day* to fix the following problems: > > -- bare excepts (accidentally left a

Re: Changing var names

2010-01-15 Thread Victor Subervi
On Fri, Jan 15, 2010 at 3:45 PM, Phlip wrote: > Adam Tauno Williams wrote: > > This process is called 'refactoring' [a good term to Google], and every >> decent IDE provides some support [if it doesn't, it isn't a "decent" >> IDE] >> > > Way more important than IDE support is developers writing

Re: Changing var names

2010-01-16 Thread Victor Subervi
On Fri, Jan 15, 2010 at 3:47 PM, Phlip wrote: > Victor Subervi wrote: > > > Should I re-write it in classes before testing units? Right now it's > > very monolithic. > > The "Unit" in unit tests is a misnomer. It refers to an old QA concept, for > high-

Re: Something More Elegant

2010-01-17 Thread Victor Subervi
On Sat, Jan 9, 2010 at 1:00 PM, Dennis Lee Bieber wrote: >After the table design is complete you can move to business logic > operations (SQL for standard/fixed actions), along with criteria to > maintain the integrity of the data (foreign key constraints, etc.). This > should result in a

Interesting Problem

2010-01-20 Thread Victor Subervi
Hi; I think I finally have an interesting problem for y'all. I need to import a script from a lower dir, forcing me to change dirs: cwd = os.getcwd() os.chdir('%s/..' % cwd) sys.path.append(os.getcwd()) from templateFrame import top, bottom os.chdir(cwd) Because I've found I must do my form evalu

Re: Something More Elegant

2010-01-20 Thread Victor Subervi
On Sun, Jan 17, 2010 at 5:36 PM, Dennis Lee Bieber wrote: >I don't think that would be efficient, considering that "the above" > entails what would be something like three or four courses all by > themselves (Database Analysis, Database Design, SQL [these three are > independent of any par

Re: Changing var names

2010-01-20 Thread Victor Subervi
On Mon, Jan 18, 2010 at 10:10 AM, Jean-Michel Pichavant < jeanmic...@sequans.com> wrote: > Victor Subervi wrote: > >> On Fri, Jan 15, 2010 at 3:15 PM, Adam Tauno Williams < >> awill...@opengroupware.us <mailto:awill...@opengroupware.us>> wrote: >> >&

Re: Interesting Problem

2010-01-20 Thread Victor Subervi
On Wed, Jan 20, 2010 at 12:30 PM, Stephen Hansen wrote: > On Wed, Jan 20, 2010 at 7:19 AM, Victor Subervi > wrote: > >> Hi; >> I think I finally have an interesting problem for y'all. I need to import >> a script from a lower dir, forcing me to change dirs: &

Multiple Select

2009-10-02 Thread Victor Subervi
Hi; I'm trying to create an HTML with several options in a form that is posted to a script. I want to enable the user to select multiple options. The problem is I don't know how to call those options in my cgi calls in the script to which it posts. Only one of them gets associated with the variabl

Re: Multiple Select

2009-10-02 Thread Victor Subervi
e: > On Fri, 02 Oct 2009 14:25:55 -0700, Victor Subervi < > victorsube...@gmail.com> wrote: > > Hi; >> I'm trying to create an HTML with several options in a form that >> is >> posted to a script. I want to enable the user to select multiple options. &

Customizing Option Elements

2009-10-03 Thread Victor Subervi
Hi; I want to create elements within a element in which I could insert html, which, of course, is illegal (don't tell the police ;) so I'm looking at recreating the form elements using my own customized elements, that is, hacking the equivalent from scratch, but how do I proceed? I would like to

Problem Displaying Pics

2009-10-06 Thread Victor Subervi
Hi; I have the following archaic code that worked just fine for another site. It is called with the following url: http://13gems.com/stxresort/cart/getpic1.py?id=1&x=1 #!/usr/local/bin/python import cgitb; cgitb.enable() import MySQLdb import cgi import sys,os sys.path.append(os.getcwd()) from lo

Re: Problem Displaying Pics

2009-10-06 Thread Victor Subervi
09 12:19:56 -0700, Victor Subervi < > victorsube...@gmail.com> wrote: > > Hi; >> I have the following archaic code that worked just fine for another site. >> It >> is called with the following url: >> >> http://13gems.com/stxresort/cart/getpic1.py?i

Re: Problem Displaying Pics

2009-10-06 Thread Victor Subervi
ho seems to be a FAR better service than eNom, whom I actually had to report to the BBB and they never fixed or acknowledged very obvious problems. At any rate, the above code gets the browser to print out all the binary "garbage" that should translate into an image (you can look: http:/

Re: Problem Displaying Pics

2009-10-07 Thread Victor Subervi
I took out the line in question (with text/html). Now it prints to screen the url. It did that before. Strange. Any other ideas? TIA, V On Tue, Oct 6, 2009 at 3:40 PM, Rami Chowdhury wrote: > On Tue, 06 Oct 2009 13:26:19 -0700, Victor Subervi < > victorsube...@gmail.com> wrote: >

Re: Problem Displaying Pics

2009-10-07 Thread Victor Subervi
rint '''Content-Type: image/jpeg ''' print print content Your comments are very much appreciated. TIA, V On Wed, Oct 7, 2009 at 9:51 AM, Gabriel Genellina wrote: > En Tue, 06 Oct 2009 17:26:19 -0300, Victor Subervi > escribió: > > The code in quest

Re: Problem Displaying Pics

2009-10-07 Thread Victor Subervi
Yes it is. I have had it print to screen already, and there is data in the database. V On Wed, Oct 7, 2009 at 10:03 AM, Rami Chowdhury wrote: > On Wed, 07 Oct 2009 06:37:08 -0700, Victor Subervi < > victorsube...@gmail.com> wrote: > > I took out the line in question (with

Re: Problem Displaying Pics

2009-10-07 Thread Victor Subervi
cgihandler: Content-Encoding: base64 [Wed Oct 07 10:47:42 2009] [error] [client 66.248.168.98] PythonHandler mod_python.cgihandler: ^ [Wed Oct 07 10:47:42 2009] [error] [client 66.248.168.98] PythonHandler mod_python.cgihandler: SyntaxError: invalid syntax Ideas? TIA, V On Wed, Oct 7, 2009 at 12:00 PM, R

Re: Problem Displaying Pics

2009-10-07 Thread Victor Subervi
; from products where id='" + str(picid) + "';" cursor.execute(sql) content = cursor.fetchall()[0][0].tostring() cursor.close() print '''Content-Type: image/jpeg Content-Encoding: base64 ''' print print content.encode('base64')

Re: Problem Displaying Pics

2009-10-07 Thread Victor Subervi
ct 7, 2009 at 2:47 PM, Gabriel Genellina wrote: > En Wed, 07 Oct 2009 12:00:13 -0300, Victor Subervi > escribió: > > > print '''Content-Type: image/jpeg > > > > ''' > > print > > print content > > On Wed, Oct 7, 2009 at 9

Re: Problem Displaying Pics

2009-10-07 Thread Victor Subervi
ase64') Neither worked :( V On Wed, Oct 7, 2009 at 3:40 PM, Carsten Haese wrote: > Victor Subervi wrote: > > [...] > > print '''Content-Type: image/jpeg > > > > Content-Encoding: base64 > > ''' > > [...] > > You

Re: Problem Displaying Pics

2009-10-07 Thread Victor Subervi
otten that far before, and once I read "Adobe" something, so yes, it's an image. TIA, V On Wed, Oct 7, 2009 at 3:52 PM, Rami Chowdhury wrote: > On Wed, 07 Oct 2009 13:24:28 -0700, Victor Subervi < > victorsube...@gmail.com> wrote: > > I did that. In fact, just to mak

Re: Problem Displaying Pics

2009-10-08 Thread Victor Subervi
http://13gems.com/stxresort/cart/getpic1.py?id=1&x=1 TIA, V On Wed, Oct 7, 2009 at 4:11 PM, Rami Chowdhury wrote: > On Wed, 07 Oct 2009 14:05:25 -0700, Victor Subervi < > victorsube...@gmail.com> wrote: > > print 'Content-Type: image/jpeg' >> print '

Nested Menus

2009-10-08 Thread Victor Subervi
Hi; I have the following code: sql = 'create table if not exists categories (ID int(3) unsigned primary key, Category varchar(40), Parent varchar(40))' cursor.execute(sql) cursor.execute('select Category, Parent from categories;') data = cursor.fetchall() parents = [] Parents = [] for

<    1   2   3   4   5   6   >