[Zope] Zope External Editor

paolo paolomail@noze.it
Thu, 16 May 2002 15:46:09 +0200


Hi, i' ve installed your external editor product on Zope-2.5.1+ CMF-1.1, 
is a very good and useful product.
I found an error in manage_main.dtml when accessing folder containing 
custom objects (instance of products i created for my content management 
application).

Error Type: RuntimeError
Error Value: function attributes not accessible in restricted mode

the error happens in the following part of dtml code.
trying to access explicit's attibutes, operation not permitted in
restricted mode...

  <dtml-let explicit="_.getitem('sequence-item').aq_explicit">
    <dtml-if expr="_.hasattr(explicit, 'manage_FTPget')
                   or _.hasattr(explicit, 'read')
                   or _.getattr(explicit, 'content_type',
                   '').startswith('text/')">
      <a href="&dtml-URL1;/externalEdit_/&dtml.url_quote-sequence-key;"
         title="Edit using external editor"
      ><img src="&dtml-BASEPATH1;/misc_/ExternalEditor/edit_icon"
            align="middle" hspace="2" border="0" alt="External Editor" /></a>
    </dtml-if>
  </dtml-let>

i've solved the problem putting a try in dtml code as below, 
to not allow launch external editor on custom objects and all goes right... 

  <dtml-let explicit="_.getitem('sequence-item').aq_explicit">
    <dtml-try>
    <dtml-if expr="_.hasattr(explicit, 'manage_FTPget')
                   or _.hasattr(explicit, 'read')
                   or _.getattr(explicit, 'content_type',
                   '').startswith('text/')">
      <a href="&dtml-URL1;/externalEdit_/&dtml.url_quote-sequence-key;"
         title="Edit using external editor"
      ><img src="&dtml-BASEPATH1;/misc_/ExternalEditor/edit_icon"
            align="middle" hspace="2" border="0" alt="External Editor" /></a>
    </dtml-if>
    <dtml-except>
    </dtml-try>
  </dtml-let>

  bye, paolo...

-- 
---------------------------------------------------------------------------------------------------------
    Paolo Galati - Developement Area
    [ n o z e  S.r.l. ] - Soluzioni open-source
    Via Giuntini, 25 int.29 - 56023 Navacchio - Cascina (PI)
    Tel +39  (0)50 754380 - Fax +39 (0)50 754381
    Email: paolomail@noze.it - Web: http://www.noze.it
---------------------------------------------------------------------------------------------------------