Commit 7e76a151 authored by Julien Muchembled's avatar Julien Muchembled

style: remove tabs in product/*.py

parent d452eb6e
...@@ -35,7 +35,7 @@ from Products.CMFCore.Expression import Expression ...@@ -35,7 +35,7 @@ from Products.CMFCore.Expression import Expression
from Products.ERP5Type import PropertySheet from Products.ERP5Type import PropertySheet
from Products.ERP5Type.Utils import createExpressionContext from Products.ERP5Type.Utils import createExpressionContext
from Products.ERP5Type.Core.PropertyExistenceConstraint import \ from Products.ERP5Type.Core.PropertyExistenceConstraint import \
PropertyExistenceConstraint PropertyExistenceConstraint
from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery
class AttributeUnicityConstraint(PropertyExistenceConstraint): class AttributeUnicityConstraint(PropertyExistenceConstraint):
......
...@@ -48,4 +48,4 @@ class CategoryRelatedMembershipStateConstraint(CategoryMembershipStateConstraint ...@@ -48,4 +48,4 @@ class CategoryRelatedMembershipStateConstraint(CategoryMembershipStateConstraint
class to simply surcharge it. class to simply surcharge it.
""" """
return obj._getRelatedValueList(base_category, return obj._getRelatedValueList(base_category,
portal_type=portal_type_list) portal_type=portal_type_list)
# Simple Object Inspector # Simple Object Inspector
def inspect(self): def inspect(self):
return str(self.__dict__) return str(self.__dict__)
#return "type: %s dict:%s" % (type(o), o.__dict__) #return "type: %s dict:%s" % (type(o), o.__dict__)
result = '' result = ''
return self.getPhysicalPath() return self.getPhysicalPath()
...@@ -153,7 +153,7 @@ class CopyToTarget(TargetSolver): ...@@ -153,7 +153,7 @@ class CopyToTarget(TargetSolver):
simulation_movement.setSource(delivery.getSource()) simulation_movement.setSource(delivery.getSource())
simulation_movement.setDestinationSection(delivery.getDestinationSection()) simulation_movement.setDestinationSection(delivery.getDestinationSection())
simulation_movement.setSourceSection(delivery.getSourceSection()) simulation_movement.setSourceSection(delivery.getSourceSection())
simulation_movement.edit(**value_dict) simulation_movement.edit(**value_dict)
if parent_movement is not None and not parent_movement.isFrozen(): if parent_movement is not None and not parent_movement.isFrozen():
......
...@@ -973,7 +973,7 @@ class SimulationTool(BaseTool): ...@@ -973,7 +973,7 @@ class SimulationTool(BaseTool):
mirror_section_category - only take rows in stock table which mirror_section_category - only take rows in stock table which
mirror_section_uid is member of mirror_section_uid is member of
mirror_section_category mirror_section_category
node_filter - only take rows in stock table which node_uid node_filter - only take rows in stock table which node_uid
matches node_filter matches node_filter
...@@ -1851,7 +1851,7 @@ class SimulationTool(BaseTool): ...@@ -1851,7 +1851,7 @@ class SimulationTool(BaseTool):
TODO: TODO:
- make sure getInventoryHistoryList can return - make sure getInventoryHistoryList can return
cumulative values calculated by SQL (JPS) cumulative values calculated by SQL (JPS)
""" """
sql_kw = self._generateSQLKeywordDict(**kw) sql_kw = self._generateSQLKeywordDict(**kw)
return self.Resource_getInventoryHistoryList( return self.Resource_getInventoryHistoryList(
......
...@@ -137,9 +137,9 @@ class URLOpener(FancyURLopener): ...@@ -137,9 +137,9 @@ class URLOpener(FancyURLopener):
class Checker(URLOpener): class Checker(URLOpener):
# This seems necessary for exceptions # This seems necessary for exceptions
type = 'http' type = 'http'
def CheckUrl(self, url=None): def CheckUrl(self, url=None):
try: try:
thread = Thread(target=self.SearchUrl,args=(url,)) thread = Thread(target=self.SearchUrl,args=(url,))
......
...@@ -568,16 +568,16 @@ class TestBug(ERP5TypeTestCase): ...@@ -568,16 +568,16 @@ class TestBug(ERP5TypeTestCase):
if not run: return if not run: return
sequence_list = SequenceList() sequence_list = SequenceList()
step_list = [ 'stepCreateBug' step_list = [ 'stepCreateBug'
, 'stepCheckBugInit' , 'stepCheckBugInit'
, 'stepOpenBug' , 'stepOpenBug'
, 'stepTic'
, 'stepAssignBug'
, 'stepTic'
, 'stepResolveBug'
, 'stepTic' , 'stepTic'
, 'stepAssignBug'
, 'stepTic'
, 'stepResolveBug'
, 'stepTic'
, 'stepOpenBug' , 'stepOpenBug'
, 'stepTic' , 'stepTic'
] ]
sequence_string = ' '.join(step_list) sequence_string = ' '.join(step_list)
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=quiet) sequence_list.play(self, quiet=quiet)
......
...@@ -4258,9 +4258,9 @@ class TestBusinessTemplate(BusinessTemplateMixin): ...@@ -4258,9 +4258,9 @@ class TestBusinessTemplate(BusinessTemplateMixin):
CheckNotInstalledInstallationState \ CheckNotInstalledInstallationState \
CheckPreinstallReturnSomething \ CheckPreinstallReturnSomething \
CheckCatalogPreinstallReturnCatalogMethod \ CheckCatalogPreinstallReturnCatalogMethod \
Tic \ Tic \
InstallWithoutForceBusinessTemplate \ InstallWithoutForceBusinessTemplate \
CheckFolderReindexActivityPresence \ CheckFolderReindexActivityPresence \
Tic \ Tic \
CheckInstalledInstallationState \ CheckInstalledInstallationState \
CheckBuiltBuildingState \ CheckBuiltBuildingState \
...@@ -5039,17 +5039,17 @@ class TestBusinessTemplate(BusinessTemplateMixin): ...@@ -5039,17 +5039,17 @@ class TestBusinessTemplate(BusinessTemplateMixin):
"""Test is revision number is incremented with the bt is built""" """Test is revision number is incremented with the bt is built"""
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = '\ sequence_string = '\
CreatePortalType \ CreatePortalType \
CreateNewBusinessTemplate \ CreateNewBusinessTemplate \
UseExportBusinessTemplate \ UseExportBusinessTemplate \
CheckInitialRevision \ CheckInitialRevision \
BuildBusinessTemplate \ BuildBusinessTemplate \
CheckBuiltBuildingState \ CheckBuiltBuildingState \
stepCheckFirstRevision \ stepCheckFirstRevision \
BuildBusinessTemplate \ BuildBusinessTemplate \
stepCheckSecondRevision \ stepCheckSecondRevision \
RemoveBusinessTemplate \ RemoveBusinessTemplate \
RemovePortalType \ RemovePortalType \
' '
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
...@@ -5058,12 +5058,12 @@ class TestBusinessTemplate(BusinessTemplateMixin): ...@@ -5058,12 +5058,12 @@ class TestBusinessTemplate(BusinessTemplateMixin):
"""Test if a new Business Template has no dependencies""" """Test if a new Business Template has no dependencies"""
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = '\ sequence_string = '\
CreatePortalType \ CreatePortalType \
CreateNewBusinessTemplate \ CreateNewBusinessTemplate \
UseExportBusinessTemplate \ UseExportBusinessTemplate \
CheckNoMissingDependencies \ CheckNoMissingDependencies \
RemoveBusinessTemplate \ RemoveBusinessTemplate \
RemovePortalType \ RemovePortalType \
' '
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
...@@ -5072,13 +5072,13 @@ class TestBusinessTemplate(BusinessTemplateMixin): ...@@ -5072,13 +5072,13 @@ class TestBusinessTemplate(BusinessTemplateMixin):
"""Test if a exception is raised when a dependency is missing""" """Test if a exception is raised when a dependency is missing"""
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = '\ sequence_string = '\
CreatePortalType \ CreatePortalType \
CreateNewBusinessTemplate \ CreateNewBusinessTemplate \
UseExportBusinessTemplate \ UseExportBusinessTemplate \
AddDependency \ AddDependency \
CheckMissingDependencies \ CheckMissingDependencies \
RemoveBusinessTemplate \ RemoveBusinessTemplate \
RemovePortalType \ RemovePortalType \
' '
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
...@@ -5087,9 +5087,9 @@ class TestBusinessTemplate(BusinessTemplateMixin): ...@@ -5087,9 +5087,9 @@ class TestBusinessTemplate(BusinessTemplateMixin):
"""Test if the dependency problem is fixed when the dependency is installed""" """Test if the dependency problem is fixed when the dependency is installed"""
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = '\ sequence_string = '\
CreatePortalType \ CreatePortalType \
CreateNewBusinessTemplate \ CreateNewBusinessTemplate \
UseExportBusinessTemplate \ UseExportBusinessTemplate \
AddDependency \ AddDependency \
CheckMissingDependencies \ CheckMissingDependencies \
CreateDependencyBusinessTemplate \ CreateDependencyBusinessTemplate \
...@@ -5162,7 +5162,7 @@ class TestBusinessTemplate(BusinessTemplateMixin): ...@@ -5162,7 +5162,7 @@ class TestBusinessTemplate(BusinessTemplateMixin):
"""Test if backup works during installation of a bt with subfolder in skin folder""" """Test if backup works during installation of a bt with subfolder in skin folder"""
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = '\ sequence_string = '\
CreatePortalType \ CreatePortalType \
CreateSkinFolder \ CreateSkinFolder \
CheckSkinFolderExists \ CheckSkinFolderExists \
CreateSkinSubFolder \ CreateSkinSubFolder \
...@@ -5188,7 +5188,7 @@ class TestBusinessTemplate(BusinessTemplateMixin): ...@@ -5188,7 +5188,7 @@ class TestBusinessTemplate(BusinessTemplateMixin):
"""Test if build fails when one of the paths does not exist""" """Test if build fails when one of the paths does not exist"""
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = '\ sequence_string = '\
CreatePortalType \ CreatePortalType \
CreateNewBusinessTemplate \ CreateNewBusinessTemplate \
UseExportBusinessTemplate \ UseExportBusinessTemplate \
AddPathToBusinessTemplate \ AddPathToBusinessTemplate \
...@@ -5373,7 +5373,7 @@ class TestBusinessTemplate(BusinessTemplateMixin): ...@@ -5373,7 +5373,7 @@ class TestBusinessTemplate(BusinessTemplateMixin):
ImportBusinessTemplate \ ImportBusinessTemplate \
UseImportBusinessTemplate \ UseImportBusinessTemplate \
InstallWithoutForceBusinessTemplate \ InstallWithoutForceBusinessTemplate \
CheckFolderReindexActivityPresence \ CheckFolderReindexActivityPresence \
Tic \ Tic \
\ \
CheckFormGroups \ CheckFormGroups \
...@@ -5387,9 +5387,9 @@ class TestBusinessTemplate(BusinessTemplateMixin): ...@@ -5387,9 +5387,9 @@ class TestBusinessTemplate(BusinessTemplateMixin):
\ \
ImportBusinessTemplate \ ImportBusinessTemplate \
UseImportBusinessTemplate \ UseImportBusinessTemplate \
Tic \ Tic \
InstallWithoutForceBusinessTemplate \ InstallWithoutForceBusinessTemplate \
CheckFolderReindexActivityPresence \ CheckFolderReindexActivityPresence \
Tic \ Tic \
\ \
CheckFormGroups \ CheckFormGroups \
......
...@@ -159,8 +159,8 @@ class TestEgov(ERP5TypeTestCase): ...@@ -159,8 +159,8 @@ class TestEgov(ERP5TypeTestCase):
""" """
transaction.abort() transaction.abort()
for module in [ self.getPersonModule(), for module in [ self.getPersonModule(),
self.getOrganisationModule(), self.getOrganisationModule(),
]: ]:
module.manage_delObjects(list(module.objectIds())) module.manage_delObjects(list(module.objectIds()))
vat_portal_type = self.portal.portal_types.getTypeInfo('Vat Declaration') vat_portal_type = self.portal.portal_types.getTypeInfo('Vat Declaration')
...@@ -327,8 +327,7 @@ class TestEgov(ERP5TypeTestCase): ...@@ -327,8 +327,7 @@ class TestEgov(ERP5TypeTestCase):
type_allowed_content_type_list.append('PDF') type_allowed_content_type_list.append('PDF')
vat_declaration.getTypeInfo().setTypeAllowedContentTypeList(type_allowed_content_type_list) vat_declaration.getTypeInfo().setTypeAllowedContentTypeList(type_allowed_content_type_list)
vat_declaration.getTypeInfo().setTypeHiddenContentTypeList(type_allowed_content_type_list) vat_declaration.getTypeInfo().setTypeHiddenContentTypeList(type_allowed_content_type_list)
vat_declaration.newContent(portal_type='PDF', vat_declaration.newContent(portal_type='PDF', title='Justificatif numero 1')
title='Justificatif numero 1')
self.tic() self.tic()
transaction.commit() transaction.commit()
missing_file = vat_declaration.PDFDocument_getRequirementCount() missing_file = vat_declaration.PDFDocument_getRequirementCount()
......
...@@ -631,7 +631,7 @@ class TestItem(TestItemMixin, ERP5TypeTestCase): ...@@ -631,7 +631,7 @@ class TestItem(TestItemMixin, ERP5TypeTestCase):
packing_list_line= self.createPackingListLine(packing_list=packing_list, packing_list_line= self.createPackingListLine(packing_list=packing_list,
resource=resource) resource=resource)
transaction.commit() transaction.commit()
self.tic() self.tic()
packing_list_line.DeliveryLine_viewItemCreationDialog() packing_list_line.DeliveryLine_viewItemCreationDialog()
# create a listbox # create a listbox
listbox = ({ 'listbox_key': '000', listbox = ({ 'listbox_key': '000',
......
...@@ -42,21 +42,21 @@ class TestERP5BankingCashBalanceRegulation(TestERP5BankingMixin): ...@@ -42,21 +42,21 @@ class TestERP5BankingCashBalanceRegulation(TestERP5BankingMixin):
""" """
Unit test for the cash balance regulation module Unit test for the cash balance regulation module
Source = destination Source = destination
Initial cash detail : Initial cash detail :
5 banknotes of 10000 5 banknotes of 10000
12 coin of 200 12 coin of 200
24 banknotes of 5000 24 banknotes of 5000
0 coin of 100 0 coin of 100
Ordered by Assignor Ordered by Assignor
Confirmed by Assignee Confirmed by Assignee
Delivered by DestinationAssignee Delivered by DestinationAssignee
Final cash detail : Final cash detail :
0 banknotes of 10000 0 banknotes of 10000
0 coin of 200 0 coin of 200
34 banknotes of 5000 34 banknotes of 5000
24 coin of 100 24 coin of 100
""" """
......
...@@ -44,19 +44,19 @@ class TestERP5BankingCashExchange(TestERP5BankingMixin): ...@@ -44,19 +44,19 @@ class TestERP5BankingCashExchange(TestERP5BankingMixin):
Unit test for the cash exchange module Unit test for the cash exchange module
Source = destination Source = destination
Initial cash detail : Initial cash detail :
5 banknotes of 10000 5 banknotes of 10000
12 coin of 200 12 coin of 200
24 banknotes of 5000 24 banknotes of 5000
0 coin of 100 0 coin of 100
Ordered by Assignor Ordered by Assignor
Confirmed by Assignee Confirmed by Assignee
Delivered by DestinationAssignee Delivered by DestinationAssignee
Final cash detail : Final cash detail :
0 banknotes of 10000 0 banknotes of 10000
0 coin of 200 0 coin of 200
34 banknotes of 5000 34 banknotes of 5000
24 coin of 100 24 coin of 100
""" """
...@@ -503,7 +503,7 @@ class TestERP5BankingCashExchange(TestERP5BankingMixin): ...@@ -503,7 +503,7 @@ class TestERP5BankingCashExchange(TestERP5BankingMixin):
# define the sequence # define the sequence
sequence_string = 'Tic CheckObjects Tic CheckInitialInventoryGuichet_1 ' \ sequence_string = 'Tic CheckObjects Tic CheckInitialInventoryGuichet_1 ' \
+ 'CheckInitialInventoryGuichet_2 ' \ + 'CheckInitialInventoryGuichet_2 ' \
+ 'CreateCashExchange ' \ + 'CreateCashExchange ' \
+ 'CreateValidIncomingLine CheckSubTotal ' \ + 'CreateValidIncomingLine CheckSubTotal ' \
+ 'CreateValidOutgoingLine ' \ + 'CreateValidOutgoingLine ' \
+ 'Tic CheckTotal ' \ + 'Tic CheckTotal ' \
...@@ -512,7 +512,7 @@ class TestERP5BankingCashExchange(TestERP5BankingMixin): ...@@ -512,7 +512,7 @@ class TestERP5BankingCashExchange(TestERP5BankingMixin):
+ 'DeliverFails Tic ' \ + 'DeliverFails Tic ' \
+ 'DeleteResetInventory Tic ' \ + 'DeleteResetInventory Tic ' \
+ 'DeliverCashExchange Tic ' \ + 'DeliverCashExchange Tic ' \
+ 'CheckFinalInventoryGuichet_1 ' \ + 'CheckFinalInventoryGuichet_1 ' \
+ 'CheckFinalInventoryGuichet_2' + 'CheckFinalInventoryGuichet_2'
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
# play the sequence # play the sequence
......
...@@ -127,11 +127,11 @@ class TestERP5BankingForeignCashReception(TestERP5BankingMixin): ...@@ -127,11 +127,11 @@ class TestERP5BankingForeignCashReception(TestERP5BankingMixin):
#and a price cooreponding to the sum of banknote of 50 and 20 #and a price cooreponding to the sum of banknote of 50 and 20
#( (3) * 50 + (5) * 20 ) = 250 #( (3) * 50 + (5) * 20 ) = 250
self.foreign_cash_reception = self.foreign_cash_reception_module.newContent( self.foreign_cash_reception = self.foreign_cash_reception_module.newContent(
id='foreign_cash_reception', portal_type='Foreign Cash Reception', id='foreign_cash_reception', portal_type='Foreign Cash Reception',
source_value=None, destination_value=self.reception, source_value=None, destination_value=self.reception,
resource_value=self.currency_1, resource_value=self.currency_1,
description='test', description='test',
source_total_asset_price=250) source_total_asset_price=250)
# set source reference # set source reference
self.setDocumentSourceReference(self.foreign_cash_reception) self.setDocumentSourceReference(self.foreign_cash_reception)
# execute tic # execute tic
......
...@@ -136,7 +136,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin): ...@@ -136,7 +136,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin):
'variation_id': ('emission_letter', 'cash_status', 'variation'), 'variation_id': ('emission_letter', 'cash_status', 'variation'),
'variation_value': ('emission_letter/s', 'cash_status/cancelled') + self.variation_list, 'variation_value': ('emission_letter/s', 'cash_status/cancelled') + self.variation_list,
'quantity': self.quantity_5000} 'quantity': self.quantity_5000}
inventory_dict_line_for_auxiliaire_1 = {'id' : 'inventory_line_1', inventory_dict_line_for_auxiliaire_1 = {'id' : 'inventory_line_1',
'resource': self.billet_10000, 'resource': self.billet_10000,
'variation_id': ('emission_letter', 'cash_status', 'variation'), 'variation_id': ('emission_letter', 'cash_status', 'variation'),
...@@ -148,7 +148,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin): ...@@ -148,7 +148,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin):
'variation_id': ('emission_letter', 'cash_status', 'variation'), 'variation_id': ('emission_letter', 'cash_status', 'variation'),
'variation_value': ('emission_letter/p', 'cash_status/retired') + self.variation_list, 'variation_value': ('emission_letter/p', 'cash_status/retired') + self.variation_list,
'quantity': self.quantity_5000} 'quantity': self.quantity_5000}
inventory_dict_line_for_dematerialization = {'id' : 'inventory_line_3', inventory_dict_line_for_dematerialization = {'id' : 'inventory_line_3',
'resource': self.piece_200, 'resource': self.piece_200,
'variation_id': ('emission_letter', 'cash_status', 'variation'), 'variation_id': ('emission_letter', 'cash_status', 'variation'),
...@@ -1021,7 +1021,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin): ...@@ -1021,7 +1021,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin):
+ 'StopMonetaryDestruction Tic ' \ + 'StopMonetaryDestruction Tic ' \
+ 'CheckSourceDebitAvailableForAuxiliaire ' \ + 'CheckSourceDebitAvailableForAuxiliaire ' \
+ 'StoppedToDeliverMonetaryDestruction Tic ' \ + 'StoppedToDeliverMonetaryDestruction Tic ' \
+ 'CheckSourceDebitForAuxiliaire ' \ + 'CheckSourceDebitForAuxiliaire ' \
+ 'DelMonetaryDestruction Tic ' + 'DelMonetaryDestruction Tic '
sequence_list.addSequenceString(sequence_string_auxiliare) sequence_list.addSequenceString(sequence_string_auxiliare)
...@@ -1062,9 +1062,9 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin): ...@@ -1062,9 +1062,9 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin):
+ 'StopMonetaryDestruction Tic ' \ + 'StopMonetaryDestruction Tic ' \
+ 'CheckSourceDebitAvailableForExterne ' \ + 'CheckSourceDebitAvailableForExterne ' \
+ 'StoppedToDeliverMonetaryDestruction Tic ' \ + 'StoppedToDeliverMonetaryDestruction Tic ' \
+ 'CheckSourceDebitForExterne ' \ + 'CheckSourceDebitForExterne ' \
+ 'DelMonetaryDestruction Tic ' + 'DelMonetaryDestruction Tic '
sequence_list.addSequenceString(another_sequence_string) sequence_list.addSequenceString(another_sequence_string)
# We will now do a dematerialization # We will now do a dematerialization
...@@ -1078,8 +1078,8 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin): ...@@ -1078,8 +1078,8 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin):
+ 'SetMonetaryDestructionSourceTotalAssetPriceForDematerialization ' \ + 'SetMonetaryDestructionSourceTotalAssetPriceForDematerialization ' \
+ 'PlanMonetaryDestruction ' \ + 'PlanMonetaryDestruction ' \
+ 'ValidateMonetaryDestruction ' \ + 'ValidateMonetaryDestruction ' \
+ 'CheckFinalInventoryForDematerialization ' + 'CheckFinalInventoryForDematerialization '
sequence_list.addSequenceString(another_sequence_string) sequence_list.addSequenceString(another_sequence_string)
......
...@@ -186,7 +186,7 @@ class TestERP5BankingMoneyDepositMixin(TestERP5BankingMixin): ...@@ -186,7 +186,7 @@ class TestERP5BankingMoneyDepositMixin(TestERP5BankingMixin):
self.money_deposit = self.money_deposit_module.newContent( self.money_deposit = self.money_deposit_module.newContent(
id='money_deposit', id='money_deposit',
portal_type='Money Deposit', portal_type='Money Deposit',
destination_payment_value = self.bank_account_1, destination_payment_value = self.bank_account_1,
resource_value = self.currency_1, resource_value = self.currency_1,
description='test', description='test',
source_total_asset_price=20000.0) source_total_asset_price=20000.0)
......
...@@ -1714,9 +1714,9 @@ def makeTreeList(here, form, root_dict, report_path, base_category, ...@@ -1714,9 +1714,9 @@ def makeTreeList(here, form, root_dict, report_path, base_category,
tree_list += [TreeListLine(o, 0, depth, 0, selection_domain, exception_uid_list)] tree_list += [TreeListLine(o, 0, depth, 0, selection_domain, exception_uid_list)]
tree_list += makeTreeList(here, form, new_root_dict, report_path, tree_list += makeTreeList(here, form, new_root_dict, report_path,
base_category, depth + 1, unfolded_list, form_id, base_category, depth + 1, unfolded_list, form_id,
selection_name, report_depth, selection_name, report_depth,
is_report_opened=is_report_opened, sort_on=sort_on) is_report_opened=is_report_opened, sort_on=sort_on)
else: else:
tree_list += [TreeListLine(o, 1, depth, 0, selection_domain, ())] # Summary (closed) tree_list += [TreeListLine(o, 1, depth, 0, selection_domain, ())] # Summary (closed)
else: else:
......
...@@ -104,8 +104,8 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -104,8 +104,8 @@ class TestConversionInSimulation(AccountingTestCase):
'gap/%s' % self.vat_gap, 'gap/%s' % self.vat_gap,
'gap/%s' % self.sale_gap, 'gap/%s' % self.sale_gap,
'gap/%s' % self.customer_gap, 'gap/%s' % self.customer_gap,
'delivery_mode/%s' % self.mail_delivery_mode, 'delivery_mode/%s' % self.mail_delivery_mode,
'incoterm/%s' % self.cpt_incoterm, 'incoterm/%s' % self.cpt_incoterm,
'quantity_unit/%s' % self.unit_piece_quantity_unit, 'quantity_unit/%s' % self.unit_piece_quantity_unit,
'quantity_unit/%s' % self.mass_quantity_unit, 'quantity_unit/%s' % self.mass_quantity_unit,
'product_line/apparel', 'product_line/apparel',
...@@ -243,7 +243,7 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -243,7 +243,7 @@ class TestConversionInSimulation(AccountingTestCase):
resource = self.portal.product_module.newContent( resource = self.portal.product_module.newContent(
portal_type='Product', portal_type='Product',
title='Resource', title='Resource',
product_line='apparel') product_line='apparel')
currency = self.portal.currency_module.newContent( currency = self.portal.currency_module.newContent(
portal_type='Currency', portal_type='Currency',
title='euro') title='euro')
...@@ -256,8 +256,8 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -256,8 +256,8 @@ class TestConversionInSimulation(AccountingTestCase):
transaction.commit() transaction.commit()
self.tic()#execute transaction self.tic()#execute transaction
x_curr_ex_line = currency.newContent( x_curr_ex_line = currency.newContent(
portal_type='Currency Exchange Line', portal_type='Currency Exchange Line',
price_currency=new_currency.getRelativeUrl()) price_currency=new_currency.getRelativeUrl())
x_curr_ex_line.setTitle('Euro to Francs CFA') x_curr_ex_line.setTitle('Euro to Francs CFA')
x_curr_ex_line.setBasePrice(655.957) x_curr_ex_line.setBasePrice(655.957)
x_curr_ex_line.setStartDate(DateTime(2008,10,21)) x_curr_ex_line.setStartDate(DateTime(2008,10,21))
...@@ -269,7 +269,7 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -269,7 +269,7 @@ class TestConversionInSimulation(AccountingTestCase):
client = self.portal.organisation_module.newContent( client = self.portal.organisation_module.newContent(
portal_type='Organisation', portal_type='Organisation',
title='Client', title='Client',
price_currency=new_currency.getRelativeUrl(), price_currency=new_currency.getRelativeUrl(),
default_address_region=self.default_region) default_address_region=self.default_region)
vendor = self.portal.organisation_module.newContent( vendor = self.portal.organisation_module.newContent(
portal_type='Organisation', portal_type='Organisation',
...@@ -309,10 +309,10 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -309,10 +309,10 @@ class TestConversionInSimulation(AccountingTestCase):
delivery_movement.getPriceCurrencyValue()) delivery_movement.getPriceCurrencyValue())
self.assertEquals\ self.assertEquals\
(invoice_transaction_movement_1.getDestinationTotalAssetPrice(), (invoice_transaction_movement_1.getDestinationTotalAssetPrice(),
round(655.957*delivery_movement.getTotalPrice())) round(655.957*delivery_movement.getTotalPrice()))
self.assertEquals\ self.assertEquals\
(invoice_transaction_movement_1.getSourceTotalAssetPrice(), (invoice_transaction_movement_1.getSourceTotalAssetPrice(),
None) None)
invoice_transaction_movement_2 =\ invoice_transaction_movement_2 =\
invoice_transaction_applied_rule.contentValues()[1] invoice_transaction_applied_rule.contentValues()[1]
self.assertEquals(currency, self.assertEquals(currency,
...@@ -321,8 +321,8 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -321,8 +321,8 @@ class TestConversionInSimulation(AccountingTestCase):
delivery_movement.getPriceCurrencyValue()) delivery_movement.getPriceCurrencyValue())
self.assertEquals\ self.assertEquals\
(invoice_transaction_movement_2.getDestinationTotalAssetPrice(), (invoice_transaction_movement_2.getDestinationTotalAssetPrice(),
round(655.957*delivery_movement.getTotalPrice())) round(655.957*delivery_movement.getTotalPrice()))
def test_01_simulation_movement_source_asset_price(self,quiet=0, def test_01_simulation_movement_source_asset_price(self,quiet=0,
run=run_all_test): run=run_all_test):
""" """
...@@ -336,7 +336,7 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -336,7 +336,7 @@ class TestConversionInSimulation(AccountingTestCase):
resource = self.portal.product_module.newContent( resource = self.portal.product_module.newContent(
portal_type='Product', portal_type='Product',
title='Resource', title='Resource',
product_line='apparel') product_line='apparel')
currency = self.portal.currency_module.newContent( currency = self.portal.currency_module.newContent(
portal_type='Currency', portal_type='Currency',
title='euro') title='euro')
...@@ -349,8 +349,8 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -349,8 +349,8 @@ class TestConversionInSimulation(AccountingTestCase):
transaction.commit() transaction.commit()
self.tic()#execute transaction self.tic()#execute transaction
x_curr_ex_line = currency.newContent( x_curr_ex_line = currency.newContent(
portal_type='Currency Exchange Line', portal_type='Currency Exchange Line',
price_currency=new_currency.getRelativeUrl()) price_currency=new_currency.getRelativeUrl())
x_curr_ex_line.setTitle('Euro to Francs CFA') x_curr_ex_line.setTitle('Euro to Francs CFA')
x_curr_ex_line.setBasePrice(655.957) x_curr_ex_line.setBasePrice(655.957)
x_curr_ex_line.setStartDate(DateTime(2008,10,21)) x_curr_ex_line.setStartDate(DateTime(2008,10,21))
...@@ -366,7 +366,7 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -366,7 +366,7 @@ class TestConversionInSimulation(AccountingTestCase):
vendor = self.portal.organisation_module.newContent( vendor = self.portal.organisation_module.newContent(
portal_type='Organisation', portal_type='Organisation',
title='Vendor', title='Vendor',
price_currency=new_currency.getRelativeUrl(), price_currency=new_currency.getRelativeUrl(),
default_address_region=self.default_region) default_address_region=self.default_region)
order = self.portal.sale_order_module.newContent( order = self.portal.sale_order_module.newContent(
portal_type='Sale Order', portal_type='Sale Order',
...@@ -402,12 +402,12 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -402,12 +402,12 @@ class TestConversionInSimulation(AccountingTestCase):
delivery_movement.getPriceCurrencyValue()) delivery_movement.getPriceCurrencyValue())
self.assertEquals\ self.assertEquals\
(invoice_transaction_movement.getSourceTotalAssetPrice(), (invoice_transaction_movement.getSourceTotalAssetPrice(),
round(655.957*delivery_movement.getTotalPrice())) round(655.957*delivery_movement.getTotalPrice()))
self.assertEquals\ self.assertEquals\
(invoice_transaction_movement.getDestinationTotalAssetPrice(), (invoice_transaction_movement.getDestinationTotalAssetPrice(),
None) None)
def test_01_destination_total_asset_price_on_accounting_lines(self,quiet=0, def test_01_destination_total_asset_price_on_accounting_lines(self,quiet=0,
run=run_all_test): run=run_all_test):
""" """
...@@ -418,11 +418,11 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -418,11 +418,11 @@ class TestConversionInSimulation(AccountingTestCase):
if not quiet: if not quiet:
printAndLog( printAndLog(
'test_01_destination_total_asset_price_on_accounting_lines') 'test_01_destination_total_asset_price_on_accounting_lines')
resource = self.portal.product_module.newContent( resource = self.portal.product_module.newContent(
portal_type='Product', portal_type='Product',
title='Resource', title='Resource',
product_line='apparel') product_line='apparel')
currency = self.portal.currency_module.newContent( currency = self.portal.currency_module.newContent(
portal_type='Currency', portal_type='Currency',
title='euro') title='euro')
...@@ -435,8 +435,8 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -435,8 +435,8 @@ class TestConversionInSimulation(AccountingTestCase):
transaction.commit() transaction.commit()
self.tic()#execute transaction self.tic()#execute transaction
x_curr_ex_line = currency.newContent( x_curr_ex_line = currency.newContent(
portal_type='Currency Exchange Line', portal_type='Currency Exchange Line',
price_currency=new_currency.getRelativeUrl()) price_currency=new_currency.getRelativeUrl())
x_curr_ex_line.setTitle('Euro to Francs CFA') x_curr_ex_line.setTitle('Euro to Francs CFA')
x_curr_ex_line.setBasePrice(655.957) x_curr_ex_line.setBasePrice(655.957)
x_curr_ex_line.setStartDate(DateTime(2008,10,21)) x_curr_ex_line.setStartDate(DateTime(2008,10,21))
...@@ -448,7 +448,7 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -448,7 +448,7 @@ class TestConversionInSimulation(AccountingTestCase):
client = self.portal.organisation_module.newContent( client = self.portal.organisation_module.newContent(
portal_type='Organisation', portal_type='Organisation',
title='Client', title='Client',
price_currency=new_currency.getRelativeUrl(), price_currency=new_currency.getRelativeUrl(),
default_address_region=self.default_region) default_address_region=self.default_region)
vendor = self.portal.organisation_module.newContent( vendor = self.portal.organisation_module.newContent(
portal_type='Organisation', portal_type='Organisation',
...@@ -495,10 +495,10 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -495,10 +495,10 @@ class TestConversionInSimulation(AccountingTestCase):
self.assertEquals(line.getDestinationTotalAssetPrice(), self.assertEquals(line.getDestinationTotalAssetPrice(),
round(655.957*delivery_movement.getTotalPrice())) round(655.957*delivery_movement.getTotalPrice()))
def test_01_diverged_sale_packing_list_destination_total_asset_price( def test_01_diverged_sale_packing_list_destination_total_asset_price(
self,quiet=0,run=run_all_test): self,quiet=0,run=run_all_test):
""" """
tests that when the sale packing list is divergent on the quantity and tests that when the sale packing list is divergent on the quantity and
that the resource on simulation movements is different that the resource on simulation movements is different
...@@ -510,11 +510,11 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -510,11 +510,11 @@ class TestConversionInSimulation(AccountingTestCase):
if not quiet: if not quiet:
printAndLog( printAndLog(
'test_01_diverged_sale_packing_list_destination_total_asset_price') 'test_01_diverged_sale_packing_list_destination_total_asset_price')
resource = self.portal.product_module.newContent( resource = self.portal.product_module.newContent(
portal_type='Product', portal_type='Product',
title='Resource', title='Resource',
product_line='apparel') product_line='apparel')
currency = self.portal.currency_module.newContent( currency = self.portal.currency_module.newContent(
portal_type='Currency', portal_type='Currency',
title='euro') title='euro')
...@@ -527,8 +527,8 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -527,8 +527,8 @@ class TestConversionInSimulation(AccountingTestCase):
transaction.commit() transaction.commit()
self.tic()#execute transaction self.tic()#execute transaction
x_curr_ex_line = currency.newContent( x_curr_ex_line = currency.newContent(
portal_type='Currency Exchange Line', portal_type='Currency Exchange Line',
price_currency=new_currency.getRelativeUrl()) price_currency=new_currency.getRelativeUrl())
x_curr_ex_line.setTitle('Euro to Francs CFA') x_curr_ex_line.setTitle('Euro to Francs CFA')
x_curr_ex_line.setBasePrice(655.957) x_curr_ex_line.setBasePrice(655.957)
x_curr_ex_line.setStartDate(DateTime(2008,10,21)) x_curr_ex_line.setStartDate(DateTime(2008,10,21))
...@@ -540,7 +540,7 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -540,7 +540,7 @@ class TestConversionInSimulation(AccountingTestCase):
client = self.portal.organisation_module.newContent( client = self.portal.organisation_module.newContent(
portal_type='Organisation', portal_type='Organisation',
title='Client', title='Client',
price_currency=new_currency.getRelativeUrl(), price_currency=new_currency.getRelativeUrl(),
default_address_region=self.default_region) default_address_region=self.default_region)
vendor = self.portal.organisation_module.newContent( vendor = self.portal.organisation_module.newContent(
portal_type='Organisation', portal_type='Organisation',
...@@ -585,7 +585,7 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -585,7 +585,7 @@ class TestConversionInSimulation(AccountingTestCase):
self.tic() self.tic()
related_applied_rule = order.getCausalityRelatedValue( related_applied_rule = order.getCausalityRelatedValue(
portal_type='Applied Rule') portal_type='Applied Rule')
order_movement = related_applied_rule.contentValues()[0] order_movement = related_applied_rule.contentValues()[0]
delivery_applied_rule = order_movement.contentValues()[0] delivery_applied_rule = order_movement.contentValues()[0]
delivery_movement = delivery_applied_rule.contentValues()[0] delivery_movement = delivery_applied_rule.contentValues()[0]
...@@ -600,7 +600,7 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -600,7 +600,7 @@ class TestConversionInSimulation(AccountingTestCase):
def test_01_diverged_purchase_packing_list_source_total_asset_price( def test_01_diverged_purchase_packing_list_source_total_asset_price(
self,quiet=0,run=run_all_test): self,quiet=0,run=run_all_test):
""" """
tests that when the purchase packing list is divergent on the quantity tests that when the purchase packing list is divergent on the quantity
and that the resource on simulation movements is different and that the resource on simulation movements is different
...@@ -612,11 +612,11 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -612,11 +612,11 @@ class TestConversionInSimulation(AccountingTestCase):
if not quiet: if not quiet:
printAndLog( printAndLog(
'test_01_diverged_purchase_packing_list_source_total_asset_price') 'test_01_diverged_purchase_packing_list_source_total_asset_price')
resource = self.portal.product_module.newContent( resource = self.portal.product_module.newContent(
portal_type='Product', portal_type='Product',
title='Resource', title='Resource',
product_line='apparel') product_line='apparel')
currency = self.portal.currency_module.newContent( currency = self.portal.currency_module.newContent(
portal_type='Currency', portal_type='Currency',
title='euro') title='euro')
...@@ -629,8 +629,8 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -629,8 +629,8 @@ class TestConversionInSimulation(AccountingTestCase):
transaction.commit() transaction.commit()
self.tic()#execute transaction self.tic()#execute transaction
x_curr_ex_line = currency.newContent( x_curr_ex_line = currency.newContent(
portal_type='Currency Exchange Line', portal_type='Currency Exchange Line',
price_currency=new_currency.getRelativeUrl()) price_currency=new_currency.getRelativeUrl())
x_curr_ex_line.setTitle('Euro to Francs CFA') x_curr_ex_line.setTitle('Euro to Francs CFA')
x_curr_ex_line.setBasePrice(655.957) x_curr_ex_line.setBasePrice(655.957)
x_curr_ex_line.setStartDate(DateTime(2008,10,21)) x_curr_ex_line.setStartDate(DateTime(2008,10,21))
...@@ -646,7 +646,7 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -646,7 +646,7 @@ class TestConversionInSimulation(AccountingTestCase):
vendor = self.portal.organisation_module.newContent( vendor = self.portal.organisation_module.newContent(
portal_type='Organisation', portal_type='Organisation',
title='Vendor', title='Vendor',
price_currency=new_currency.getRelativeUrl(), price_currency=new_currency.getRelativeUrl(),
default_address_region=self.default_region) default_address_region=self.default_region)
order = self.portal.purchase_order_module.newContent( order = self.portal.purchase_order_module.newContent(
portal_type='Purchase Order', portal_type='Purchase Order',
...@@ -700,9 +700,9 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -700,9 +700,9 @@ class TestConversionInSimulation(AccountingTestCase):
self.assertEquals(invoice_transaction_movement.\ self.assertEquals(invoice_transaction_movement.\
getSourceTotalAssetPrice(), getSourceTotalAssetPrice(),
old_source_asset_price *(3.0/5.0)) old_source_asset_price *(3.0/5.0))
def test_01_delivery_mode_on_sale_packing_list_and_invoice( def test_01_delivery_mode_on_sale_packing_list_and_invoice(
self,quiet=0,run=run_all_test): self,quiet=0,run=run_all_test):
""" """
tests that when the sale packing list is divergent on the quantity and tests that when the sale packing list is divergent on the quantity and
that the resource on simulation movements is different that the resource on simulation movements is different
...@@ -714,11 +714,11 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -714,11 +714,11 @@ class TestConversionInSimulation(AccountingTestCase):
if not quiet: if not quiet:
printAndLog( printAndLog(
'test_01_delivery_mode_on_sale_packing_list_and_invoice') 'test_01_delivery_mode_on_sale_packing_list_and_invoice')
resource = self.portal.product_module.newContent( resource = self.portal.product_module.newContent(
portal_type='Product', portal_type='Product',
title='Resource', title='Resource',
product_line='apparel') product_line='apparel')
currency = self.portal.currency_module.newContent( currency = self.portal.currency_module.newContent(
portal_type='Currency', portal_type='Currency',
title='euro') title='euro')
...@@ -731,8 +731,8 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -731,8 +731,8 @@ class TestConversionInSimulation(AccountingTestCase):
transaction.commit() transaction.commit()
self.tic()#execute transaction self.tic()#execute transaction
x_curr_ex_line = currency.newContent( x_curr_ex_line = currency.newContent(
portal_type='Currency Exchange Line', portal_type='Currency Exchange Line',
price_currency=new_currency.getRelativeUrl()) price_currency=new_currency.getRelativeUrl())
x_curr_ex_line.setTitle('Euro to Francs CFA') x_curr_ex_line.setTitle('Euro to Francs CFA')
x_curr_ex_line.setBasePrice(655.957) x_curr_ex_line.setBasePrice(655.957)
x_curr_ex_line.setStartDate(DateTime(2008,10,21)) x_curr_ex_line.setStartDate(DateTime(2008,10,21))
...@@ -744,7 +744,7 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -744,7 +744,7 @@ class TestConversionInSimulation(AccountingTestCase):
client = self.portal.organisation_module.newContent( client = self.portal.organisation_module.newContent(
portal_type='Organisation', portal_type='Organisation',
title='Client', title='Client',
price_currency=new_currency.getRelativeUrl(), price_currency=new_currency.getRelativeUrl(),
default_address_region=self.default_region) default_address_region=self.default_region)
vendor = self.portal.organisation_module.newContent( vendor = self.portal.organisation_module.newContent(
portal_type='Organisation', portal_type='Organisation',
...@@ -758,8 +758,8 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -758,8 +758,8 @@ class TestConversionInSimulation(AccountingTestCase):
destination_section_value=client, destination_section_value=client,
start_date=DateTime(2008,10, 21), start_date=DateTime(2008,10, 21),
price_currency_value=currency, price_currency_value=currency,
delivery_mode=self.mail_delivery_mode, delivery_mode=self.mail_delivery_mode,
incoterm=self.cpt_incoterm, incoterm=self.cpt_incoterm,
title='Order') title='Order')
order_line = order.newContent(portal_type='Sale Order Line', order_line = order.newContent(portal_type='Sale Order Line',
resource_value=resource, resource_value=resource,
......
...@@ -60,7 +60,7 @@ class DCWorkflowTransitionDocumentationHelper(DocumentationHelper): ...@@ -60,7 +60,7 @@ class DCWorkflowTransitionDocumentationHelper(DocumentationHelper):
if new_state_id: if new_state_id:
uri = '%s/states/%s' % (self.uri.rsplit('/',2)[0], new_state_id) uri = '%s/states/%s' % (self.uri.rsplit('/',2)[0], new_state_id)
return self.getDocumentationHelper('DCWorkflowStateDocumentationHelper', uri) return self.getDocumentationHelper('DCWorkflowStateDocumentationHelper', uri)
security.declareProtected(Permissions.AccessContentsInformation, 'getTriggerType') security.declareProtected(Permissions.AccessContentsInformation, 'getTriggerType')
def getTriggerType(self): def getTriggerType(self):
......
...@@ -86,8 +86,8 @@ class TestSessionTool(ERP5TypeTestCase): ...@@ -86,8 +86,8 @@ class TestSessionTool(ERP5TypeTestCase):
session_cache_factory = getattr(portal_caches, SESSION_CACHE_FACTORY) session_cache_factory = getattr(portal_caches, SESSION_CACHE_FACTORY)
# remove current cache plugin # remove current cache plugin
session_cache_factory.manage_delObjects(list(session_cache_factory.objectIds())) session_cache_factory.manage_delObjects(list(session_cache_factory.objectIds()))
cache_plugin = session_cache_factory.newContent(portal_type=portal_type) cache_plugin = session_cache_factory.newContent(portal_type=portal_type)
cache_plugin.setCacheDuration(storage_duration) cache_plugin.setCacheDuration(storage_duration)
cache_plugin.setIntIndex(0) cache_plugin.setIntIndex(0)
if portal_type == 'Distributed Ram Cache': if portal_type == 'Distributed Ram Cache':
cache_plugin.edit(specialise='portal_memcached/default_memcached_plugin') cache_plugin.edit(specialise='portal_memcached/default_memcached_plugin')
......
...@@ -567,7 +567,7 @@ class FileValidator(Validator): ...@@ -567,7 +567,7 @@ class FileValidator(Validator):
def validate(self, field, key, REQUEST): def validate(self, field, key, REQUEST):
value = REQUEST.get(key, None) value = REQUEST.get(key, None)
if field.get_value('required') and value in (None, ''): if field.get_value('required') and value in (None, ''):
self.raise_error('required_not_found', field) self.raise_error('required_not_found', field)
return value return value
FileValidatorInstance = FileValidator() FileValidatorInstance = FileValidator()
......
...@@ -7,4 +7,4 @@ class TimerServerFactory(ServerFactory): ...@@ -7,4 +7,4 @@ class TimerServerFactory(ServerFactory):
def create(self): def create(self):
from timerserver.TimerServer import TimerServer from timerserver.TimerServer import TimerServer
return TimerServer(self.module, self.interval) return TimerServer(self.module, self.interval)
...@@ -154,14 +154,14 @@ class GenericEntry(Acquisition.Implicit): ...@@ -154,14 +154,14 @@ class GenericEntry(Acquisition.Implicit):
### a .set calls this directly, while in the TransactionalModel this ### a .set calls this directly, while in the TransactionalModel this
### gets called by the Transaction system at commit time. ### gets called by the Transaction system at commit time.
def _modify(self): def _modify(self):
modlist = [] modlist = []
for attribute, values in self._data.items(): for attribute, values in self._data.items():
modlist.append((ldap.MOD_REPLACE, attribute, values)) modlist.append((ldap.MOD_REPLACE, attribute, values))
for attribute in self._mod_delete: for attribute in self._mod_delete:
modlist.append((ldap.MOD_DELETE, attribute, None)) modlist.append((ldap.MOD_DELETE, attribute, None))
self._connection()._modifyEntry(self.dn, modlist) self._connection()._modifyEntry(self.dn, modlist)
self._mod_delete=[] self._mod_delete=[]
self.__subentries={} self.__subentries={}
...@@ -422,8 +422,8 @@ class ZopeEntry(OFS.SimpleItem.Item): ...@@ -422,8 +422,8 @@ class ZopeEntry(OFS.SimpleItem.Item):
#### Initialazation Routines ############## #### Initialazation Routines ##############
manage_options=( manage_options=(
{'label':'Attributes','action':'manage_attributes'}, {'label':'Attributes','action':'manage_attributes'},
) )
__ac_permissions__=( __ac_permissions__=(
('Access contents information', ('manage_attributes',), ('Access contents information', ('manage_attributes',),
...@@ -445,7 +445,7 @@ class ZopeEntry(OFS.SimpleItem.Item): ...@@ -445,7 +445,7 @@ class ZopeEntry(OFS.SimpleItem.Item):
#### Entry & Attribute Access Machinery ##################### #### Entry & Attribute Access Machinery #####################
def attributesMap(self): def attributesMap(self):
return self._data.items() return self._data.items()
def __bobo_traverse__(self, REQUEST, key): def __bobo_traverse__(self, REQUEST, key):
' allow traversal to subentries ' ' allow traversal to subentries '
...@@ -456,14 +456,14 @@ class ZopeEntry(OFS.SimpleItem.Item): ...@@ -456,14 +456,14 @@ class ZopeEntry(OFS.SimpleItem.Item):
###### Tree Machinery ###### ###### Tree Machinery ######
def tpValues(self): def tpValues(self):
return self._subentries().values() return self._subentries().values()
def tpId(self): def tpId(self):
return self.id return self.id
def tpURL(self): def tpURL(self):
"""Return string to be used as URL relative to parent.""" """Return string to be used as URL relative to parent."""
return urllib.quote(self.id) return urllib.quote(self.id)
### Object Manager-ish Machinery ### Object Manager-ish Machinery
def objectValues(self): def objectValues(self):
...@@ -478,22 +478,22 @@ class ZopeEntry(OFS.SimpleItem.Item): ...@@ -478,22 +478,22 @@ class ZopeEntry(OFS.SimpleItem.Item):
### Zope management stuff ### Zope management stuff
def manage_deleteEntry(self, ids, REQUEST=None): def manage_deleteEntry(self, ids, REQUEST=None):
'''Delete marked Entries and all their sub-entries.''' '''Delete marked Entries and all their sub-entries.'''
for rdn in ids: for rdn in ids:
self._delete_dn(rdn) self._delete_dn(rdn)
if REQUEST is not None: if REQUEST is not None:
return self.manage_contents(self, REQUEST) return self.manage_contents(self, REQUEST)
def manage_newEntry(self, rdn, REQUEST=None): def manage_newEntry(self, rdn, REQUEST=None):
'''Add a new entry''' '''Add a new entry'''
e = self.addSubentry(rdn) e = self.addSubentry(rdn)
if REQUEST is not None: if REQUEST is not None:
return self.manage_contents(self, REQUEST) return self.manage_contents(self, REQUEST)
else: else:
return e return e
...@@ -504,19 +504,19 @@ class ZopeEntry(OFS.SimpleItem.Item): ...@@ -504,19 +504,19 @@ class ZopeEntry(OFS.SimpleItem.Item):
return e # return the new entry return e # return the new entry
def manage_addAttribute(self, id, values, REQUEST=None): def manage_addAttribute(self, id, values, REQUEST=None):
'''Add an attribute to an LDAP entry''' '''Add an attribute to an LDAP entry'''
self.set(id, values) self.set(id, values)
if REQUEST is not None: if REQUEST is not None:
return self.manage_attributes(self, REQUEST) return self.manage_attributes(self, REQUEST)
def manage_editAttributes(self, REQUEST): def manage_editAttributes(self, REQUEST):
"""Edit entry's attributes via the web.""" """Edit entry's attributes via the web."""
for attribute in self._data.keys(): for attribute in self._data.keys():
values = REQUEST.get(attribute, []) values = REQUEST.get(attribute, [])
values = filter(isNotBlank, values) #strip out blanks values = filter(isNotBlank, values) #strip out blanks
self.set(attribute, values) self.set(attribute, values)
......
...@@ -193,6 +193,6 @@ misc_={'conn': ImageFile( ...@@ -193,6 +193,6 @@ misc_={'conn': ImageFile(
os.path.join(SHARED_DC_ZRDB_LOCATION,'www','DBAdapterFolder_icon.gif'))} os.path.join(SHARED_DC_ZRDB_LOCATION,'www','DBAdapterFolder_icon.gif'))}
for icon in ('table', 'view', 'stable', 'what', for icon in ('table', 'view', 'stable', 'what',
'field', 'text','bin','int','float', 'field', 'text','bin','int','float',
'date','time','datetime'): 'date','time','datetime'):
misc_[icon]=ImageFile(os.path.join('icons','%s.gif') % icon, globals()) misc_[icon]=ImageFile(os.path.join('icons','%s.gif') % icon, globals())
...@@ -94,8 +94,8 @@ MySQLdb_version_required = (0,9,2) ...@@ -94,8 +94,8 @@ MySQLdb_version_required = (0,9,2)
_v = getattr(_mysql, 'version_info', (0,0,0)) _v = getattr(_mysql, 'version_info', (0,0,0))
if _v < MySQLdb_version_required: if _v < MySQLdb_version_required:
raise NotSupportedError, \ raise NotSupportedError, \
"ZMySQLDA requires at least MySQLdb %s, %s found" % \ "ZMySQLDA requires at least MySQLdb %s, %s found" % \
(MySQLdb_version_required, _v) (MySQLdb_version_required, _v)
from MySQLdb.converters import conversions from MySQLdb.converters import conversions
from MySQLdb.constants import FIELD_TYPE, CR, ER, CLIENT from MySQLdb.constants import FIELD_TYPE, CR, ER, CLIENT
...@@ -152,11 +152,11 @@ type_xlate = { ...@@ -152,11 +152,11 @@ type_xlate = {
} }
def _mysql_timestamp_converter(s): def _mysql_timestamp_converter(s):
if len(s) < 14: if len(s) < 14:
s = s + "0"*(14-len(s)) s = s + "0"*(14-len(s))
parts = map(int, (s[:4],s[4:6],s[6:8], parts = map(int, (s[:4],s[4:6],s[6:8],
s[8:10],s[10:12],s[12:14])) s[8:10],s[10:12],s[12:14]))
return DateTime("%04d-%02d-%02d %02d:%02d:%02d" % tuple(parts)) return DateTime("%04d-%02d-%02d %02d:%02d:%02d" % tuple(parts))
def DateTime_or_None(s): def DateTime_or_None(s):
try: return DateTime('%s UTC' % s) try: return DateTime('%s UTC' % s)
......
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