Log in |
DTMLMethod to DTMLDocumentIf you make an external method that calls this called "method_to_document". You can then call this method passing through a url to the object, eg: method_to_document?object=/object/to/convert. Quick hack, not much checking, but works ok. Thought it might be useful.
import time
def method_to_document(self, object):
object = self.restrictedTraverse(object)
parent = object.aq_parent
if object.meta_type != 'DTML Method':
return '%s is not a DTML Method' % object.getId()
_id = object.getId()
_title = object.title
_file = object.document_src()
parent.manage_delObjects([_id,])
parent.manage_addDTMLDocument(
id = _id,
title = _title,
file = _file
)
return 'Done %s is now a DTML Document' % _id
|