# HG changeset patch # User sylvain.thenault@logilab.fr # Date 1236189884 -3600 # Node ID 948a3882c94a329b635fa91dba689278d9bb8576 # Parent 0de202b907d6cb710ee2bbc6f4099ecfeed552ce add a use_fckeditor method on http request diff -r 0de202b907d6 -r 948a3882c94a entities/__init__.py --- a/entities/__init__.py Wed Mar 04 19:04:19 2009 +0100 +++ b/entities/__init__.py Wed Mar 04 19:04:44 2009 +0100 @@ -415,11 +415,10 @@ """return True if fckeditor should be used to edit entity's attribute named `attr`, according to user preferences """ - req = self.req - if self.config.fckeditor_installed() and req.property_value('ui.fckeditor') and self.has_format(attr): + if self.req.use_fckeditor() and self.has_format(attr): if self.has_eid() or '%s_format' % attr in self: return self.format(attr) == 'text/html' - return req.property_value('ui.default-text-format') == 'text/html' + return self.req.property_value('ui.default-text-format') == 'text/html' return False # XXX: store a reference to the AnyEntity class since it is hijacked in goa diff -r 0de202b907d6 -r 948a3882c94a web/form.py --- a/web/form.py Wed Mar 04 19:04:19 2009 +0100 +++ b/web/form.py Wed Mar 04 19:04:44 2009 +0100 @@ -554,7 +554,7 @@ """return True if fckeditor should be used to edit entity's attribute named `attr`, according to user preferences """ - if form.config.fckeditor_installed() and form.req.property_value('ui.fckeditor'): + if form.req.use_fckeditor(): return form.form_format_field_value(self) == 'text/html' return False diff -r 0de202b907d6 -r 948a3882c94a web/request.py --- a/web/request.py Wed Mar 04 19:04:19 2009 +0100 +++ b/web/request.py Wed Mar 04 19:04:44 2009 +0100 @@ -269,6 +269,8 @@ self.html_headers.define_var('fcklang', self.lang) self.html_headers.define_var('fckconfigpath', self.build_url('data/cubicweb.fckcwconfig.js')) + def use_fckeditor(self): + return self.vreg.config.fckeditor_installed() and self.property_value('ui.fckeditor') def edited_eids(self, withtype=False): """return a list of edited eids"""