21 |
21 |
22 from six import PY2 |
22 from six import PY2 |
23 |
23 |
24 from logilab.mtconverter import xml_escape |
24 from logilab.mtconverter import xml_escape |
25 from logilab.common.registry import yes |
25 from logilab.common.registry import yes |
26 from logilab.common.deprecation import deprecated |
|
27 |
26 |
28 from cubicweb.appobject import AppObject |
27 from cubicweb.appobject import AppObject |
29 from cubicweb.mail import format_mail |
28 from cubicweb.mail import format_mail |
30 from cubicweb.web import LOGGER, Redirect, RequestError |
29 from cubicweb.web import LOGGER, Redirect, RequestError |
31 |
30 |
103 # NOTE: we can't use entity.rest_path() at this point because |
102 # NOTE: we can't use entity.rest_path() at this point because |
104 # rest_path() could rely on schema constraints (such as a required |
103 # rest_path() could rely on schema constraints (such as a required |
105 # relation) that might not be satisfied yet (in case of creations) |
104 # relation) that might not be satisfied yet (in case of creations) |
106 if not self._edited_entity: |
105 if not self._edited_entity: |
107 self._edited_entity = entity |
106 self._edited_entity = entity |
108 |
|
109 @deprecated('[3.18] call view.set_http_cache_headers then ' |
|
110 '.is_client_cache_valid() method and return instead') |
|
111 def validate_cache(self, view): |
|
112 view.set_http_cache_headers() |
|
113 self._cw.validate_cache() |
|
114 |
107 |
115 def sendmail(self, recipient, subject, body): |
108 def sendmail(self, recipient, subject, body): |
116 senderemail = self._cw.user.cw_adapt_to('IEmailable').get_email() |
109 senderemail = self._cw.user.cw_adapt_to('IEmailable').get_email() |
117 msg = format_mail({'email' : senderemail, |
110 msg = format_mail({'email' : senderemail, |
118 'name' : self._cw.user.dc_title(),}, |
111 'name' : self._cw.user.dc_title(),}, |