Commit 9e0a9384 authored by Rafael Monnerat's avatar Rafael Monnerat

ERP5Configurator: Code style and drop getToolByName

parent 9bcb98c4
...@@ -57,5 +57,5 @@ class ConfigurationSave(Path): ...@@ -57,5 +57,5 @@ class ConfigurationSave(Path):
if kw.has_key('conf_title'): if kw.has_key('conf_title'):
self.setTitle(kw['conf_title']) self.setTitle(kw['conf_title'])
kw.pop('conf_title') kw.pop('conf_title')
conf_item = self.newContent(portal_type = configuration_item_class_name, **kw) return self.newContent(portal_type=configuration_item_class_name,
return conf_item **kw)
...@@ -30,7 +30,6 @@ import zope.interface ...@@ -30,7 +30,6 @@ import zope.interface
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.XMLObject import XMLObject
from Products.CMFCore.utils import getToolByName
from Products.ERP5Configurator.mixin.configurator_item import ConfiguratorItemMixin from Products.ERP5Configurator.mixin.configurator_item import ConfiguratorItemMixin
class ExportCustomerBT5ConfiguratorItem(XMLObject, ConfiguratorItemMixin): class ExportCustomerBT5ConfiguratorItem(XMLObject, ConfiguratorItemMixin):
...@@ -56,8 +55,7 @@ class ExportCustomerBT5ConfiguratorItem(XMLObject, ConfiguratorItemMixin): ...@@ -56,8 +55,7 @@ class ExportCustomerBT5ConfiguratorItem(XMLObject, ConfiguratorItemMixin):
, PropertySheet.DublinCore ) , PropertySheet.DublinCore )
def _build(self, business_configuration): def _build(self, business_configuration):
portal = self.getPortalObject() template_tool = self.getPortalObject().portal_templates
template_tool = getToolByName(portal, 'portal_templates')
bt5_obj = business_configuration.getSpecialiseValue() bt5_obj = business_configuration.getSpecialiseValue()
if bt5_obj.getBuildingState() != 'built': if bt5_obj.getBuildingState() != 'built':
## build template so it can be exported ## build template so it can be exported
...@@ -66,5 +64,5 @@ class ExportCustomerBT5ConfiguratorItem(XMLObject, ConfiguratorItemMixin): ...@@ -66,5 +64,5 @@ class ExportCustomerBT5ConfiguratorItem(XMLObject, ConfiguratorItemMixin):
bt5_data = template_tool.export(bt5_obj) bt5_data = template_tool.export(bt5_obj)
business_configuration.newContent( business_configuration.newContent(
portal_type='File', portal_type='File',
title = bt5_obj.getTitle(), title=bt5_obj.getTitle(),
data = bt5_data) data=bt5_data)
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
############################################################################## ##############################################################################
import zope.interface import zope.interface
from Products.CMFCore.utils import getToolByName
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.XMLObject import XMLObject
......
...@@ -102,10 +102,10 @@ class SystemPreferenceConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -102,10 +102,10 @@ class SystemPreferenceConfiguratorItem(ConfiguratorItemMixin, XMLObject):
if preference is None: if preference is None:
preference = portal.portal_preferences.newContent( preference = portal.portal_preferences.newContent(
portal_type = 'System Preference', portal_type = 'System Preference',
id = self.object_id, id=self.object_id,
title = self.title, title=self.title,
description = self.description, description=self.description,
priority = 1) priority=1)
# XXX this have to be translated in user language. # XXX this have to be translated in user language.
preference_dict = {} preference_dict = {}
......
...@@ -36,7 +36,6 @@ from Products.ERP5Type.Tool.BaseTool import BaseTool ...@@ -36,7 +36,6 @@ from Products.ERP5Type.Tool.BaseTool import BaseTool
from Products.ERP5Type.Cache import CachingMethod from Products.ERP5Type.Cache import CachingMethod
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
from Products.ERP5Configurator import _dtmldir from Products.ERP5Configurator import _dtmldir
from Products.CMFCore.utils import getToolByName
from Products.Formulator.Errors import FormValidationError from Products.Formulator.Errors import FormValidationError
import cookielib import cookielib
from base64 import encodestring from base64 import encodestring
...@@ -430,8 +429,8 @@ class ConfiguratorTool(BaseTool): ...@@ -430,8 +429,8 @@ class ConfiguratorTool(BaseTool):
activities should not exists. activities should not exists.
""" """
global installation_status global installation_status
portal_activities = getToolByName(self.getPortalObject(), portal_activities = self.getPortalObject().portal_activities
'portal_activities')
is_bt5_installation_over = (portal_activities.countMessageWithTag( is_bt5_installation_over = (portal_activities.countMessageWithTag(
'initialERP5Setup') == 0) 'initialERP5Setup') == 0)
if 0 == len(portal_activities.getMessageList()) and \ if 0 == len(portal_activities.getMessageList()) and \
......
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