Apple sauce chicken

I sometimes like to get my thoughts into kitchen and cook something tasty. I might not look like, but I like to eat. One of my recent adventures was Apple sauce chicken. Whole idea of such chicken seems more difficult, than it actually is.

Read more…

Easy way to debug email communication in python

I might not be fond of Django itself, but one can learn a thing or two from it. For example, if it wasn't for working with Django, I'd probably miss the fact, that you can start a simple smtp server to debug email communications in your apps (no matter the programming language).

python -m smtpd -n -c DebuggingServer localhost:1025

It's simple as that. Now you can just configure your app to use smtp connection as passed to smtpd server here.

pyramid_fullauth can speak Your language now

A couple of days ago, I completed and released new version of pyramid_fullauth, now at 0.1. This package aims to provide full authorization and authentication functionality for Your pyramid application. It provides standard email authentication, and by integrating velruse, it also allows for broad spectrum of social and oauth2 services authentication, by just the means of settings config! So what's new in version 0.1?

Read more…

unicode is faster than decode

This might come as a surprise, but in python 2.7, it's actually faster to decode strigs with unicode function, than decode method.

>>> from timeit import Timer
>>> s = "grzegrzółka"
>>> ts = Timer(lambda: s.decode('utf-8'))
>>> ts.timeit()
>>> tu = Timer(lambda: unicode(s, 'utf-8'))
>>> tu.timeit()

Of course, unicode method isn't valid for python3, but you can always mock it's behaviour for py3 in some file, but... strings in python3 are finally unicode, not ascii like in python2.7,so unless you develop some nice library, you probably know what python version will be running your project.