add a use_fckeditor method on http request tls-sprint
authorsylvain.thenault@logilab.fr
Wed, 04 Mar 2009 19:04:44 +0100
branchtls-sprint
changeset 1013 948a3882c94a
parent 1012 0de202b907d6
child 1014 4792a1bb72a9
add a use_fckeditor method on http request
entities/__init__.py
web/form.py
web/request.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
--- 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
 
--- 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"""