I've run across something which I needed to tweak in order to get working.
With my level of experience, I'd say the chances are good I haven't tweaked it in the correct place. It seems as if this issue is wholly the purview of other apps Mayan makes use of, and not Mayan code *per se*. I could be wrong about this, of course. But generally speaking, what is the best way to deal with issues like this? The issue just posted to GitHub at https://github.com/mayan-edms/mayan-edms/issues/23#issuecomment-50024998 seems as if it might fit into this category as well. With an issue arising from the interaction between two non-Mayan apps used by Mayan-EDMS, how should I track down where the issue should be resolved, and how do I track down the appropriate place to suggest my patch? The issue: I want to use email addresses instead of usernames. There is mention of a way to do this around line 423 in docs/topics/settings.rst, as well as a fairly straight-forward "how to" in docs/releases/0.8.2.rst of the Mayan-EDMS documents. Problem is doing that causes an exception. The issue is that around line 180 of django/contrib/auth/forms.py the code expects a "username" field but using the suggested settings (to use emails instead of username) seems to produce a form lacking a "username" field. The short version of the exception produced is: KeyError at /login/ u'username' Request Method:GETRequest URL:http://54.88.239.64/login/Django Version:1.6.5Exception Type:KeyErrorException Value: u'username' Exception Location:/home/ubuntu/venv/lib/python2.7/site-packages/django/contrib/auth/forms.py in __init__, line 180Python Executable:/usr/bin/pythonPython Version:2.7.6Python Path: ['/var/mayan-edms', '/var/mayan-edms/mayan', '/home/ubuntu/venv/lib/python2.7/site-packages', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/var/mayan-edms/mayan/apps', '/home/ubuntu/venv/lib/python2.7/site-packages/git/ext/gitdb', '/home/ubuntu/venv/lib/python2.7/site-packages/gitdb/ext/async', '/home/ubuntu/venv/lib/python2.7/site-packages/gitdb/ext/smmap'] Server time:Thu, 24 Jul 2014 15:47:35 +0000 A patch which appears obvious to me but may be naive is: --- /home/ubuntu/venv/lib/python2.7/site-packages/django/contrib/auth/forms.py~ 2014-07-13 17:57:21.299758695 +0000 +++ /home/ubuntu/venv/lib/python2.7/site-packages/django/contrib/auth/forms.py 2014-07-23 14:47:18.866324000 +0000 @@ -177,7 +177,7 @@ # Set the label for the "username" field. UserModel = get_user_model() self.username_field = UserModel._meta.get_field(UserModel.USERNAME_FIELD) - if self.fields['username'].label is None: + if 'username' in self.fields and self.fields['username'].label is None: self.fields['username'].label = capfirst(self.username_field.verbose_name) Would welcome any feedback. -- devin -- --- You received this message because you are subscribed to the Google Groups "Mayan EDMS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
