jedie/django-phpBB3 — pull request #11 by jgsogo (2012-08-30 11:48:28+00:00)
Title: Developers can configure user matching (defaults to email__iexact)

On migration end-user (developer) can configure how user matching should be performed: it can be defined a variable called ``DJANGO_PHPBB3_USER_MATCH_FILTER`` on setting, which must be a list of tuples:

````
# settings.py
DJANGO_PHPBB3_USER_MATCH_FILTER = [ ('email', 'iexact', '%(email)s'), ]

# phpbb2djangobb.py
filters = getattr(settings, 'DJANGO_PHPBB3_USER_MATCH_FILTER', [ ('email', 'iexact', '%(user_email)s'), ])
model_dict = model_to_dict(phpbb_user)
kwargs = { '{0}__{1}'.format(k, v) : z % model_dict for k,v,z in filters}
try:
django_user = User.objects.get(**kwargs)
self.stdout.write(u"\tUser '%s' exists.\n" % smart_unicode(django_user.username))
except User.DoesNotExist:
....
except User.MultipleObjectsReturned, e:
....
````

Also, developer can define a callback which will be called each time a user is migrate; I will use it to send a mail to the phpBB3 user in order to get a password for his new django account and activate it.

___________

By the way, checked your commits against my migration (non-ascii chars everywhere, even on usernames O_o) and it all works perfectly, ¡I got django usernames with non-ascii characters! XD