Commit b999ac04 authored by Ayush Tiwari's avatar Ayush Tiwari

bt5_config: _path_item_list should be PersistentList

parent bfcbe492
...@@ -39,6 +39,7 @@ import fnmatch ...@@ -39,6 +39,7 @@ import fnmatch
import re import re
import threading import threading
import pprint import pprint
from copy import deepcopy from copy import deepcopy
from collections import defaultdict from collections import defaultdict
from cStringIO import StringIO from cStringIO import StringIO
...@@ -49,19 +50,22 @@ from OFS import SimpleItem, XMLExportImport ...@@ -49,19 +50,22 @@ from OFS import SimpleItem, XMLExportImport
from datetime import datetime from datetime import datetime
from itertools import chain from itertools import chain
from operator import attrgetter from operator import attrgetter
from persistent.list import PersistentList
from AccessControl import ClassSecurityInfo, Unauthorized, getSecurityManager
from Acquisition import Implicit, aq_base, aq_inner, aq_parent
from zLOG import LOG, INFO, WARNING
from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.XMLObject import XMLObject
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.PythonScripts.PythonScript import PythonScript from Products.PythonScripts.PythonScript import PythonScript
from Products.ERP5Type.dynamic.lazy_class import ERP5BaseBroken from Products.ERP5Type.dynamic.lazy_class import ERP5BaseBroken
from Products.ERP5Type.Globals import Persistent, PersistentMapping from Products.ERP5Type.Globals import Persistent, PersistentMapping
from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5Type import Permissions, PropertySheet, interfaces
from AccessControl import ClassSecurityInfo, Unauthorized, getSecurityManager
from Acquisition import Implicit, aq_base, aq_inner, aq_parent
from Products.ERP5Type.Globals import InitializeClass from Products.ERP5Type.Globals import InitializeClass
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
from zLOG import LOG, INFO, WARNING
from Products.ERP5Type.patches.ppml import importXML from Products.ERP5Type.patches.ppml import importXML
from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter
customImporters = { customImporters = {
XMLExportImport.magic: importXML, XMLExportImport.magic: importXML,
} }
...@@ -236,17 +240,14 @@ class BusinessManager(XMLObject): ...@@ -236,17 +240,14 @@ class BusinessManager(XMLObject):
final_prop_map = prop_map+self._properties final_prop_map = prop_map+self._properties
return final_prop_map return final_prop_map
security.declareProtected(Permissions.ManagePortal, 'export')
def export(self, path=None, local=0, bma=None, **kw): def export(self, path=None, local=0, bma=None, **kw):
""" """
Export the object Export the object as zexp file
XXX: Are we planning to use something like archive for saving the exported
objects inside a Business Manager
""" """
if not self.getStatus() == 'built': if not self.getStatus() == 'built':
raise ValueError, 'Manager not built properly' raise ValueError, 'Manager not built properly'
f = StringIO() f = StringIO()
self._p_jar.exportFile(self._p_oid, f) self._p_jar.exportFile(self._p_oid, f)
# XXX: Improve naming # XXX: Improve naming
...@@ -277,7 +278,7 @@ class BusinessManager(XMLObject): ...@@ -277,7 +278,7 @@ class BusinessManager(XMLObject):
connection = self.aq_parent._p_jar connection = self.aq_parent._p_jar
file = open(path, 'rb') file = open(path, 'rb')
obj = connection.importFile(file) obj = connection.importFile(file)
self._path_item_list = obj._path_item_list self._path_item_list = obj._path_item_list[:]
self._setTemplatePathList(obj.getTemplatePathList()) self._setTemplatePathList(obj.getTemplatePathList())
def __add__(self, other): def __add__(self, other):
...@@ -319,7 +320,7 @@ class BusinessManager(XMLObject): ...@@ -319,7 +320,7 @@ class BusinessManager(XMLObject):
""" """
portal = self.getPortalObject() portal = self.getPortalObject()
LOG('Business Manager', INFO, 'Storing Manager Data') LOG('Business Manager', INFO, 'Storing Manager Data')
self._path_item_list = [] self._path_item_list = PersistentList()
path_item_list = self.getTemplatePathList() path_item_list = self.getTemplatePathList()
if path_item_list: if path_item_list:
......
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