getting POST vars from BaseHTTPRequestHandler

2006-06-26 Thread Christopher J. Bottaro
Hi, I can't for the life of me figure out how to get the post vars when using basehttpserver. Here's my code: code class MyHandler(BaseHTTPRequestHandler): def do_POST(self): print self.path, self.command if self.rfile: print self.rfile.read() else:

Re: DB API 2.0 and transactions

2005-06-10 Thread Christopher J. Bottaro
posted mailed Magnus Lycka wrote: You might have spotted a fairly nasty bug there! PostgreSQL violates the SQL standards by running in autocommit mode unless you explicitly perform its non-standard BEGIN command. If you are right about the behaviour you describe, the PostgreSQL binding

DB API 2.0 and transactions

2005-06-07 Thread Christopher J. Bottaro
Hi, Why is there no support for explicit transactions in the DB API? I mean like transaction() to start the trans and commit() and rollback() would end the trans or something. The reason why I ask is because I wrote a daemon that interacts with a Postgres DB. The value of CURRENT_TIMESTAMP

Re: Question about Object Oriented + functions/global vars?

2005-06-06 Thread Christopher J. Bottaro
flamesrock wrote: ok, so to my knowledge, object oriented means splitting something into the simplest number of parts and going from there. That sounds like normal top down imperative (procedural) programming to me. But the question is- when is it enough? Thats a judgment call on the

Re: how to get name of function from within function?

2005-06-06 Thread Christopher J. Bottaro
posted mailed Hey again Steven, I'm still having problems... Steven Bethard wrote: Something like this might work: py class C(object): ... def func_a(self): ... print func_a ... def func_b_impl(self): ... print func_b ... raise Exception ... def

Re: how to get name of function from within function?

2005-06-06 Thread Christopher J. Bottaro
posted mailed Christopher J. Bottaro wrote: The problem is: c.func_b.__name__ 'wrapper' That messes up SOAPpy's RegisterFunction() method which apparently depends on the __name__ of the function to publish it as an available SOAP function. Any suggestions on how to change the name

Re: how to get name of function from within function?

2005-06-05 Thread Christopher J. Bottaro
Steven Bethard wrote: Christopher J. Bottaro wrote: Kent Johnson wrote: class C(object): @in_try def func_a(self): print func_a @in_try def func_b(self): print func_b raise Exception You could probably create a metaclass to apply the wrappers

Re: how to get name of function from within function?

2005-06-04 Thread Christopher J. Bottaro
Steven Bethard wrote: [...snip...] Yes, has's suggestion is probably the right way to go here. I'm still uncertain as to your exact setup here. Are the functions you need to wrap in a list you have? Are they imported from another module? A short clip of your current code and what you want

Re: how to get name of function from within function?

2005-06-04 Thread Christopher J. Bottaro
Steven Bethard wrote: ...snip... Something like this might work: py class C(object): ... def func_a(self): ... print func_a ... def func_b_impl(self): ... print func_b ... raise Exception ... def __getattr__(self, name): ... func =

Re: how to get name of function from within function?

2005-06-04 Thread Christopher J. Bottaro
Kent Johnson wrote: ...snip... I guess I'm just lazy, but I don't want to write the wrapper func for each new func I want to add. I want it done automatically. You can do this almost automatically with a decorator: def in_try(func): def wrapper(*args, **kwargs): try:

how to get name of function from within function?

2005-06-03 Thread Christopher J. Bottaro
I want to get the name of the function from within the function. Something like: def myFunc(): print __myname__ myFunc() 'myFunc' Really what I want to do is to easily strip off the prefix of a function name and call another function. Like this: def prefix_myFunc(a, b, c): name =

Re: What are OOP's Jargons and Complexities?

2005-06-03 Thread Christopher J. Bottaro
posted mailed Paul McGuire wrote: we just recently on this forum had someone ask about polymorphism when what they really meant was overloaded method signatures. (It is even more unfortunate that language features such as overloaded method signatures and operator overloading get equated

Re: how to get name of function from within function?

2005-06-03 Thread Christopher J. Bottaro
Steven Bethard wrote: Christopher J. Bottaro wrote: I want to get the name of the function from within the function. Something like: def myFunc(): print __myname__ myFunc() 'myFunc' There's not a really good way to do this. Can you give some more detail on what exactly you're

Python analog of Ruby on Rails?

2005-05-25 Thread Christopher J. Bottaro
Hello fellow Pythonists, Is there such a thing? My work is thinking of maybe experimenting with Ruby on Rails for some lesser projects. Naturally, I wonder if Python can do as good a job or better... Thanks for the info, -- C -- http://mail.python.org/mailman/listinfo/python-list

Re: Python analog of Ruby on Rails?

2005-05-25 Thread Christopher J. Bottaro
bruno modulix wrote: Christopher J. Bottaro wrote: Hello fellow Pythonists, Is there such a thing? As what ? Oops, sorry, the question is in the subject... May be helpful to repeat it in the body. You may want to have a look at Subway Cool, that looks like what I'm looking

Re: How to find the classname of an object? (was Python Documentation)

2005-05-13 Thread Christopher J. Bottaro
Bengt Richter wrote: type(obj) class '__main__.A' type(obj).mro() [class '__main__.A', class '__main__.B1', class '__main__.B2', [class '__main__.C', type 'object'] tuple(x.__name__ for x in type(obj).mro()) ('A', 'B1', 'B2', 'C', 'object') Wow awesome, thats exactly what I was

Re: How to find the classname of an object? (was Python Documentation)

2005-05-13 Thread Christopher J. Bottaro
Christopher J. Bottaro wrote: Bengt Richter wrote: type(obj) class '__main__.A' type(obj).mro() [class '__main__.A', class '__main__.B1', class '__main__.B2', [class '__main__.C', type 'object'] tuple(x.__name__ for x in type(obj).mro()) ('A', 'B1', 'B2', 'C', 'object') Wow

Re: Python Documentation (should be better?)

2005-05-12 Thread Christopher J. Bottaro
Steven Bethard wrote: Ivan Van Laningham wrote: The Python docs are not ideal. I can never remember, for instance, where to find string methods (not methods in the string module, but methods with '') Hmmm... Well going to http://docs.python.org/ and typing string methods into the search

Re: Python Documentation (should be better?)

2005-05-12 Thread Christopher J. Bottaro
Steven Bethard wrote: Christopher J. Bottaro wrote: Contrast that with Python. First off there is no search mechanism built into the documentation page (yes I know you can google it, but that just doesn't feel right). Um, are you looking at the current documentation page? http

How to find the classname of an object? (was Python Documentation)

2005-05-12 Thread Christopher J. Bottaro
I actually want all the parent classes too. So if D derives off C derives off B derives off A, I ultimately want a tuple ('D', 'C', 'B', 'A'). For those of you following the Python Documentation thread, this is a good example of how the PHP manual is better. I found how to do this in a few

Python Documentation (should be better?)

2005-05-11 Thread Christopher J. Bottaro
This post is just the culmination of my thoughts and discussions with my coworkers on Python. If you are not interested, please skip over it. At my work, we are developing a product from scratch. It is completely modular and the modules communicate via SOAP. Because of that, we can implement

Re: Python Documentation (should be better?)

2005-05-11 Thread Christopher J. Bottaro
Christopher J. Bottaro wrote: ...blah blah blah... Heh, silly me...there is already a huge thread about this...kinda. The intricacies of the computing term greedy aside, yes I think the Python documentation should generally be better. What that means, I have no idea. All I know is that I

Re: Python Documentation (should be better?)

2005-05-11 Thread Christopher J. Bottaro
[EMAIL PROTECTED] wrote: I think Python's doc really rock. It's odd, why do you refer to the tutorial when the lib API is what I'd consider the docs. I guess I mean Python needs a manual, which is basically what the tutorial serves as, but its not comprehensive and organized like how (I think)

Re: Python Documentation (should be better?)

2005-05-11 Thread Christopher J. Bottaro
Steven Bethard wrote: Christopher J. Bottaro wrote: After we were done, we talked about the pros and cons of the languages. Funny, the con of Python (documentation) is PHP's strong point. The PHP manual is extremely easy to navigate and its search feature works great. Contrast

Re: Python Documentation (should be better?)

2005-05-11 Thread Christopher J. Bottaro
rbt wrote: Christopher J. Bottaro wrote: Christopher J. Bottaro wrote: ...blah blah blah... Heh, silly me...there is already a huge thread about this...kinda. The intricacies of the computing term greedy aside, yes I think the Python documentation should generally be better. What

base64 interoperability

2005-04-08 Thread Christopher J. Bottaro
Python's base64 module encodes and decodes differently than PHP's. Python's docs says that it ahere's to RFC1521 (sept 1993), while PHP's adheres to RFC2045 (nov 1996). Is there any Python module that uses the new standard? Why is Python using the old standard anyways? Thanks. --

Re: base64 interoperability

2005-04-08 Thread Christopher J. Bottaro
Christopher J. Bottaro wrote: Python's base64 module encodes and decodes differently than PHP's. Python's docs says that it ahere's to RFC1521 (sept 1993), while PHP's adheres to RFC2045 (nov 1996). Is there any Python module that uses the new standard? Why is Python using the old standard

Re: base64 interoperability

2005-04-08 Thread Christopher J. Bottaro
posted mailed Fredrik Lundh wrote: Christopher J. Bottaro wrote: Python's base64 module encodes and decodes differently than PHP's. really? Yeah, weird, huh? Actually the problem is that Python puts newlines at every 76th char. How do I stop Python from doing that? I just want everyone

Re: base64 interoperability (solved)

2005-04-08 Thread Christopher J. Bottaro
Christopher J. Bottaro wrote: posted mailed Fredrik Lundh wrote: Christopher J. Bottaro wrote: Python's base64 module encodes and decodes differently than PHP's. really? Yeah, weird, huh? Actually the problem is that Python puts newlines at every 76th char. How do I stop Python

Re: super not working in __del__ ?

2005-02-17 Thread Christopher J. Bottaro
Jeff Shannon wrote: Python's __del__() is not a C++/Java destructor. Learn something new everyday... What is it then? Excuse my ignorance, but what are you suppose to do if your object needs to clean up when its no longer used (like close open file handles, etc)? Are you use supposed to make

Re: super not working in __del__ ?

2005-02-16 Thread Christopher J. Bottaro
Fredrik Lundh wrote: Warning: Due to the precarious circumstances under which __del__() methods are invoked, exceptions that occur during their execution are ignored, and a warning is printed to sys.stderr instead. Also, when __del__() is invoked in response to a module being

Re: super not working in __del__ ?

2005-02-16 Thread Christopher J. Bottaro
Jeff Shannon wrote: Christopher J. Bottaro wrote: 2 Questions... 1) Why does this never happen in C++? Or does it, its just never happened to me? 2) I can understand random destruction of instantiated objects, but I find it weird that class definitions (sorry, bad terminology

super not working in __del__ ?

2005-02-15 Thread Christopher J. Bottaro
I get this exception when I run the following code: Exception exceptions.TypeError: 'super() argument 1 must be type, not None' in bound method Txrposdn.__del__ of __main__.Txrposdn object at 0xf6f7118c ignored Here is the code: class Txrposdn(PRI.BasicBatch): def __init__(self, *argv):

empty classes as c structs?

2005-02-04 Thread Christopher J. Bottaro
I find myself doing the following very often: class Struct: pass ... blah = Struct() blah.some_field = x blah.other_field = y ... Is there a better way to do this? Is this considered bad programming practice? I don't like using tuples (or lists) because I'd rather use symbolic names,

Re: HTTP GET request with basic authorization?

2005-01-03 Thread Christopher J. Bottaro
John J. Lee wrote: Jonas Galvez [EMAIL PROTECTED] writes: Christopher J. wrote: I tried this, but it didn't work: conn.request(GET, /somepage.html, None, {AUTHORIZATION: Basic username:password}) [...] import re, base64, urllib2 userpass = ('user', 'pass') url =

HTTP GET request with basic authorization?

2005-01-01 Thread Christopher J. Bottaro
How do I do this using httplib.HTTPConnection and httplib.HTTPConnection.request()? The library reference only gives a simple GET example with no header stuff. I tried this, but it didn't work: conn.request(GET, /somepage.html, None, {AUTHORIZATION: Basic username:password}) Thanks for the

Re: make uninstall?

2004-12-13 Thread Christopher J. Bottaro
for the help. Fredrik Lundh wrote: Christopher J. Bottaro wrote: I installed Python-2.3.4 from source... configure make make install Now I want to remove it, but make uninstall doesn't work. How do I uninstall it? $ python import sys sys.executable '/usr/somewhere/bin/python' sys.prefix

make uninstall?

2004-12-13 Thread Christopher J. Bottaro
I installed Python-2.3.4 from source... configure make make install Now I want to remove it, but make uninstall doesn't work. How do I uninstall it? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to set condition breakpoints?

2004-12-10 Thread Christopher J. Bottaro
Colin J. Williams wrote: Christopher J. Bottaro wrote: I have a script with a class in it: class Class: def f(x, y): # do something I start up the debugger like this: python /usr/lib/python2.3/pdb.py myscript.py I want to set a conditional breakpoint: b

How to set condition breakpoints?

2004-12-09 Thread Christopher J. Bottaro
I have a script with a class in it: class Class: def f(x, y): # do something I start up the debugger like this: python /usr/lib/python2.3/pdb.py myscript.py I want to set a conditional breakpoint: b Class.f, x == 1 and y == 2 ...but that doesn't work. How can I do what

Re: Help with super()

2004-12-07 Thread Christopher J. Bottaro
Thank you everyone for the help, that cleared it up for me. Andy Gross wrote: Florian, See: http://www.python.org/doc/newstyle.html /arg On Dec 7, 2004, at 5:38 AM, Florian Lindner wrote: Steven Bethard schrieb: Christopher J. Bottaro wrote: Why don't this code work? import