equal
deleted
inserted
replaced
34 updated = set(args[0].iterkeys()) |
34 updated = set(args[0].iterkeys()) |
35 if not (updated - frozenset(('eid', 'modification_date', 'last_login_time'))): |
35 if not (updated - frozenset(('eid', 'modification_date', 'last_login_time'))): |
36 # don't record last_login_time update which are done |
36 # don't record last_login_time update which are done |
37 # automatically at login time |
37 # automatically at login time |
38 return False |
38 return False |
39 self.session.add_query_data('pendingchanges', (self._event(), args)) |
39 self.session.transaction_data.setdefault('pendingchanges', []).append( |
|
40 (self._event(), args)) |
40 return True |
41 return True |
41 |
42 |
42 def _event(self): |
43 def _event(self): |
43 return self.event.split('_', 1)[1] |
44 return self.event.split('_', 1)[1] |
44 |
45 |
52 title = entity.dc_title() |
53 title = entity.dc_title() |
53 except: |
54 except: |
54 # may raise an error during deletion process, for instance due to |
55 # may raise an error during deletion process, for instance due to |
55 # missing required relation |
56 # missing required relation |
56 title = '#%s' % eid |
57 title = '#%s' % eid |
57 self.session.add_query_data('pendingchanges', |
58 self.session.transaction_data.setdefault('pendingchanges', []).append( |
58 ('delete_entity', |
59 ('delete_entity', (eid, str(entity.e_schema), title))) |
59 (eid, str(entity.e_schema), |
|
60 title))) |
|
61 return True |
60 return True |
62 |
61 |
63 |
62 |
64 def filter_changes(changes): |
63 def filter_changes(changes): |
65 """ |
64 """ |
225 session = self.session |
224 session = self.session |
226 config = session.vreg.config |
225 config = session.vreg.config |
227 uinfo = {'email': config['sender-addr'], |
226 uinfo = {'email': config['sender-addr'], |
228 'name': config['sender-name']} |
227 'name': config['sender-name']} |
229 view = self._get_view() |
228 view = self._get_view() |
230 content = view.render(changes=session.query_data('pendingchanges')) |
229 content = view.render(changes=session.transaction_data.get('pendingchanges')) |
231 recipients = view.recipients() |
230 recipients = view.recipients() |
232 msg = format_mail(uinfo, recipients, content, view.subject(), config=config) |
231 msg = format_mail(uinfo, recipients, content, view.subject(), config=config) |
233 self.to_send = [(msg, recipients)] |
232 self.to_send = [(msg, recipients)] |
234 |
233 |
235 def commit_event(self): |
234 def commit_event(self): |