Merge lp:~wligtenberg/django-openid-auth/mysql_fix into lp:~django-openid-auth/django-openid-auth/trunk

Proposed by Willem Ligtenberg on 2010-04-02
Status: Needs review
Proposed branch: lp:~wligtenberg/django-openid-auth/mysql_fix
Merge into: lp:~django-openid-auth/django-openid-auth/trunk
Diff against target: 10 lines (+1/-1)
1 file modified
django_openid_auth/models.py (+1/-1)
To merge this branch: bzr merge lp:~wligtenberg/django-openid-auth/mysql_fix
Reviewer Review Type Date Requested Status
django-openid-auth developers 2010-04-02 Pending
Review via email: mp+22726@code.launchpad.net

Description of the change

As mentioned here:
http://blogs.gnome.org/jamesh/2009/04/14/django-openid-auth/
There was an issue with MySQL

Creating table django_openid_auth_useropenid

_mysql_exceptions.OperationalError: (1170, “BLOB/TEXT column ‘claimed_id’ used in key specification without a key length”)

This fix changes the claimed_id to a charfield of 255 length. Which is the maximum for which MySQL has unique support.
This also takes care of bug https://bugs.launchpad.net/django-openid-auth/+bug/524796

To post a comment you must log in.
Dave Walker (davewalker) wrote :

When i've deployed this on mysql backed django applications, I have encountered the same thing and used the fix as proposed in the merge. However, I haven't tested this fix on postgres or sqlite.

The only thing I would say, the "claimed_id" stores the value returned from the provider. The standard launchpad value is something like:
https://login.launchpad.net/+id/XXXXXXX

This is 39 chars. Is it conceivable that a different provider might use a URL longer than 255 chars?

RFC2616 Does hint a recommendation of limiting to 255 bytes - but URL's of >2000 are also popular and supported.

James Henstridge (jamesh) wrote :

The only thing the OpenID specification says about the Claimed Identifier is that it is either (a) a normalised URL or (b) an XRI.

So there is nothing in the specification that would limit it to 255 characters. That said, I don't know whether you'd find any longer than 255 characters in real life.

For normal OpenID authentication requests it would be a bit unwieldy to type an identity URL that long, but for identifier select mode a provider might be able to get away with it without driving away users. That said, I don't know if any do.

feanil (feanil) wrote :

Is this going to get fixed any time soon? It's been sitting here for a while. Some resolution either way would be helpful.

Unmerged revisions

66. By dev <dev@bmt-nb104> on 2010-04-02

MySQL fix

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'django_openid_auth/models.py'
2--- django_openid_auth/models.py 2009-04-07 10:26:04 +0000
3+++ django_openid_auth/models.py 2010-04-02 20:21:32 +0000
4@@ -54,5 +54,5 @@
5
6 class UserOpenID(models.Model):
7 user = models.ForeignKey(User)
8- claimed_id = models.TextField(max_length=2047, unique=True)
9+ claimed_id = models.CharField(max_length=255, unique=True)
10 display_id = models.TextField(max_length=2047)

Subscribers

People subscribed via source and target branches