ReverseProxy

2009-11-16 Thread Fred C


I have to write a quick and dirty ReverseProxy with Twisted, for one  
of our internal project. I never used Twisted before, and I was  
wondering of someone have an handy example of a ReverseProxy with  
Twisted to help that I can use as bootstrap.


Many thanks.
Fred-- 
http://mail.python.org/mailman/listinfo/python-list


Re: print executed query

2010-05-03 Thread Fred C

On Apr 29, 2010, at 9:49 AM, Philip Semanchuk wrote:

> 
> On Apr 29, 2010, at 12:01 PM, someone wrote:
> 
>> Hello!
>> 
>> Is there a way to print a query for logging purpose as it was or will
>> be sent to database, if I don't escape values of query by myself?
>> 
>> cursor.execute(query, [id, somestring])
>> 
>> I could print query and values separate, but it would be great, if I
>> could see how query is constructed and can the also copy it and
>> execute in console.
>> 
>> Im using psycopg2, btw
> 
> 
> If you can fiddle with the Postgres server settings, the server has options 
> for logging lots of things, including the queries it executes.
> 
> 
> Hope this helps
> Philip
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list



smime.p7s
Description: S/MIME cryptographic signature
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: print executed query

2010-05-03 Thread Fred C

On Apr 29, 2010, at 9:49 AM, Philip Semanchuk wrote:

> 
> On Apr 29, 2010, at 12:01 PM, someone wrote:
> 
>> Hello!
>> 
>> Is there a way to print a query for logging purpose as it was or will
>> be sent to database, if I don't escape values of query by myself?
>> 
>> cursor.execute(query, [id, somestring])
>> 
>> I could print query and values separate, but it would be great, if I
>> could see how query is constructed and can the also copy it and
>> execute in console.
>> 
>> Im using psycopg2, btw
> 
> 
> If you can fiddle with the Postgres server settings, the server has options 
> for logging lots of things, including the queries it executes.
> 


Yes you can fiddle like that:

>>> cur.mogrify("INSERT INTO test (num, data) VALUES (%s, %s)", (42, 'bar'))
"INSERT INTO test (num, data) VALUES (42, E'bar')"

-fred-





smime.p7s
Description: S/MIME cryptographic signature
-- 
http://mail.python.org/mailman/listinfo/python-list


setuptools question.

2009-07-21 Thread Fred C


I have a python program and when I install this program from the  
module home directory using setup.py everything works fine.


But easy_install fails with the following error, because I am trying  
to install some start up shell scripts into /etc/init.d


> The package setup script has attempted to modify files on your system
>that are not within the EasyInstall build area, and has been aborted.

Is there a way to use easy_install to install the start scripts into / 
etc/init.d. If not, what is the best way to install these scripts.


Thanks

-fred-


--
http://mail.python.org/mailman/listinfo/python-list


Dive into Python question

2006-08-26 Thread Fred C. Dobbs
I feel like an idiot. I'm going thru "Dive Into Python" and running the
first program - odbchelper.py

My output is "pwd=secret;database=master;uid=sa;server=mpilgrim" which
has all the substrings reversed from the output documented in the book.
I've run the downloaded code in Komodo, PythonWin and the command line
and get the same results.

Have I set some switch on my python install that reverses everything?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dive into Python question

2006-08-26 Thread Fred C. Dobbs
Thanks, after I looked into it I realized that the output order can
change arbitarily. It just seems kind of strange that the first example
is one where your output might not match what the author tells you it
should be - and yet there's no mention of this in the book (at least at
that point.)

-- 
http://mail.python.org/mailman/listinfo/python-list