Armin Ronacher

Python Web Development

written by Armin Ronacher, on Tuesday, November 7, 2006 0:00.

And again the situation where I start hating python for some problems which basically have nothing to do with python but with so many other problems that my mind starts exploding :)

There is a huge amount of python frameworks out there. But not a single one does what i want...

django

pros

  • active community
  • very good documentation
  • widely used
  • easy to use orm
  • automatic admin panel
  • cool template engine
  • working form validation
  • i18n

cons

  • orm very limited
  • admin system limited
  • not deployable
  • no unicode

TurboGears

pros

  • active community
  • supports sqlalchemy

cons

  • not deployable
  • no admin panel
  • i hate xml template engines
  • a huge amount of dependencies
  • just formencode for i18n

pylons

pros

  • bound to wsgi
  • sqlalchemy support
  • deployable

cons

  • no working unicode support
  • no i18n that works for me
  • sqlalchemy needs a lot of hacking until it works

I think I'll stay with django for websites I want to use for presenting some data. Eg: projects, websites etc. And my own colubrid module for applications i want to deploy. Always when I start working on something I have to find out sooner or later that I hit a wall with my requirements. Looks like nearly nobody uses unicode, looks like i18n is for most webframework developers a stupid abbreviation for stuff nobody uses. If if they start implementing unicode or i18n they stop at the point where unicode/i18n starts being complicated (plural forms, charsets, combined unicode characters, urlencoded parameters, form data, internationalized error messages/form validation errors, date/time/string format methods etc.)

And I think it's not a problem of a framework. IMHO it's impossible to write a framework that does everything. It's still the best to just use a thin wrapper between WSGI and your application and implement your stuff on top of it. In case of pocoo that's i18n, l10n, unicode support, plugins, request dispatching and database layer. That doesn't meant that you should ignore existing packages but carefully select if a module does what you want to do. According to the ohloh statistics we wrote pocoo already 5 times :D So we basically know what it means to have code that hits a wall because we hit many walls on our way to the perfect web application. If you want to write a really great one, you can't just cherry pick from existing solutions without sticking them together so that they feel like they are made out of the same material.

All-in-one solutions don't work. Neither in real life (media pcs can't replace my dvd player, a psp not my nintendo ds + ipod and a smartphone not my mobile) nor in the world of web applications.

</braindump>

Pygments Released and a new Pastebin

written by Armin Ronacher, on Monday, October 30, 2006 0:00.

pygments 0.51 was released today :-) And because i had some spare time I created a small pastebin that uses django, sqlite and pygments.

Here is the release annoucement of pygments. I hope you'll find it useful :-)

And there is already some software that uses pygments:

Transfering Jabber Rosters

written by Armin Ronacher, on Sunday, October 22, 2006 14:23.

After two hours of playing with ejabberd i found out that the new server was unable to read the ejabberd database from the old one. great -.- Because neither me nor Georg were able to fix that issue i wrote a script that dumps the account data from one jabber account so that you can import it into another one.

Here the code for dumping and restoring a roster. It requires that you have xmpppy installed

import sys
from xmpp import JID, Client
from pickle import dump, load

try:
    MODE, FILE, USERNAME, PASSWORD = sys.argv[1:5]
except ValueError:
    print 'usage: %s <mode> <file> <username> <password> % sys.argv[0]
    sys.exit(1)

jid = JID(USERNAME)
cl = Client(jid.getDomain(), debug=[])
if not cl.connect() or not cl.auth(jid.getNode(), PASSWORD):
    print 'couldn not connect to server'
else:
    cl.sendInitPresence()
    roster = cl.getRoster()
    if MODE == 'dump':
        data = {}
        for jid in roster.getItems():
            data[jid] = roster.getRawItem(jid)
        f = file(FILE, 'w')
        dump(data, f)
        f.close()
    elif MODE == 'load':
        for jid, data in load(file(FILE)).iteritems():
            roster.setItem(jid, data['name'], data['groups'] or [])
            roster.Authorize(jid)
            roster.Subscribe(jid)
    else:
        print 'error: mode must be load or dump'
        sys.exit(1)

Use it like this:

python rosterdump.py dump roster.dump yourname@example.com yourpassword

And restore it using this command:

python rosterdump.py load roster.dump yourname@otherserver.com yournewpassword

Note that i won't further work on that script and it's possible that are some errors in the script. I don't guarantee that it actually works :D Nevertheless I hope it might be useful for you.

Give It A Name!

written by Armin Ronacher, on Tuesday, October 17, 2006 0:00.

Never needed a name for a project of you? Never ever had to think about one? Believe me we had. And as a result of it here it is: the absolutely random name generator for web2.0 and compatible projects :-)

Check it out: giveitaname.lucumr.pocoo.org

Oh: and it's possible that you get results like 'fuck', just ignore that ^^

Blind Guardian Videos

written by Armin Ronacher, on Monday, October 2, 2006 0:00.

I must admit: I'm a Blind Guardian fan. When i googled for some videos i found pretty great live recordings on video.google.com. Read on my dear.

List of blind guardian videos available online at video.google.com:

Have fun :D