[Zope] meta type conversion method, Document to Method... help!

Alex Schonfeld alex@garage.co.jp
Thu, 24 Feb 2000 12:15:12 +0900


Basically the idea is to have it go through and convert all dtml docs to
dtml methods.  BUT the problem is "index_html" of Document type also
have a attribute ".index_html" which is causing problems with the
conversion.  Thus my special case code.

Any ideas or tips would be appreciated.

This code is being used to convert all the old style docs to methods
for use with Zope2.

Thanks!
--------------convermetatypes, DTML Method----------------
<html>
<body>
<dtml-let from_type="'DTML Document'" to_type="'DTML Method'" tmpindex="_.getitem('index_html',0)" tmpraw="tmpindex.raw">
<dtml-comment> and update the called methods............... </dtml-comment>
  <dtml-in "objectValues(from_type)">
    <dtml-let method="_.getitem('sequence-item', 0)"
      method_id="method.id()"
      method_title="method.title"
      method_data="method.raw">
      <dtml-if "method_id != 'convertmetatypes'">
        Deleting <dtml-var from_type>-<dtml-var method_id>.<br>
        <dtml-call "manage_delObjects([method_id])">
        <dtml-call "manage_addDTMLMethod(id=method_id, title=method_title)">
        Creating new <dtml-var to_type>-<dtml-var method_id>.<br>
        <dtml-let newdoc="_.getitem(method_id,0)">
          <dtml-if "newdoc">
            Adding data to new <dtml-var to_type>-<dtml-var method_id>.<br>
            <dtml-call "newdoc.manage_edit(data=method_data, title=method_title)">
          <dtml-else>
            Adding data to new <dtml-var to_type>-<dtml-var "tmpindex.id()">.<br>
            <dtml-call "tmpindex.manage_edit(data=tmpraw, title=tmpindex.title)">
          </dtml-if>
        </dtml-let>
        <br>
      </dtml-if>
    </dtml-let>
  </dtml-in>
</dtml-let>
</body>
</html>
----------------------
 
1010011010
0  Digital Garage
1  Alex Schonfeld
0  alex@garage.co.jp - pear
1  090-4429-2323
+-Personal Junk
|  alex@coolest.com
|  http://www.coolest.com