# HG changeset patch # User Sylvain Thénault # Date 1248884701 -7200 # Node ID df34d3720ff5675be14af89de5a6b22eed4ccfca # Parent 5f38f5eaff8625b4617f6d8e8a050b2bc3793b91 make notification views working with no rset diff -r 5f38f5eaff86 -r df34d3720ff5 sobjects/notification.py --- a/sobjects/notification.py Wed Jul 29 12:46:09 2009 +0200 +++ b/sobjects/notification.py Wed Jul 29 18:25:01 2009 +0200 @@ -62,7 +62,7 @@ class RenderAndSendNotificationView(PreCommitOperation): """delay rendering of notification view until precommit""" def precommit_event(self): - if self.view.rset[0][0] in self.session.transaction_data.get('pendingeids', ()): + if self.view.rset and self.view.rset[0][0] in self.session.transaction_data.get('pendingeids', ()): return # entity added and deleted in the same transaction self.view.render_and_send(**getattr(self, 'viewargs', {})) @@ -184,15 +184,19 @@ DeprecationWarning, stacklevel=1) lang = self.vreg.property_value('ui.language') recipients = zip(recipients, repeat(lang)) - entity = self.entity(0, 0) - # if the view is using timestamp in message ids, no way to reference - # previous email - if not self.msgid_timestamp: - refs = [self.construct_message_id(eid) - for eid in entity.notification_references(self)] + if self.rset is not None: + entity = self.entity(0, 0) + # if the view is using timestamp in message ids, no way to reference + # previous email + if not self.msgid_timestamp: + refs = [self.construct_message_id(eid) + for eid in entity.notification_references(self)] + else: + refs = () + msgid = self.construct_message_id(entity.eid) else: refs = () - msgid = self.construct_message_id(entity.eid) + msgid = None userdata = self.req.user_data() origlang = self.req.lang for emailaddr, lang in recipients: