Commit 9c31fd4b authored by Bartek Górny's avatar Bartek Górny

Use ERP5 Permissions

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11683 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f975004f
......@@ -38,9 +38,10 @@ try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from zLOG import LOG
import imghdr
import random
from Products.ERP5Type import Permissions
from zLOG import LOG
from OFS.Image import Pdata
......@@ -108,7 +109,7 @@ class OOoBuilder:
pass
zf.writestr(filename, stream)
zf.close()
security.declarePublic('extract')
def extract(self, filename):
"""
......@@ -119,7 +120,7 @@ class OOoBuilder:
except RuntimeError:
zf = ZipFile(self._document, mode='r')
return zf.read(filename)
security.declarePublic('getNameList')
def getNameList(self):
try:
......@@ -210,7 +211,7 @@ class OOoBuilder:
request.response.setHeader('Content-Disposition', 'attachment; filename=%s.%s' % (name, extension))
self._document.seek(0)
return self._document.read()
InitializeClass(OOoBuilder)
allow_class(OOoBuilder)
......@@ -218,12 +219,9 @@ class OOoParser:
"""
General purpose tools to parse and handle OpenOffice v1.x documents.
"""
# Declarative security
security = ClassSecurityInfo()
security.declarePrivate('__init__')
def __init__(self):
# Create the PyExpat reader
......@@ -235,8 +233,7 @@ class OOoParser:
self.ns = {}
self.filename = None
security.declareProtected('Import/Export objects', 'openFile')
security.declareProtected(Permissions.ImportExportObjects, 'openFile')
def openFile(self, file_descriptor):
"""
Load all files in the zipped OpenOffice document
......@@ -270,7 +267,6 @@ class OOoParser:
if name[:5] == "xmlns":
self.ns[name[6:]] = doc_ns[0].attributes.item(i).value
security.declarePublic('getFilename')
def getFilename(self):
"""
......@@ -278,7 +274,6 @@ class OOoParser:
"""
return self.filename
security.declarePublic('getPicturesMapping')
def getPicturesMapping(self):
"""
......@@ -292,7 +287,6 @@ class OOoParser:
self.pictures[file_name] = raw_data
return self.pictures
security.declarePublic('getContentDom')
def getContentDom(self):
"""
......@@ -300,7 +294,6 @@ class OOoParser:
"""
return self.oo_content_dom
security.declarePublic('getSpreadsheetsDom')
def getSpreadsheetsDom(self, include_embedded=False):
"""
......@@ -312,7 +305,6 @@ class OOoParser:
spreadsheets += self.getEmbeddedSpreadsheetsDom()
return spreadsheets
security.declarePublic('getSpreadsheetsMapping')
def getSpreadsheetsMapping(self, include_embedded=False, no_empty_lines=False, normalize=True):
"""
......@@ -325,7 +317,6 @@ class OOoParser:
tables = self._getTableListUnion(tables, embedded_tables)
return tables
security.declarePublic('getPlainSpreadsheetsDom')
def getPlainSpreadsheetsDom(self):
"""
......@@ -337,7 +328,6 @@ class OOoParser:
spreadsheets.append(table)
return spreadsheets
security.declarePublic('getPlainSpreadsheetsMapping')
def getPlainSpreadsheetsMapping(self, no_empty_lines=False, normalize=True):
"""
......@@ -350,7 +340,6 @@ class OOoParser:
tables = self._getTableListUnion(tables, new_table)
return tables
security.declarePublic('getEmbeddedSpreadsheetsDom')
def getEmbeddedSpreadsheetsDom(self):
"""
......@@ -374,7 +363,6 @@ class OOoParser:
pass
return spreadsheets
security.declarePublic('getEmbeddedSpreadsheetsMapping')
def getEmbeddedSpreadsheetsMapping(self, no_empty_lines=False, normalize=True):
"""
......@@ -387,7 +375,6 @@ class OOoParser:
tables = self._getTableListUnion(tables, new_table)
return tables
security.declarePublic('getSpreadsheetMapping')
def getSpreadsheetMapping(self, spreadsheet=None, no_empty_lines=False, normalize=True):
"""
......@@ -482,7 +469,6 @@ class OOoParser:
)
return {table_name: new_table}
security.declarePrivate('_getReducedTable')
def _getReducedTable(self, table):
"""
......@@ -513,7 +499,6 @@ class OOoParser:
return table[:table_height]
security.declarePrivate('_getTableSizeDict')
def _getTableSizeDict(self, table):
"""
......@@ -529,7 +514,6 @@ class OOoParser:
, 'height': len(table)
}
security.declarePrivate('_getNormalizedBoundsTable')
def _getNormalizedBoundsTable(self, table, width=0, height=0):
"""
......@@ -542,7 +526,6 @@ class OOoParser:
table[line].append(None)
return table
security.declarePrivate('_getTableListUnion')
def _getTableListUnion(self, list1, list2):
"""
......@@ -559,7 +542,5 @@ class OOoParser:
list1[new_key] = list2[list2_key]
return list1
InitializeClass(OOoParser)
allow_class(OOoParser)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment