Project

General

Profile

Bug #1222

crash lors d'email dans un cron

Added by Thomas Noël almost 12 years ago. Updated almost 12 years ago.

Status:
Fermé
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
16 January 2012
Due date:
% Done:

90%

Estimated time:
Patch proposed:
Planning:

Description

Lorsqu'on est en mode cron, get_response() ne fonctionne pas (logique) et on ne peut donc pas ajouter des "after jobs" pour l'envoi des mails (cf trace ci dessous).

perform_items <wcs.workflows.SendmailWorkflowStatusItem instance at 0x18c9368>
[2012-01-16 16:54:08] exception caught
Exception:
  type = '<type 'exceptions.AttributeError'>', value = ''NoneType' object has no attribute 'response''

Stack trace (most recent call first):
  File "/usr/lib/pymodules/python2.7/quixote/publish.py", line 317, in get_response
   315 
   316 def get_response():
>  317     return _publisher.get_request().response
   318 
   319 def get_field(name, default=None):

  File "/home/thomas/dev/au-quoditien/wcs/wcs/qommon/emails.py", line 332, in email
   330         s.close()
   331     else:
>  332         get_response().add_after_job('sending email',
   333                 EmailToSend(msg_from, rcpts, msg.as_string()),
   334                 fire_and_forget = True)

  locals: 
     attachments = ()
     encoding = 'utf-8'
     multipart = None
     hide_recipients = False

Files

wcs-cron-email.diff (666 Bytes) wcs-cron-email.diff Thomas Noël, 17 January 2012 10:03 AM

Related issues

Related to Au quotidien - Bug #1216: L'élément de worflow "changer de statut après expiration" ne fonctionne pasFermé13 January 2012

Actions

Associated revisions

Revision 1c557a24 (diff)
Added by Thomas Noël almost 12 years ago

emails: don't delay the handling when there is no request (cronjob)

fix #1222

History

#1

Updated by Thomas Noël almost 12 years ago

  • Status changed from Nouveau to En cours

Un contournement proposé : quand il n'y a pas de request (et donc pas de réponse associée), on passe dans le mode "not fire_and_forget" pour les mails. A faire au debut de qommon.emails.email() ... ?

#2

Updated by Thomas Noël almost 12 years ago

Et voici un patch.

#3

Updated by Thomas Noël almost 12 years ago

  • % Done changed from 0 to 90

Appliqué par commit r2236.

#4

Updated by Thomas Noël almost 12 years ago

  • Status changed from Solution déployée to Fermé

Also available in: Atom PDF