Commit 9ae79eac authored by Arnaud Fontaine's avatar Arnaud Fontaine

Remove unused code.

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