OOoTemplate.py 22 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
##############################################################################
#
# Copyright (c) 2005 Nexedi SARL and Contributors. All Rights Reserved.
#                    Jean-Paul Smets-Solanes <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
##############################################################################

29
from types import StringType
30 31 32 33 34 35 36 37 38
from Products.CMFCore.FSPageTemplate import FSPageTemplate
from Products.CMFCore.DirectoryView import registerFileExtension, registerMetaType
from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from Products.ERP5Type import PropertySheet
from urllib import quote
from Globals import InitializeClass, DTMLFile, get_request
from AccessControl import ClassSecurityInfo
from OOoUtils import OOoBuilder
39 40
from zipfile import ZipFile, ZIP_DEFLATED
try:
41
  from cStringIO import StringIO
42
except ImportError:
43
  from StringIO import StringIO
44 45
import re
import itertools
46 47

try:
48 49 50
  from webdav.Lockable import ResourceLockedError
  from webdav.WriteLockInterface import WriteLockInterface
  SUPPORTS_WEBDAV_LOCKS = 1
51
except ImportError:
52
  SUPPORTS_WEBDAV_LOCKS = 0
53

54 55
from Products.ERP5.Document.Document import ConversionError

56 57 58 59
# Constructors
manage_addOOoTemplate = DTMLFile("dtml/OOoTemplate_add", globals())

def addOOoTemplate(self, id, title="", REQUEST=None):
60 61 62 63 64 65 66 67
  """Add OOo template to folder.

  id     -- the id of the new OOo template to add
  title  -- the title of the OOo to add
  Result -- empty string
  """
  # add actual object
  id = self._setObject(id, OOoTemplate(id, title))
68 69 70 71 72 73
  if REQUEST is not None:
    file = REQUEST.form.get('file')
    if file.filename:
      # Get the template in the associated context and upload the file
      getattr(self,id).pt_upload(REQUEST, file)
      # respond to the add_and_edit button if necessary
74 75
  add_and_edit(self, id, REQUEST)
  return ''
76 77

def add_and_edit(self, id, REQUEST):
78 79 80 81 82 83 84 85 86 87 88 89 90
  """Helper method to point to the object's management screen if
  'Add and Edit' button is pressed.
  id -- id of the object we just added
  """
  if REQUEST is None:
    return
  try:
    u = self.DestinationURL()
  except AttributeError:
    u = REQUEST['URL1']
  if REQUEST['submit'] == " Add and Edit ":
    u = "%s/%s" % (u, quote(id))
  REQUEST.RESPONSE.redirect(u+'/manage_main')
91 92

class OOoTemplate(ZopePageTemplate):
93 94 95 96 97 98 99 100 101 102 103 104
  """
  A page template which is able to embed and OpenOffice
  file (zip archive) and replace content.xml at render time
  with XML dynamically generated through TAL/TALES/METAL expressions

  TODO:
    - find a way to embed TALES in OOo documents in such
      way that editing with OOo does not destroy TAL/TALES

    - add preprocessing option to handle explicit macros in
      OOo in any language. Include debugging options in this case
      (on preprocessed source rather than pure source)
105 106

    - add interface for Cache (http/RAM)
107 108 109 110 111 112 113 114 115 116 117
  """
  meta_type = "ERP5 OOo Template"
  icon = "www/OOo.png"

  # NOTE: 100 is just pure random starting number
  # it won't influence the code at all
  document_counter = itertools.count(100)
  # Every linked OLE document is in a directory starting with 'Obj'
  _OLE_directory_prefix  = 'Obj'
  # every OOo document have a content-type starting like this
  _OOo_content_type_root = 'application/vnd.sun.xml.'
118
  _ODF_content_type_root = 'application/vnd.oasis.opendocument.'
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192

  # Declarative Security
  security = ClassSecurityInfo()

  # Declarative properties
  property_sheets = ( PropertySheet.Base
                    , PropertySheet.SimpleItem)

  # Constructors
  constructors =   (manage_addOOoTemplate, addOOoTemplate)

  # Default Attributes
  ooo_stylesheet = 'Base_getODTStyleSheet'

  # Default content type
  #content_type = 'application/vnd.sun.xml.writer' # Writer type by default
  content_type = 'text/html' # This is the only for now to produce valid XML

  # Management interface
  manage_options =  ( ZopePageTemplate.manage_options +
      (
        {'label':'Stylesheet Setting', 'action':'formSettings',
        'help':('ERPForm', 'pdfStylesheet.txt')},
      )
    )

  security.declareProtected('View management screens', 'formSettings')
  formSettings = PageTemplateFile('www/formSettings', globals(),
                                  __name__='formSettings')
  formSettings._owner = None

  def __init__(self,*args,**kw):
    ZopePageTemplate.__init__(self,*args,**kw)
    # we store the attachments of the uploaded document
    self.OLE_documents_zipstring = None

  def pt_upload(self, REQUEST, file=''):
    """Replace the document with the text in file."""
    if SUPPORTS_WEBDAV_LOCKS and self.wl_isLocked():
      raise ResourceLockedError, "File is locked via WebDAV"

    if type(file) is not StringType:
      if not file: raise ValueError, 'File not specified'
      file = file.read()

    if file.startswith("PK") : # FIXME: this condition is probably not enough
      # this is a OOo zip file, extract the content
      builder = OOoBuilder(file)
      attached_files_list = [n for n in builder.getNameList()
        if n.startswith(self._OLE_directory_prefix)
        or n.startswith('Pictures')
        or n == 'META-INF/manifest.xml' ]
      # destroy a possibly pre-existing OLE document set
      if self.OLE_documents_zipstring:
        self.OLE_documents_zipstring = None
      # create a zip archive and store it
      if attached_files_list:
        memory_file = StringIO()
        try:
          zf = ZipFile(memory_file, mode='w', compression=ZIP_DEFLATED)
        except RuntimeError:
          zf = ZipFile(memory_file, mode='w')
        for attached_file in attached_files_list:
            zf.writestr(attached_file, builder.extract(attached_file) )
        zf.close()
        memory_file.seek(0)
        self.OLE_documents_zipstring = memory_file.read()
      self.content_type = builder.getMimeType()
      file = builder.prepareContentXml()

    return ZopePageTemplate.pt_upload(self, REQUEST, file)

  security.declareProtected('Change Page Templates', 'doSettings')
  def doSettings(self, REQUEST, title, ooo_stylesheet):
193
    """
194
      Change title and ooo_stylesheet.
195
    """
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
    if SUPPORTS_WEBDAV_LOCKS and self.wl_isLocked():
      raise ResourceLockedError, "File is locked via WebDAV"
    self.ooo_stylesheet = ooo_stylesheet
    self.pt_setTitle(title)
    #REQUEST.set('text', self.read()) # May not equal 'text'!
    message = "Saved changes."
    if getattr(self, '_v_warnings', None):
      message = ("<strong>Warning:</strong> <i>%s</i>"
                % '<br>'.join(self._v_warnings))
    return self.formSettings(manage_tabs_message=message)

  def _resolvePath(self, path):
    return self.getPortalObject().unrestrictedTraverse(path)

  def renderIncludes(self, here, text, sub_document=None):
    attached_files_dict = {}
    arguments_re = re.compile('(\w+)\s*=\s*"(.*?)"\s*',re.DOTALL)

    def getLengthInfos( opts_dict, opts_names ):
      ret = []
      for opt_name in opts_names:
        try:
          val = opts_dict[opt_name]
          if val.endswith('cm'):
            val = val[:-2]
          val = float( val )
        except (ValueError, KeyError):
          val = None
        ret.append(val)
      return ret

    def replaceIncludes(match):
228 229 230 231 232 233 234
      tag_string = match.group(1)

      # Build a dictionary with tag parameters
      options_dict = dict(arguments_re.findall(match.group(1)))

      # Find the page template based on the path and remove path from dict
      document = self._resolvePath(options_dict['path'].encode())
235
      document_text = ZopePageTemplate.pt_render(document) # extra_context is missing
236
      del options_dict['path']
237

238 239
      # Find the type of the embedded document
      document_type = document.content_type
240

241
      # Prepare a subdirectory to store embedded objects
242 243 244 245 246
      actual_idx = self.document_counter.next()
      dir_name = '%s%d'%(self._OLE_directory_prefix,actual_idx)

      if sub_document: # sub-document means sub-directory
        dir_name = sub_document + '/' + dir_name
247

248 249 250 251 252
      # Get the stylesheet of the embedded openoffice document
      ooo_stylesheet = document.ooo_stylesheet
      if ooo_stylesheet:
        ooo_stylesheet = getattr(here, ooo_stylesheet)
        # If ooo_stylesheet is dynamic, call it
253
        try:
254
          ooo_stylesheet = ooo_stylesheet()
255 256
        except AttributeError:
          pass
257 258
        temp_builder = OOoBuilder(ooo_stylesheet)
        stylesheet = temp_builder.extract('styles.xml')
259
      else:
260
        stylesheet = None
261

262
      # Start recursion if necessary
263 264 265
      sub_attached_files_dict = {}
      if 'office:include' in document_text: # small optimisation to avoid recursion if possible
        (document_text, sub_attached_files_dict ) = self.renderIncludes(document_text, dir_name)
266

267 268 269 270 271 272 273 274
      # Build settings document if necessary
      settings_text = None
      if 0:
        w = 10
        h = 10
        # View*    = writer
        # Visible* = calc
        settings_text = """<?xml version="1.0" encoding="UTF-8"?>
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
<!DOCTYPE office:document-settings PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "office.dtd">
<office:document-settings xmlns:office="http://openoffice.org/2000/office"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:config="http://openoffice.org/2001/config" office:version="1.0">
<office:settings>
<config:config-item-set config:name="view-settings">
<config:config-item config:name="ViewAreaTop" config:type="int">0</config:config-item>
<config:config-item config:name="ViewAreaLeft" config:type="int">0</config:config-item>
<config:config-item config:name="ViewAreaWidth" config:type="int">%(w)d</config:config-item>
<config:config-item config:name="ViewAreaHeight" config:type="int">%(h)d</config:config-item>
<config:config-item config:name="VisibleAreaTop" config:type="int">0</config:config-item>
<config:config-item config:name="VisibleAreaLeft" config:type="int">0</config:config-item>
<config:config-item config:name="VisibleAreaWidth" config:type="int">%(w)d</config:config-item>
<config:config-item config:name="VisibleAreaHeight" config:type="int">%(h)d</config:config-item>
</config:config-item-set>
</office:settings>
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308
</office:document-settings>""" % dict( w=int(w*1000) , h=int(h*1000) ) # convert from 10^-2 (centimeters) to 10^-5

      # Attach content, style and settings if any
      attached_files_dict[dir_name] = dict(document=document_text,
                                           doc_type=document_type,
                                           stylesheet=stylesheet)
      if settings_text:
        attached_files_dict[dir_name + '/settings.xml'] = dict(document=settings_text,
                                                               doc_type='text/xml')
      attached_files_dict.update(sub_attached_files_dict)

      # Build the new tag
      parameter_list = []
      for k, v in options_dict.items():
        parameter_list.append('%s="%s"' % (k, v))
      new_tag = '<draw:object draw:name="ERP5IncludedObject%d" xlink:href="./%s" %s/>' %\
                 (actual_idx, dir_name.split('/')[-1], ' '.join(parameter_list))
      return new_tag
309 310

    def replaceIncludesImg(match):
311 312 313
      options_dict = dict(x='0cm', y='0cm', style="fr1")
      options_dict.update(dict(arguments_re.findall(match.group(1))))
      picture = self._resolvePath(options_dict['path'].encode())
314 315 316 317 318

      # "standard" filetype == Image or File , for ERP objects the
      # manipulations are different
      is_standard_filetype = True

Yoshinori Okuji's avatar
Yoshinori Okuji committed
319
      if getattr(picture, 'data', None) is None \
320
                    or callable(picture.content_type):
321 322 323
        is_standard_filetype = False

      if is_standard_filetype:
324
        picture_data = str(picture.getData())
325 326 327 328 329 330 331 332 333 334 335 336 337
      else:
        picture_data = picture.Base_download()

      # fetch the content-type of the picture (generally guessed by zope)
      if 'type' not in options_dict:
        if is_standard_filetype:
          options_dict['type'] = picture.content_type
        else:
          options_dict['type'] = picture.content_type()

      if '/' not in options_dict['type']:
        options_dict['type'] = 'image/' + options_dict['type']

338
      w, h, maxwidth, maxheight = getLengthInfos(options_dict, ('width', 'height', 'maxwidth', 'maxheight'))
339

340
      try: # try image properties
341
        aspect_ratio = float(picture.width) / float(picture.height)
342
      except (TypeError, ZeroDivisionError):
343 344 345 346
        try: # try ERP5.Document.Image API
          aspect_ratio = float(picture.getWidth()) / float(picture.getHeight())
        except AttributeError: # fallback to Photo API
          aspect_ratio = float(picture.width()) / float(picture.height())
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362
      # fix a default value and correct the aspect
      if h is None:
        if w is None:
          w = 10.0
        h = w / aspect_ratio
      elif w is None:
        w = h * aspect_ratio
      # picture is too large
      if maxwidth and maxwidth < w:
        w = maxwidth
        h = w / aspect_ratio
      if maxheight and maxheight < h:
        h = maxheight
        w = h * aspect_ratio

      actual_idx = self.document_counter.next()
363
      pic_name = 'Pictures/picture%d.%s' % (actual_idx, options_dict['type'].split('/')[-1])
364 365

      if sub_document: # sub-document means sub-directory
366
        pic_name = sub_document + '/' + pic_name
367 368

      attached_files_dict[pic_name] = dict(
369 370
        document=picture_data,
        doc_type=options_dict['type']
371 372 373
      )
      # XXX: Pictures directory not managed (seems facultative)
      #  <manifest:file-entry manifest:media-type="" manifest:full-path="ObjBFE4F50D/Pictures/"/>
374
      is_legacy = ('oasis.opendocument' not in self.content_type)
375
      replacement = """<draw:image draw:style-name="%s" draw:name="ERP5Image%d"
376 377 378
text:anchor-type="paragraph" svg:x="%s" svg:y="%s"
svg:width="%.3fcm" svg:height="%.3fcm" xlink:href="%sPictures/%s"
xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/>
379 380 381
      """ % (options_dict['style'], actual_idx,
             options_dict['x'], options_dict['y'],
             w, h,
Yoshinori Okuji's avatar
Yoshinori Okuji committed
382
             is_legacy and '#' or '',
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400
             pic_name.split('/')[-1] )
      if not (self.content_type.endswith('draw') or
              self.content_type.endswith('presentation') or
              self.content_type.endswith('writer') or
              self.content_type.endswith('text')):
        replacement = '<text:p text:style-name="Standard">'+replacement+'</text:p>'
      return replacement

    # NOTE: (?s) at the end is for including '\n' when matching '.'
    # It's an equivalent to DOTALL option passing (but sub can't get options parameter)
    text = re.sub('<\s*office:include_img\s+(.*?)\s*/\s*>(?s)', replaceIncludesImg, text)
    text = re.sub('<\s*office:include\s+(.*?)\s*/\s*>(?s)', replaceIncludes, text)
    return (text, attached_files_dict)

  # Proxy method to PageTemplate
  def pt_render(self, source=0, extra_context={}):
    # Get request
    request = extra_context.get('REQUEST', None)
401 402
    if request is None:
      request = self.REQUEST
403 404 405 406 407 408 409 410
    # Get parent object (the one to render this template on)
    here = getattr(self, 'aq_parent', None)
    if here is None:
      # This is a system error
      raise ValueError, 'Can not render a template without a parent acquisition context'
    # Retrieve master document
    ooo_document = getattr(here, self.ooo_stylesheet)
    # If style is dynamic, call it
411 412 413 414
    try:
      ooo_document = ooo_document()
    except AttributeError:
      pass
415 416 417 418
    # Create a new builder instance
    ooo_builder = OOoBuilder(ooo_document)
    # Pass builder instance as extra_context
    extra_context['ooo_builder'] = ooo_builder
419
    
420 421
    # And render page template
    doc_xml = ZopePageTemplate.pt_render(self, source=source, extra_context=extra_context)
422 423
    if isinstance(doc_xml, unicode):
      doc_xml = doc_xml.encode('utf-8')
424 425 426

    # Replace the includes
    (doc_xml,attachments_dict) = self.renderIncludes(here, doc_xml)
427

428 429 430 431
    try:
      default_styles_text = ooo_builder.extract('styles.xml')
    except AttributeError:
      default_styles_text = None
432

433 434 435
    # Add the associated files
    for dir_name, document_dict in attachments_dict.iteritems():
      # Special case : the document is an OOo one
436 437 438 439 440 441
      if document_dict['doc_type'].startswith(self._OOo_content_type_root) or \
         document_dict['doc_type'].startswith(self._ODF_content_type_root):
        ooo_builder.addFileEntry(full_path=dir_name,
                                 media_type=document_dict['doc_type'])
        ooo_builder.addFileEntry(full_path=dir_name + '/content.xml',
                                 media_type='text/xml', content=document_dict['document'])
442 443 444 445
        styles_text = default_styles_text
        if document_dict.has_key('stylesheet') and document_dict['stylesheet']:
          styles_text = document_dict['stylesheet']
        if styles_text:
446 447
          ooo_builder.addFileEntry(full_path=dir_name + '/styles.xml',
                                   media_type='text/xml', content=styles_text)
448 449
      else: # Generic case
        ooo_builder.addFileEntry(full_path=dir_name,
450 451
                                 media_type=document_dict['doc_type'],
                                 content=document_dict['document'])
452 453 454 455 456 457 458 459 460 461 462 463 464 465

    # Debug mode
    if request.get('debug',0):
      return doc_xml

    # Replace content.xml in master openoffice template
    ooo_builder.replace('content.xml', doc_xml)

    # Old templates correction
    try:
      self.OLE_documents_zipstring
    except AttributeError:
      self.OLE_documents_zipstring = None

466
    # Convert if necessary
467
    opts = extra_context.get("options", dict())
468

469
    # Get batch_mode
470 471
    batch_mode = opts.get('batch_mode', None)

472 473 474 475 476 477 478 479 480 481
    # If the file has embedded OLE documents, restore it
    if self.OLE_documents_zipstring:
      additional_builder = OOoBuilder( self.OLE_documents_zipstring )
      for name in additional_builder.getNameList():
        ooo_builder.replace(name, additional_builder.extract(name) )

    # Update the META informations
    ooo_builder.updateManifest()

    # Produce final result
482 483
    ooo = ooo_builder.render(name=self.title or self.id)
    
484 485 486
    format = opts.get('format', request.get('format', None))
    if format:
      return self._asFormat(ooo, format, request, batch_mode)
487

488
    if not format and not batch_mode:
Kazuhiko Shiozaki's avatar
Kazuhiko Shiozaki committed
489
      request.RESPONSE.setHeader('Content-Type','%s; charset=utf-8' % self.content_type)
490 491
      request.RESPONSE.setHeader('Content-disposition', 'inline;filename=%s' % self.title_or_id())
    else:
Kazuhiko Shiozaki's avatar
Kazuhiko Shiozaki committed
492
      request.RESPONSE.setHeader('Content-Type','%s; charset=utf-8' % 'text/html')
493 494
      request.RESPONSE.setHeader('Content-disposition', 'inline;filename=%s' % self.title_or_id())
        
495
    return ooo
496
  
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512
  def om_icons(self):
    """Return a list of icon URLs to be displayed by an ObjectManager"""
    icons = ({'path': 'misc_/ERP5OOo/OOo.png',
              'alt': self.meta_type, 'title': self.meta_type},)
    if not self._v_cooked:
        self._cook()
    if self._v_errors:
        icons = icons + ({'path': 'misc_/PageTemplates/exclamation.gif',
                          'alt': 'Error',
                          'title': 'This template has an error'},)
    return icons

  def _asPdf(self, ooo, REQUEST=None):
    """
    Return OOo report as pdf
    """
Jérome Perrin's avatar
Jérome Perrin committed
513
    return self._asFormat(ooo, 'pdf', REQUEST)
514

515 516
  def _asFormat(self, ooo, format, REQUEST=None, batch_mode=0):
    # Now create a temp OOoDocument to convert data to pdf
517 518
    from Products.ERP5Type.Document import newTempOOoDocument
    tmp_ooo = newTempOOoDocument(self, self.title_or_id())
Jérome Perrin's avatar
Jérome Perrin committed
519 520 521 522
    tmp_ooo.edit(base_data=ooo,
                 fname=self.title_or_id(),
                 source_reference=self.title_or_id(),
                 base_content_type=self.content_type,)
523
    tmp_ooo.oo_data = ooo
524 525
    if format == 'pdf' and not batch_mode:
      # Slightly different implementation
526
      # now convert it to pdf
Jérome Perrin's avatar
Jérome Perrin committed
527 528 529
      tgts = [x[1] for x in tmp_ooo.getTargetFormatItemList()
              if x[1].endswith('pdf')]
      if len(tgts) > 1:
530 531 532
        REQUEST.RESPONSE.setHeader('Content-type', 'text/html')
        REQUEST.RESPONSE.setHeader('Content-disposition', 'inline;filename=%s.pdf' % self.title_or_id())
        raise ValueError, 'multiple pdf formats found - this shouldnt happen'
Jérome Perrin's avatar
Jérome Perrin committed
533
      if len(tgts) == 0:
534 535 536
        REQUEST.RESPONSE.setHeader('Content-type', 'text/html')
        REQUEST.RESPONSE.setHeader('Content-disposition', 'inline;filename=%s.pdf' % self.title_or_id())    
        raise ValueError, 'no pdf format found'
Jérome Perrin's avatar
Jérome Perrin committed
537
      fmt = tgts[0]
538
      mime, data = tmp_ooo.convert(fmt)
539
      if REQUEST is not None:
540 541
          REQUEST.RESPONSE.setHeader('Content-type', 'application/pdf')
          REQUEST.RESPONSE.setHeader('Content-disposition', 'attachment;filename=%s.pdf' % self.title_or_id())
542
      return data
543
    mime , data = tmp_ooo.convert(format)
544
    if REQUEST is not None:
Jérome Perrin's avatar
Jérome Perrin committed
545
      REQUEST.RESPONSE.setHeader('Content-type', mime)
546 547
      REQUEST.RESPONSE.setHeader('Content-disposition', 'attachment;filename=%s.%s' % (self.title_or_id(),format))
        # FIXME the above lines should return zip format when html was requested
548
    return data
549 550 551 552 553

InitializeClass(OOoTemplate)

class FSOOoTemplate(FSPageTemplate, OOoTemplate):

554 555
  meta_type = "ERP5 Filesystem OOo Template"
  icon = "www/OOo.png"
556

557 558
  def __call__(self, *args, **kwargs):
    return OOoTemplate.__call__(self, *args, **kwargs)
559 560 561 562

InitializeClass(FSOOoTemplate)

registerFileExtension('ooot', FSOOoTemplate)
563
registerMetaType(OOoTemplate.meta_type, FSOOoTemplate)