Browse Source

Mantém extensão original dos arquivos que tiverem

pull/1634/head
Marcio Mazza 7 years ago
parent
commit
614f92fce7
  1. 8
      sapl/legacy/scripts/exporta_zope/exporta_zope.py

8
sapl/legacy/scripts/exporta_zope/exporta_zope.py

@ -9,6 +9,7 @@ import os.path
import sys import sys
from collections import defaultdict from collections import defaultdict
from functools import partial from functools import partial
from os.path import splitext
import yaml import yaml
import ZODB.DB import ZODB.DB
@ -53,9 +54,10 @@ extensoes_desconhecidas = defaultdict(list)
def dump_file(doc, path): def dump_file(doc, path):
name = doc['__name__'] id = doc['__name__']
name, extension = splitext(id)
content_type = doc['content_type'] content_type = doc['content_type']
extension = EXTENSOES.get(content_type, 'ZZZZ') extension = extension or EXTENSOES.get(content_type, 'ZZZZ')
fullname = os.path.join(path, name + extension) fullname = os.path.join(path, name + extension)
print(fullname) print(fullname)
@ -84,7 +86,7 @@ def dump_file(doc, path):
arq.write(pdata.pop('data')) arq.write(pdata.pop('data'))
pdata = br(pdata.pop('next', None)) pdata = br(pdata.pop('next', None))
return name return id
def enumerate_folder(folder): def enumerate_folder(folder):

Loading…
Cancel
Save