Commit 3fe636d2 authored by Arnaud Fontaine's avatar Arnaud Fontaine

Remove unused code.

parent 5155fe46
......@@ -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 ''
......@@ -148,24 +148,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
......
......@@ -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):
......
......@@ -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"""
......
......@@ -92,10 +92,6 @@ from Products.ERP5Type.patches import OFSFile
from Products.ERP5Type.patches import ZSQLMethod
from Products.ERP5Type.patches import MimetypesRegistry
from Products.ERP5Type.patches import users
if IS_ZOPE2: # BBB Zope2
from Products.ERP5Type.patches import Publish
from Products.ERP5Type.patches import SharedDCScriptsBindings
from Products.ERP5Type.patches import ZPublisherBeforeTraverse
from Products.ERP5Type.patches import WSGITask
if six.PY2:
# XXX-zope4py3: urllib2 removed (see future/backports/urllib/request.py)
......
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