Monthly Archives: June 2011

Paster server encoding problems

If you have stumbled upon strange unicode encoding errors within Paste server like this one: File “/usr/lib/python2.6/site-packages/paste/httpserver.py”, line 437, in handle_one_request self.wsgi_execute() File “/usr/lib/python2.6/site-packages/paste/httpserver.py”, line 290, in wsgi_execute self.wsgi_write_chunk(chunk) File “/usr/lib/python2.6/site-packages/paste/httpserver.py”, line 150, in wsgi_write_chunk self.wfile.write(chunk) File “/usr/lib64/python2.6/socket.py”, line 292, … Continue reading

Posted in Coding, Programming, Pylons, Python | Tagged , , , , , , | 2 Comments

Pylons, ContextObj attribute error, strict_c and fix

I’ve recently upgraded my Pylons to version 1.0 for the CMS project I’m working on and few things broke as a result. There were some changes in dependency packages as well, most notably changing of url_for to url which had … Continue reading

Posted in Coding, Programming, Pylons, Python | Tagged , , , , , | Leave a comment

How to get class method name in Python?

There are two ways to do this. You can either do: def whoami(): “””Returns name of the method.””” import sys return sys._getframe(1).f_code.co_name def callersname(): “””Returns name of the caller.””” import sys return sys._getframe(2).f_code.co_name Or you can simply do: import inspect … Continue reading

Posted in Coding, Programming, Python | Tagged , , | Leave a comment