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: ...@@ -38,9 +38,10 @@ try:
from cStringIO import StringIO from cStringIO import StringIO
except ImportError: except ImportError:
from StringIO import StringIO from StringIO import StringIO
from zLOG import LOG
import imghdr import imghdr
import random import random
from Products.ERP5Type import Permissions
from zLOG import LOG
from OFS.Image import Pdata from OFS.Image import Pdata
...@@ -218,12 +219,9 @@ class OOoParser: ...@@ -218,12 +219,9 @@ class OOoParser:
""" """
General purpose tools to parse and handle OpenOffice v1.x documents. General purpose tools to parse and handle OpenOffice v1.x documents.
""" """
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declarePrivate('__init__') security.declarePrivate('__init__')
def __init__(self): def __init__(self):
# Create the PyExpat reader # Create the PyExpat reader
...@@ -235,8 +233,7 @@ class OOoParser: ...@@ -235,8 +233,7 @@ class OOoParser:
self.ns = {} self.ns = {}
self.filename = None self.filename = None
security.declareProtected(Permissions.ImportExportObjects, 'openFile')
security.declareProtected('Import/Export objects', 'openFile')
def openFile(self, file_descriptor): def openFile(self, file_descriptor):
""" """
Load all files in the zipped OpenOffice document Load all files in the zipped OpenOffice document
...@@ -270,7 +267,6 @@ class OOoParser: ...@@ -270,7 +267,6 @@ class OOoParser:
if name[:5] == "xmlns": if name[:5] == "xmlns":
self.ns[name[6:]] = doc_ns[0].attributes.item(i).value self.ns[name[6:]] = doc_ns[0].attributes.item(i).value
security.declarePublic('getFilename') security.declarePublic('getFilename')
def getFilename(self): def getFilename(self):
""" """
...@@ -278,7 +274,6 @@ class OOoParser: ...@@ -278,7 +274,6 @@ class OOoParser:
""" """
return self.filename return self.filename
security.declarePublic('getPicturesMapping') security.declarePublic('getPicturesMapping')
def getPicturesMapping(self): def getPicturesMapping(self):
""" """
...@@ -292,7 +287,6 @@ class OOoParser: ...@@ -292,7 +287,6 @@ class OOoParser:
self.pictures[file_name] = raw_data self.pictures[file_name] = raw_data
return self.pictures return self.pictures
security.declarePublic('getContentDom') security.declarePublic('getContentDom')
def getContentDom(self): def getContentDom(self):
""" """
...@@ -300,7 +294,6 @@ class OOoParser: ...@@ -300,7 +294,6 @@ class OOoParser:
""" """
return self.oo_content_dom return self.oo_content_dom
security.declarePublic('getSpreadsheetsDom') security.declarePublic('getSpreadsheetsDom')
def getSpreadsheetsDom(self, include_embedded=False): def getSpreadsheetsDom(self, include_embedded=False):
""" """
...@@ -312,7 +305,6 @@ class OOoParser: ...@@ -312,7 +305,6 @@ class OOoParser:
spreadsheets += self.getEmbeddedSpreadsheetsDom() spreadsheets += self.getEmbeddedSpreadsheetsDom()
return spreadsheets return spreadsheets
security.declarePublic('getSpreadsheetsMapping') security.declarePublic('getSpreadsheetsMapping')
def getSpreadsheetsMapping(self, include_embedded=False, no_empty_lines=False, normalize=True): def getSpreadsheetsMapping(self, include_embedded=False, no_empty_lines=False, normalize=True):
""" """
...@@ -325,7 +317,6 @@ class OOoParser: ...@@ -325,7 +317,6 @@ class OOoParser:
tables = self._getTableListUnion(tables, embedded_tables) tables = self._getTableListUnion(tables, embedded_tables)
return tables return tables
security.declarePublic('getPlainSpreadsheetsDom') security.declarePublic('getPlainSpreadsheetsDom')
def getPlainSpreadsheetsDom(self): def getPlainSpreadsheetsDom(self):
""" """
...@@ -337,7 +328,6 @@ class OOoParser: ...@@ -337,7 +328,6 @@ class OOoParser:
spreadsheets.append(table) spreadsheets.append(table)
return spreadsheets return spreadsheets
security.declarePublic('getPlainSpreadsheetsMapping') security.declarePublic('getPlainSpreadsheetsMapping')
def getPlainSpreadsheetsMapping(self, no_empty_lines=False, normalize=True): def getPlainSpreadsheetsMapping(self, no_empty_lines=False, normalize=True):
""" """
...@@ -350,7 +340,6 @@ class OOoParser: ...@@ -350,7 +340,6 @@ class OOoParser:
tables = self._getTableListUnion(tables, new_table) tables = self._getTableListUnion(tables, new_table)
return tables return tables
security.declarePublic('getEmbeddedSpreadsheetsDom') security.declarePublic('getEmbeddedSpreadsheetsDom')
def getEmbeddedSpreadsheetsDom(self): def getEmbeddedSpreadsheetsDom(self):
""" """
...@@ -374,7 +363,6 @@ class OOoParser: ...@@ -374,7 +363,6 @@ class OOoParser:
pass pass
return spreadsheets return spreadsheets
security.declarePublic('getEmbeddedSpreadsheetsMapping') security.declarePublic('getEmbeddedSpreadsheetsMapping')
def getEmbeddedSpreadsheetsMapping(self, no_empty_lines=False, normalize=True): def getEmbeddedSpreadsheetsMapping(self, no_empty_lines=False, normalize=True):
""" """
...@@ -387,7 +375,6 @@ class OOoParser: ...@@ -387,7 +375,6 @@ class OOoParser:
tables = self._getTableListUnion(tables, new_table) tables = self._getTableListUnion(tables, new_table)
return tables return tables
security.declarePublic('getSpreadsheetMapping') security.declarePublic('getSpreadsheetMapping')
def getSpreadsheetMapping(self, spreadsheet=None, no_empty_lines=False, normalize=True): def getSpreadsheetMapping(self, spreadsheet=None, no_empty_lines=False, normalize=True):
""" """
...@@ -482,7 +469,6 @@ class OOoParser: ...@@ -482,7 +469,6 @@ class OOoParser:
) )
return {table_name: new_table} return {table_name: new_table}
security.declarePrivate('_getReducedTable') security.declarePrivate('_getReducedTable')
def _getReducedTable(self, table): def _getReducedTable(self, table):
""" """
...@@ -513,7 +499,6 @@ class OOoParser: ...@@ -513,7 +499,6 @@ class OOoParser:
return table[:table_height] return table[:table_height]
security.declarePrivate('_getTableSizeDict') security.declarePrivate('_getTableSizeDict')
def _getTableSizeDict(self, table): def _getTableSizeDict(self, table):
""" """
...@@ -529,7 +514,6 @@ class OOoParser: ...@@ -529,7 +514,6 @@ class OOoParser:
, 'height': len(table) , 'height': len(table)
} }
security.declarePrivate('_getNormalizedBoundsTable') security.declarePrivate('_getNormalizedBoundsTable')
def _getNormalizedBoundsTable(self, table, width=0, height=0): def _getNormalizedBoundsTable(self, table, width=0, height=0):
""" """
...@@ -542,7 +526,6 @@ class OOoParser: ...@@ -542,7 +526,6 @@ class OOoParser:
table[line].append(None) table[line].append(None)
return table return table
security.declarePrivate('_getTableListUnion') security.declarePrivate('_getTableListUnion')
def _getTableListUnion(self, list1, list2): def _getTableListUnion(self, list1, list2):
""" """
...@@ -559,7 +542,5 @@ class OOoParser: ...@@ -559,7 +542,5 @@ class OOoParser:
list1[new_key] = list2[list2_key] list1[new_key] = list2[list2_key]
return list1 return list1
InitializeClass(OOoParser) InitializeClass(OOoParser)
allow_class(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