2008-02-25 18:31

Weird Django/PyODB bug

I am finishing my first large-ish Django app from scratch [1].

To login a user you can do something like this:

[root@wally app]# python manage.py shell
Python 2.3.4 (#1, May  2 2007, 19:26:00)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from pyodb import *
>>> import django.contrib.auth
>>> print django.contrib.auth.authenticate(username='user',password='pass')
user

And then you use that user object for django.contrib.auth.login

Some of the authentication data is available on a Microsoft SQL Server, and I get it via pyodb. And this happens when I try to authenticate the user (assume user and pass are valid, this is the smallest snippet that triggers the bug):

[root@wally app]# python manage.py shell
Python 2.3.4 (#1, May  2 2007, 19:26:00)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from pyodb import Connect
>>> import django.contrib.auth
>>> c1=Connect("sqlserver",uid="user",pwd="pass")
>>> print django.contrib.auth.authenticate(username='user',password='pass')
None

As you can see, the pyodb stuff should not interfere with the django stuff at all. I am only importing one function and connecting to the DB, I don't even execute any SQL or use any data from the SQL connection. But the calls to authenticate fail.

How are you supposed to debug this? I worked around it by moving the PyODB stuff to another module, but it's weird.

[1] It's a list server. Discussion groups, moderation features, subscriptions, the works. Like google groups, but yours and not ajaxy. It's not Open Source software, but if you want something similar, I am sure my customer will license it to you :-D

Comments

Comments powered by Disqus

Contents © 2000-2018 Roberto Alsina