Message ID | 1288718864.959701.564729447181.1.gpush@pororo |
---|---|
State | Accepted |
Headers | show |
Hi, I applied the patch, actually ran git pull (saw that the new models.py hadd your additions), then manage.py syncdb (verified that the new entries went into patchwork_patch, e.g. pull_url), then restarted httpd, but still getting the headerparser import error when clicking the mbox link for a patch : Environment: Request Method: GET Request URL: http://patchwork.meilerlab.org/patch/313/mbox/ Django Version: 1.2 SVN-14395 Python Version: 2.4.3 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', 'patchwork', 'registration'] Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.middleware.doc.XViewMiddleware', 'django.middleware.csrf.CsrfViewMiddleware') Traceback: File "/blue/meilerlab/home/patchwork/lib/python/django/core/handlers/base.py" in get_response 100. response = callback(request, *callback_args, **callback_kwargs) File "/blue/meilerlab/home/patchwork/apps/patchwork/views/patch.py" in mbox 123. response.write(patch.mbox().as_string(True)) File "/blue/meilerlab/home/patchwork/apps/patchwork/models.py" in mbox 277. orig_headers = HeaderParser().parsestr(str(self.headers)) Exception Type: NameError at /patch/313/mbox/ Exception Value: global name 'HeaderParser' is not defined Thanks, Sabuj On Tue, Nov 2, 2010 at 12:27 PM, Jeremy Kerr <jk@ozlabs.org> wrote: > We need to add an import for HeaderParser on python 2.4; email.Parser > appears to contain the right stuff. > > Signed-off-by: Jeremy Kerr <jk@ozlabs.org> > > --- > apps/patchwork/models.py | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/apps/patchwork/models.py b/apps/patchwork/models.py > index edb52df..6842622 100644 > --- a/apps/patchwork/models.py > +++ b/apps/patchwork/models.py > @@ -38,6 +38,7 @@ except ImportError: > # Python 2.4 compatibility > from email.MIMENonMultipart import MIMENonMultipart > from email.Encoders import encode_7or8bit > + from email.Parser import HeaderParser > import email.Utils > email.utils = email.Utils > >
btw, did test that the new imports work in python 2.4, just some other error in scope somewhere? > Traceback: > File "/blue/meilerlab/home/patchwork/lib/python/django/core/handlers/base.py" > in get_response > 100. response = callback(request, > *callback_args, **callback_kwargs) > File "/blue/meilerlab/home/patchwork/apps/patchwork/views/patch.py" in mbox > 123. response.write(patch.mbox().as_string(True)) > File "/blue/meilerlab/home/patchwork/apps/patchwork/models.py" in mbox > 277. orig_headers = HeaderParser().parsestr(str(self.headers)) > > Exception Type: NameError at /patch/313/mbox/ > Exception Value: global name 'HeaderParser' is not defined
Hi Sabuj,
> I applied the patch, actually ran git pull
The git repo does not include this change, you'll need to apply the patch
manually.
Or did you do that?
Regards,
Jeremy
>> I applied the patch, actually ran git pull > > The git repo does not include this change, you'll need to apply the patch > manually. Ahh, I took a quick glance at the changes in models.py after git pull, saw "Python 2.4 compatibility" and thought that you had merged it . Seems like the git pull was basically just missing the one line : from email.Parser import HeaderParser After adding that line, the mbox link now works .
Hi Sabuj,
> After adding that line, the mbox link now works .
OK, thanks for testing. I've committed this patch.
Regards,
Jeremy
diff --git a/apps/patchwork/models.py b/apps/patchwork/models.py index edb52df..6842622 100644 --- a/apps/patchwork/models.py +++ b/apps/patchwork/models.py @@ -38,6 +38,7 @@ except ImportError: # Python 2.4 compatibility from email.MIMENonMultipart import MIMENonMultipart from email.Encoders import encode_7or8bit + from email.Parser import HeaderParser import email.Utils email.utils = email.Utils
We need to add an import for HeaderParser on python 2.4; email.Parser appears to contain the right stuff. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> --- apps/patchwork/models.py | 1 + 1 file changed, 1 insertion(+)