Commit 12825127 authored by Arnaud Fontaine's avatar Arnaud Fontaine

Remove unused code.

parent 3e1773fa
...@@ -360,21 +360,8 @@ def test_suite(): ...@@ -360,21 +360,8 @@ def test_suite():
testTimezoneNaiveHandling = unittest.expectedFailure( testTimezoneNaiveHandling = unittest.expectedFailure(
test_datetime.DateTimeTests.testTimezoneNaiveHandling) test_datetime.DateTimeTests.testTimezoneNaiveHandling)
# This test is only in DateTime >= 3 test_intl_format_hyphen = unittest.expectedFailure(
if hasattr(test_datetime.DateTimeTests, 'test_intl_format_hyphen'): test_datetime.DateTimeTests.test_intl_format_hyphen)
test_intl_format_hyphen = unittest.expectedFailure(
test_datetime.DateTimeTests.test_intl_format_hyphen)
# These 3 tests are only in DateTime 2
if hasattr(test_datetime.DateTimeTests, 'test_pickle_new_with_micros'):
test_pickle_new_with_micros = unittest.expectedFailure(
test_datetime.DateTimeTests.test_pickle_new_with_micros)
if hasattr(test_datetime.DateTimeTests, 'test_pickle_new_with_tz'):
test_pickle_new_with_tz = unittest.expectedFailure(
test_datetime.DateTimeTests.test_pickle_new_with_tz)
if hasattr(test_datetime.DateTimeTests, 'testLegacyTimezones'):
testLegacyTimezones = unittest.expectedFailure(
test_datetime.DateTimeTests.testLegacyTimezones)
suite.addTest(unittest.makeSuite(DateTimeTests)) suite.addTest(unittest.makeSuite(DateTimeTests))
......
...@@ -48,7 +48,7 @@ from AccessControl import Unauthorized ...@@ -48,7 +48,7 @@ from AccessControl import Unauthorized
from AccessControl.ZopeGuards import guarded_getattr, guarded_hasattr from AccessControl.ZopeGuards import guarded_getattr, guarded_hasattr
from Products.ERP5Type.tests.utils import createZODBPythonScript from Products.ERP5Type.tests.utils import createZODBPythonScript
from Products.ERP5Type.tests.utils import removeZODBPythonScript from Products.ERP5Type.tests.utils import removeZODBPythonScript
from Products.ERP5Type import IS_ZOPE2, Permissions from Products.ERP5Type import Permissions
from DateTime import DateTime from DateTime import DateTime
class PropertySheetTestCase(ERP5TypeTestCase): class PropertySheetTestCase(ERP5TypeTestCase):
...@@ -3310,39 +3310,9 @@ def test_suite(): ...@@ -3310,39 +3310,9 @@ def test_suite():
add_tests(suite, ZPublisher.tests.testHTTPRangeSupport) add_tests(suite, ZPublisher.tests.testHTTPRangeSupport)
import ZPublisher.tests.testHTTPRequest import ZPublisher.tests.testHTTPRequest
if IS_ZOPE2: # BBB Zope2
# ERP5 processes requests as utf-8 by default, but we adjust this test assuming that
# default is iso-8859-15
def forceISO885915DefaultRequestCharset(method):
def wrapped(self):
from ZPublisher import HTTPRequest as module
old_encoding = module.default_encoding
module.default_encoding = 'iso-8859-15'
try:
return method(self)
finally:
module.default_encoding = old_encoding
return wrapped
HTTPRequestTests = ZPublisher.tests.testHTTPRequest.HTTPRequestTests
for e in dir(HTTPRequestTests):
if e.startswith('test_'):
setattr(HTTPRequestTests, e, forceISO885915DefaultRequestCharset(getattr(HTTPRequestTests, e)))
add_tests(suite, ZPublisher.tests.testHTTPRequest) add_tests(suite, ZPublisher.tests.testHTTPRequest)
import ZPublisher.tests.testHTTPResponse import ZPublisher.tests.testHTTPResponse
if IS_ZOPE2: # BBB Zope2
# ERP5 forces utf-8 responses by default, but we adjust these tests so that they run
# with iso-8859-15 as default response charset
def forceISO885915DefaultResponseCharset(method):
def wrapped(self):
# here we can use this utility method which clean up at teardown
self._setDefaultEncoding('iso-8859-15')
return method(self)
return wrapped
HTTPResponseTests = ZPublisher.tests.testHTTPResponse.HTTPResponseTests
for e in dir(HTTPResponseTests):
if e.startswith('test_'):
setattr(HTTPResponseTests, e, forceISO885915DefaultResponseCharset(getattr(HTTPResponseTests, e)))
add_tests(suite, ZPublisher.tests.testHTTPResponse) add_tests(suite, ZPublisher.tests.testHTTPResponse)
import ZPublisher.tests.testIterators import ZPublisher.tests.testIterators
...@@ -3351,42 +3321,27 @@ def test_suite(): ...@@ -3351,42 +3321,27 @@ def test_suite():
import ZPublisher.tests.testPostTraversal import ZPublisher.tests.testPostTraversal
add_tests(suite, ZPublisher.tests.testPostTraversal) add_tests(suite, ZPublisher.tests.testPostTraversal)
if IS_ZOPE2: # BBB Zope2
import ZPublisher.tests.testPublish # pylint:disable=no-name-in-module,import-error
add_tests(suite, ZPublisher.tests.testPublish)
import ZPublisher.tests.test_Converters import ZPublisher.tests.test_Converters
add_tests(suite, ZPublisher.tests.test_Converters) add_tests(suite, ZPublisher.tests.test_Converters)
if IS_ZOPE2: # BBB Zope2 import ZPublisher.tests.test_WSGIPublisher
# XXX don't run test_WSGIPublisher for now because too many failures # TestLoadApp tests are confused because running as a live test interfere with
pass # transaction system. Aborting the transaction at beginning of test seems OK.
else: TestLoadApp_setUp = ZPublisher.tests.test_WSGIPublisher.TestLoadApp.setUp
import ZPublisher.tests.test_WSGIPublisher def setUp(self):
# TestLoadApp tests are confused because running as a live test interfere with TestLoadApp_setUp(self)
# transaction system. Aborting the transaction at beginning of test seems OK. transaction.abort()
TestLoadApp_setUp = ZPublisher.tests.test_WSGIPublisher.TestLoadApp.setUp ZPublisher.tests.test_WSGIPublisher.TestLoadApp.setUp = setUp
def setUp(self): add_tests(suite, ZPublisher.tests.test_WSGIPublisher)
TestLoadApp_setUp(self)
transaction.abort()
ZPublisher.tests.test_WSGIPublisher.TestLoadApp.setUp = setUp
add_tests(suite, ZPublisher.tests.test_WSGIPublisher)
import ZPublisher.tests.test_mapply import ZPublisher.tests.test_mapply
add_tests(suite, ZPublisher.tests.test_mapply) add_tests(suite, ZPublisher.tests.test_mapply)
if IS_ZOPE2: # BBB Zope2 import ZPublisher.tests.test_pubevents
import ZPublisher.tests.testpubevents # pylint:disable=no-name-in-module,import-error add_tests(suite, ZPublisher.tests.test_pubevents)
add_tests(suite, ZPublisher.tests.testpubevents)
else: import ZPublisher.tests.test_utils
import ZPublisher.tests.test_pubevents add_tests(suite, ZPublisher.tests.test_utils)
add_tests(suite, ZPublisher.tests.test_pubevents)
if IS_ZOPE2: # BBB Zope2
pass
else:
import ZPublisher.tests.test_utils
add_tests(suite, ZPublisher.tests.test_utils)
import ZPublisher.tests.test_xmlrpc import ZPublisher.tests.test_xmlrpc
add_tests(suite, ZPublisher.tests.test_xmlrpc) add_tests(suite, ZPublisher.tests.test_xmlrpc)
......
...@@ -71,24 +71,8 @@ if portal_type == 'Web Page': ...@@ -71,24 +71,8 @@ if portal_type == 'Web Page':
if portal_type == 'Web Section': if portal_type == 'Web Section':
websection = context websection = context
return generateOpenGraphParamaters(websection) return generateOpenGraphParamaters(websection)
"""
default_document = websection.getDefaultDocumentValue()
if default_document is not None:
return generateOpenGraphParamaters(default_document, True)
else:
return generateOpenGraphParamaters(websection)
"""
if portal_type == 'Web Site': if portal_type == 'Web Site':
return generateOpenGraphParamaters(website) return generateOpenGraphParamaters(website)
"""
default_document = website.getDefaultDocumentValue()
if default_document is not None:
return generateOpenGraphParamaters(default_document, True)
else:
return generateOpenGraphParamaters(website)
"""
return '' return ''
...@@ -111,36 +111,17 @@ class CrmTestCase(ERP5ReportTestCase): ...@@ -111,36 +111,17 @@ class CrmTestCase(ERP5ReportTestCase):
if simulation_state == 'assigned': if simulation_state == 'assigned':
raise NotImplementedError('%r state only exists in the old event workflow.' % simulation_state) raise NotImplementedError('%r state only exists in the old event workflow.' % simulation_state)
"""
ticket=self.portal.restrictedTraverse(ev.getFollowUp())
self._doWorkflowAction(ev,'assign_action',
follow_up_ticket_type = ticket.getPortalType(),
follow_up_ticket_title = ticket.getTitle())
"""
elif simulation_state == 'planned': elif simulation_state == 'planned':
ev.plan() ev.plan()
elif simulation_state == 'posted': elif simulation_state == 'posted':
raise NotImplementedError('%r state only exists in the old event workflow.' % simulation_state) raise NotImplementedError('%r state only exists in the old event workflow.' % simulation_state)
"""
ev.start()
"""
elif simulation_state == 'delivered': elif simulation_state == 'delivered':
ev.start() ev.start()
ev.deliver() ev.deliver()
elif simulation_state == 'new': elif simulation_state == 'new':
raise NotImplementedError('%r state only exists in the old event workflow.' % simulation_state) raise NotImplementedError('%r state only exists in the old event workflow.' % simulation_state)
"""
ev.receive()
"""
elif simulation_state == 'acknowledged': elif simulation_state == 'acknowledged':
raise NotImplementedError('%r state only exists in the old event workflow.' % simulation_state) raise NotImplementedError('%r state only exists in the old event workflow.' % simulation_state)
"""
ticket=self.portal.restrictedTraverse(ev.getFollowUp())
self._doWorkflowAction(ev,'assign_action',
follow_up_ticket_type = ticket.getPortalType(),
follow_up_ticket_title = ticket.getTitle())
self._doWorkflowAction(ev, 'acknowledge_action')
"""
elif simulation_state == 'cancelled': elif simulation_state == 'cancelled':
ev.stop() ev.stop()
ev.cancel() ev.cancel()
...@@ -148,24 +129,12 @@ class CrmTestCase(ERP5ReportTestCase): ...@@ -148,24 +129,12 @@ class CrmTestCase(ERP5ReportTestCase):
ev.delete() ev.delete()
elif simulation_state == 'expired': elif simulation_state == 'expired':
raise NotImplementedError('%r state only exists in the old event workflow.' % simulation_state) raise NotImplementedError('%r state only exists in the old event workflow.' % simulation_state)
"""
ev.receive()
ev.expire()
"""
elif simulation_state == 'responded': elif simulation_state == 'responded':
raise NotImplementedError('%r state only exists in the old event workflow.' % simulation_state) raise NotImplementedError('%r state only exists in the old event workflow.' % simulation_state)
"""
ev.receive()
ev.respond()
"""
elif simulation_state == 'started': elif simulation_state == 'started':
ev.start() ev.start()
elif simulation_state == 'ordered': elif simulation_state == 'ordered':
raise NotImplementedError('%r state only exists in the old event workflow.' % simulation_state) raise NotImplementedError('%r state only exists in the old event workflow.' % simulation_state)
"""
ev.plan()
ev.order()
"""
elif simulation_state == 'stopped': elif simulation_state == 'stopped':
ev.stop() ev.stop()
# sanity check # sanity check
......
...@@ -653,12 +653,8 @@ class TestDocument(TestDocumentMixin): ...@@ -653,12 +653,8 @@ class TestDocument(TestDocumentMixin):
self.assertEqual('attachment; filename="import.file.with.dot.in.filename.pdf"', self.assertEqual('attachment; filename="import.file.with.dot.in.filename.pdf"',
response.getHeader('content-disposition')) response.getHeader('content-disposition'))
response_body = response.getBody() response_body = response.getBody()
conversion = str(doc.convert('pdf')[1]) conversion = doc.convert('pdf')[1]
diff = '\n'+'\n'.join(difflib.unified_diff(response_body.splitlines(), self.assertEqual(response_body, conversion)
conversion.splitlines(),
fromfile='first_call.pdf',
tofile='second_call.pdf'))
self.assertEqual(response_body, conversion, diff)
# test Print icon works on OOoDocument # test Print icon works on OOoDocument
response = self.publish('%s/OOoDocument_print' % doc.getPath()) response = self.publish('%s/OOoDocument_print' % doc.getPath())
......
# TODO: this module is not tested and has not been ported to python3, it's not
# clear if this is still useful so disable pylint errors:
#
# pylint:disable=import-error
import compiler import compiler
import compiler.ast import compiler.ast
import compiler.visitor import compiler.visitor
......
...@@ -362,7 +362,6 @@ class Git(WorkingCopy): ...@@ -362,7 +362,6 @@ class Git(WorkingCopy):
raise raise
# try to update our working copy # try to update our working copy
# TODO: find a solution if there are other local changes # TODO: find a solution if there are other local changes
# TODO: solve conflicts on */bt/revision automatically
try: try:
self.git(merge, '@{u}', env=env) self.git(merge, '@{u}', env=env)
except GitError as e: except GitError as e:
......
...@@ -29,29 +29,6 @@ def parseTestReport(text): ...@@ -29,29 +29,6 @@ def parseTestReport(text):
row_report["cell_list"].append(column.text) row_report["cell_list"].append(column.text)
i += 1 i += 1
return report return report
"""
title = table.xpath('//td')[0].text
html[0][1].text = title
# Insert completly the first table
html[1].append(table)
# Insert only the content of tbody
for table in table_list[1:]:
for row in table[-1]:
html[1][-1].append(row)
stack = [html[1]]
# Let's display everything in the test by removing the style attributes (they're not supposed to have any style attributes at all during the tests)
while stack:
element = stack.pop()
if element.attrib.has_key('style'):
del element.attrib['style']
for child in element:
stack.append(child)
return dict(title = title, text = lxml.html.tostring(html))
"""
""" """
Return the content of a web page Return the content of a web page
......
...@@ -76,11 +76,10 @@ class SyncMLEngineMixin(object): ...@@ -76,11 +76,10 @@ class SyncMLEngineMixin(object):
status['authentication_type'])) status['authentication_type']))
# XXX Not working To Review ! # XXX Not working To Review !
raise NotImplementedError("Adding credentials") raise NotImplementedError("Adding credentials")
""" # syncml_response = domain.generateBaseResponse()
syncml_response = domain.generateBaseResponse() # syncml_response.addCredentialMessage(domain)
syncml_response.addCredentialMessage(domain) # return syncml_response
return syncml_response
"""
elif status['status_code'] == \ elif status['status_code'] == \
resolveSyncmlStatusCode('invalid_credentials'): resolveSyncmlStatusCode('invalid_credentials'):
syncml_logger.error("\tClient authentication refused") syncml_logger.error("\tClient authentication refused")
......
...@@ -225,41 +225,41 @@ class SyncMLResponse(object): ...@@ -225,41 +225,41 @@ class SyncMLResponse(object):
receiving a challenge message receiving a challenge message
""" """
raise NotImplementedError("To review") raise NotImplementedError("To review")
"""
# create element 'SyncML' with a default namespace # # create element 'SyncML' with a default namespace
xml = E.SyncML() # xml = E.SyncML()
# syncml header # # syncml header
xml.append(self.buildHeader( # xml.append(self.buildHeader(
session_id=subscription.incrementSessionId(), # session_id=subscription.incrementSessionId(),
msg_id=subscription.incrementMessageId(), # msg_id=subscription.incrementMessageId(),
target=subscription.getUrlString(), # target=subscription.getUrlString(),
source=subscription.getSubscriptionUrlString(), # source=subscription.getSubscriptionUrlString(),
user_id=subscription.getUserId(), # user_id=subscription.getUserId(),
password=subscription.getPassword(), # password=subscription.getPassword(),
authentication_format=subscription.getAuthenticationFormat(), # authentication_format=subscription.getAuthenticationFormat(),
authentication_type=subscription.getAuthenticationType())) # authentication_type=subscription.getAuthenticationType()))
#
# Build the message body # # Build the message body
sync_body = E.SyncBody() # sync_body = E.SyncBody()
#
# alert message # # alert message
sync_body.append(self.buildAlertMessage( # sync_body.append(self.buildAlertMessage(
command_id=self._getNextCommandId(), # command_id=self._getNextCommandId(),
alert_code=subscription.getSyncmlAlertCode(), # alert_code=subscription.getSyncmlAlertCode(),
target=subscription.getDestinationReference(), # target=subscription.getDestinationReference(),
source=subscription.getSourceReference(), # source=subscription.getSourceReference(),
last_anchor=subscription.getLastAnchor(), # last_anchor=subscription.getLastAnchor(),
next_anchor=subscription.getNextAnchor())) # next_anchor=subscription.getNextAnchor()))
syncml_put = self.buildPutMessage(subscription) # syncml_put = self.buildPutMessage(subscription)
if syncml_put is not None: # if syncml_put is not None:
sync_body.append(syncml_put) # sync_body.append(syncml_put)
sync_body.append(E.Final()) # sync_body.append(E.Final())
#
xml.append(sync_body) # xml.append(sync_body)
xml_string = etree.tostring(xml, encoding='utf-8', xml_declaration=True, # xml_string = etree.tostring(xml, encoding='utf-8', xml_declaration=True,
pretty_print=True) # pretty_print=True)
self.data_append(xml_string) # self.data_append(xml_string)
"""
def addPutMessage(self,subscription, markup='Put', def addPutMessage(self,subscription, markup='Put',
cmd_ref=None, message_id=None): cmd_ref=None, message_id=None):
...@@ -280,61 +280,59 @@ class SyncMLResponse(object): ...@@ -280,61 +280,59 @@ class SyncMLResponse(object):
Both must be able to handle and process these informations Both must be able to handle and process these informations
""" """
return return
""" # # XXX-Aurel : must be reviewed according to specification
# XXX-Aurel : must be reviewed according to specification # # This part can be skipped for now
# This part can be skipped for now # conduit = subscription.getConduit()
conduit = subscription.getConduit() # xml = None
xml = None # # The conduit defined what capabilities the service offers
# The conduit defined what capabilities the service offers # if getattr(conduit, 'getCapabilitiesCTTypeList', None) and \
if getattr(conduit, 'getCapabilitiesCTTypeList', None) and \ # getattr(conduit, 'getCapabilitiesVerCTList', None) and \
getattr(conduit, 'getCapabilitiesVerCTList', None) and \ # getattr(conduit, 'getPreferedCapabilitieVerCT', None):
getattr(conduit, 'getPreferedCapabilitieVerCT', None): # xml = Element('{%s}%s' % (SYNCML_NAMESPACE, markup))
xml = Element('{%s}%s' % (SYNCML_NAMESPACE, markup)) # xml.append(E.CmdID(self._getNextCommandId()))
xml.append(E.CmdID(self._getNextCommandId())) # if message_id:
if message_id: # xml.append(E.MsgRef('%s' % message_id))
xml.append(E.MsgRef('%s' % message_id)) # if cmd_ref:
if cmd_ref: # xml.append(E.CmdRef('%s' % cmd_ref))
xml.append(E.CmdRef('%s' % cmd_ref)) # xml.extend((E.Meta(E.Type('application/vnd.syncml-devinf+xml')),
xml.extend((E.Meta(E.Type('application/vnd.syncml-devinf+xml')), # E.Item(E.Source(E.LocURI('./devinf12')),
E.Item(E.Source(E.LocURI('./devinf12')), # E.Data(E.DevInf(E.VerDTD('1.2'),
E.Data(E.DevInf(E.VerDTD('1.2'), # E.Man('Nexedi'),
E.Man('Nexedi'), # E.Mod('ERP5SyncML'),
E.Mod('ERP5SyncML'), # E.OEM('Open Source'),
E.OEM('Open Source'), # E.SwV('0.1'),
E.SwV('0.1'), # E.DevID(subscription.getSubscriptionUrlString()),
E.DevID(subscription.getSubscriptionUrlString()), # E.DevTyp('workstation'),
E.DevTyp('workstation'), # E.UTC(),
E.UTC(), # E.DataStore(E.SourceRef(subscription.getSourceReference()))
E.DataStore(E.SourceRef(subscription.getSourceReference())) # )
) # )
) # )))
))) # data_store = xml.find('{%(ns)s}Item/{%(ns)s}Data/{%(ns)s}DevInf/{%(ns)s}DataStore' % {'ns': SYNCML_NAMESPACE})
data_store = xml.find('{%(ns)s}Item/{%(ns)s}Data/{%(ns)s}DevInf/{%(ns)s}DataStore' % {'ns': SYNCML_NAMESPACE}) # tx_element_list = []
tx_element_list = [] # rx_element_list = []
rx_element_list = [] # for cttype in conduit.getCapabilitiesCTTypeList():
for cttype in conduit.getCapabilitiesCTTypeList(): # if cttype != 'text/xml':
if cttype != 'text/xml': # for x_version in conduit.getCapabilitiesVerCTList(cttype):
for x_version in conduit.getCapabilitiesVerCTList(cttype): # rx_element_list.append(E.Rx(E.CTType(cttype), E.VerCT(x_version)))
rx_element_list.append(E.Rx(E.CTType(cttype), E.VerCT(x_version))) # tx_element_list.append(E.Tx(E.CTType(cttype), E.VerCT(x_version)))
tx_element_list.append(E.Tx(E.CTType(cttype), E.VerCT(x_version))) # rx_pref = Element('{%s}Rx-Pref' % SYNCML_NAMESPACE)
rx_pref = Element('{%s}Rx-Pref' % SYNCML_NAMESPACE) # rx_pref.extend((E.CTType(conduit.getPreferedCapabilitieCTType()),
rx_pref.extend((E.CTType(conduit.getPreferedCapabilitieCTType()), # E.VerCT(conduit.getPreferedCapabilitieVerCT())))
E.VerCT(conduit.getPreferedCapabilitieVerCT()))) # data_store.append(rx_pref)
data_store.append(rx_pref) # data_store.extend(rx_element_list)
data_store.extend(rx_element_list) # tx_pref = Element('{%s}Tx-Pref' % SYNCML_NAMESPACE)
tx_pref = Element('{%s}Tx-Pref' % SYNCML_NAMESPACE) # tx_pref.extend((E.CTType(conduit.getPreferedCapabilitieCTType()),
tx_pref.extend((E.CTType(conduit.getPreferedCapabilitieCTType()), # E.VerCT(conduit.getPreferedCapabilitieVerCT())))
E.VerCT(conduit.getPreferedCapabilitieVerCT()))) # data_store.append(tx_pref)
data_store.append(tx_pref) # data_store.extend(tx_element_list)
data_store.extend(tx_element_list) # data_store.append(E.SyncCap(
data_store.append(E.SyncCap( # E.SyncType('2'),
E.SyncType('2'), # E.SyncType('1'),
E.SyncType('1'), # E.SyncType('4'),
E.SyncType('4'), # E.SyncType('6')
E.SyncType('6') # ))
)) # self.data_append(xml)
self.data_append(xml)
"""
def addSyncCommand(self, sync_command, gid, data, media_type, more_data): def addSyncCommand(self, sync_command, gid, data, media_type, more_data):
......
...@@ -23,8 +23,6 @@ class TransformHtmlToPdf(DocumentConversionServerTransform): ...@@ -23,8 +23,6 @@ class TransformHtmlToPdf(DocumentConversionServerTransform):
# wkhtmltopdf handler currently requires conversion_kw (hack in convertFile())... # wkhtmltopdf handler currently requires conversion_kw (hack in convertFile())...
if 'conversion_kw' not in kwargs: if 'conversion_kw' not in kwargs:
kwargs['conversion_kw'] = {'encoding': 'utf-8'} kwargs['conversion_kw'] = {'encoding': 'utf-8'}
# raise RuntimeError
return DocumentConversionServerTransform.convert(self, *args, **kwargs) return DocumentConversionServerTransform.convert(self, *args, **kwargs)
def register(): def register():
......
...@@ -80,43 +80,41 @@ class Order(Delivery): ...@@ -80,43 +80,41 @@ class Order(Delivery):
# Call getAggregatedAmountList and sum all the amounts which # Call getAggregatedAmountList and sum all the amounts which
# base_contribution category is matched with. # base_contribution category is matched with.
raise NotImplementedError raise NotImplementedError
""" # rounding = kw.get('rounding')
rounding = kw.get('rounding') # from Products.ERP5.PropertySheet.TradeModelLine import TARGET_LEVEL_MOVEMENT
from Products.ERP5.PropertySheet.TradeModelLine import TARGET_LEVEL_MOVEMENT # trade_condition = self.getSpecialiseValue()
trade_condition = self.getSpecialiseValue() # if trade_condition is None:
if trade_condition is None: # # We cannot find any amount so that the result is 0.
# We cannot find any amount so that the result is 0. # return 0
return 0 # base_contribution = kw.get('base_contribution')
base_contribution = kw.get('base_contribution') # if isinstance(base_contribution, (tuple, list)):
if isinstance(base_contribution, (tuple, list)): # base_contribution_list = base_contribution
base_contribution_list = base_contribution # else:
else: # base_contribution_list = (base_contribution,)
base_contribution_list = (base_contribution,) # base_contribution_value_list = []
base_contribution_value_list = [] # portal_categories = self.portal_categories
portal_categories = self.portal_categories # for relative_url in base_contribution_list:
for relative_url in base_contribution_list: # base_contribution_value = portal_categories.getCategoryValue(relative_url)
base_contribution_value = portal_categories.getCategoryValue(relative_url) # if base_contribution_value is not None:
if base_contribution_value is not None: # base_contribution_value_list.append(base_contribution_value)
base_contribution_value_list.append(base_contribution_value) # if not base_contribution_value_list:
if not base_contribution_value_list: # # We cannot find any amount so that the result is 0.
# We cannot find any amount so that the result is 0. # return 0
return 0 # current_aggregated_amount_list = trade_condition.getAggregatedAmountList(self, rounding=rounding, force_create_line=True)
current_aggregated_amount_list = trade_condition.getAggregatedAmountList(self, rounding=rounding, force_create_line=True) # trade_model_line = self.newContent(temp_object=True,
trade_model_line = self.newContent(temp_object=True, # portal_type='Trade Model Line',
portal_type='Trade Model Line', # id='_temp_' + self.getId(), notify_workflow=False)
id='_temp_' + self.getId(), notify_workflow=False) # # prevent invoking interaction workflows.
# prevent invoking interaction workflows. # trade_model_line.portal_type = ''
trade_model_line.portal_type = '' # trade_model_line.edit(target_level=TARGET_LEVEL_MOVEMENT, price=1,
trade_model_line.edit(target_level=TARGET_LEVEL_MOVEMENT, price=1, # efficiency=1, quantity=None,
efficiency=1, quantity=None, # base_application_value_list=base_contribution_value_list)
base_application_value_list=base_contribution_value_list) # aggregated_amount_list = trade_model_line._getAggregatedAmountList(
aggregated_amount_list = trade_model_line._getAggregatedAmountList( # self,
self, # movement_list=self.getMovementList(),
movement_list=self.getMovementList(), # current_aggregated_amount_list=current_aggregated_amount_list,
current_aggregated_amount_list=current_aggregated_amount_list, # rounding=rounding)
rounding=rounding) # return aggregated_amount_list.getTotalPrice()
return aggregated_amount_list.getTotalPrice()
"""
def getTotalQuantity(self, **kw) : def getTotalQuantity(self, **kw) :
"""Returns the total quantity for this Order. """ """Returns the total quantity for this Order. """
......
...@@ -891,14 +891,6 @@ class ODFStrategy(Implicit): ...@@ -891,14 +891,6 @@ class ODFStrategy(Implicit):
column_span_list.append(column_span) column_span_list.append(column_span)
return column_span_list return column_span_list
def _toUnicodeString(self, field_value = None):
value = ''
if isinstance(field_value, six.text_type):
value = field_value
elif field_value is not None:
value = unicode(str(field_value), 'utf-8')
return value
class ODTStrategy(ODFStrategy): class ODTStrategy(ODFStrategy):
"""ODTStrategy create a ODT Document from a form and a ODT template""" """ODTStrategy create a ODT Document from a form and a ODT template"""
......
...@@ -161,7 +161,6 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin): ...@@ -161,7 +161,6 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
# 2. Normal case: change the field value and check again the ODF document # 2. Normal case: change the field value and check again the ODF document
test1.setTitle("Changed Title!") test1.setTitle("Changed Title!")
#foo_form.my_title.set_value('default', "Changed Title!")
odf_document = foo_printout.index_html(request) odf_document = foo_printout.index_html(request)
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
...@@ -412,7 +411,6 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin): ...@@ -412,7 +411,6 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
# 2. Normal case: change the field value and check again the ODF document # 2. Normal case: change the field value and check again the ODF document
test1.setTitle("Changed Title!") test1.setTitle("Changed Title!")
#foo_form.my_title.set_value('default', "Changed Title!")
odf_document = foo_printout.index_html(request) odf_document = foo_printout.index_html(request)
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
......
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