'a float is required' error when sending branch mail

Bug #390956 reported by Jonathan Lange
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Triaged
High
Unassigned

Bug Description

This error is raised as an OOPS (e.g. OOPS-1268BM6) by the branch mailer.

Traceback (most recent call last):
  Module lp.services.job.runner, line 57, in runAll
    self.runJob(job)
  Module lp.services.job.runner, line 38, in runJob
    job.run()
  Module lp.code.model.branchjob, line 332, in run
    mailer.sendAll()
  Module lp.services.mail.basemailer, line 111, in sendAll
    ctrl = self.generateEmail(email, recipient)
  Module lp.services.mail.basemailer, line 57, in generateEmail
    subject = self._getSubject(email)
  Module lp.services.mail.basemailer, line 66, in _getSubject
    return self._subject_template % self._getTemplateParams(email)
TypeError: a float is required

The error is probably caused by '_subject_template' containing '%f'. The fix is to sanitize the subject template before using it as the LHS operand of the modulo operator.

Revision history for this message
Aaron Bentley (abentley) wrote : Re: [Bug 390956] [NEW] 'a float is required' error when sending branch mail

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jonathan Lange wrote:
> Public bug reported:
>
> This error is raised as an OOPS (e.g. OOPS-1268BM6) by the branch
> mailer.
>
> Traceback (most recent call last):
> Module lp.services.job.runner, line 57, in runAll
> self.runJob(job)
> Module lp.services.job.runner, line 38, in runJob
> job.run()
> Module lp.code.model.branchjob, line 332, in run
> mailer.sendAll()
> Module lp.services.mail.basemailer, line 111, in sendAll
> ctrl = self.generateEmail(email, recipient)
> Module lp.services.mail.basemailer, line 57, in generateEmail
> subject = self._getSubject(email)
> Module lp.services.mail.basemailer, line 66, in _getSubject
> return self._subject_template % self._getTemplateParams(email)
> TypeError: a float is required
>
> The error is probably caused by '_subject_template' containing '%f'. The
> fix is to sanitize the subject template before using it as the LHS
> operand of the modulo operator.

The subject template is meant to contain %f-style formatting. If you
sanitize it, you destroy it.

The real problem is that it's being set to the wrong value.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkpA5F0ACgkQ0F+nu1YWqI2CwwCZATgXcZQqGAEjX45fkZ8qm/Qf
1s0An2TWd6Dl7wiOmFXYAklpSmKLWBlY
=YG+J
-----END PGP SIGNATURE-----

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.