Commit 28a487f7 authored by Arnaud Fontaine's avatar Arnaud Fontaine

Cosmetic changes and remove unused imports.

parent 955ac6d3
...@@ -429,7 +429,7 @@ class BalanceTransaction(AccountingTransaction, Inventory): ...@@ -429,7 +429,7 @@ class BalanceTransaction(AccountingTransaction, Inventory):
return factory return factory
def _immediateReindexObject(self, **kw): def _immediateReindexObject(self, *args, **kw):
"""Reindexes the object. """Reindexes the object.
This is different indexing that the default Inventory indexing, because This is different indexing that the default Inventory indexing, because
we want to take into account that lines in this balance transaction to we want to take into account that lines in this balance transaction to
......
...@@ -26,7 +26,7 @@ section_region = section.getRegion() ...@@ -26,7 +26,7 @@ section_region = section.getRegion()
ledger = request.get("ledger", None) ledger = request.get("ledger", None)
if ledger is not None: if ledger is not None:
portal_categories = context.getPortalObject().portal_categories portal_categories = context.getPortalObject().portal_categories
if isinstance(ledger, list) or isinstance(ledger, tuple): if isinstance(ledger, (tuple, list)):
ledger_uid = [portal_categories.ledger.restrictedTraverse(item).getUid() for item in ledger] ledger_uid = [portal_categories.ledger.restrictedTraverse(item).getUid() for item in ledger]
else: else:
ledger_uid = portal_categories.ledger.restrictedTraverse(ledger).getUid() ledger_uid = portal_categories.ledger.restrictedTraverse(ledger).getUid()
......
...@@ -23,7 +23,7 @@ kw['where_expression'] = " section.portal_type = 'Organisation' " ...@@ -23,7 +23,7 @@ kw['where_expression'] = " section.portal_type = 'Organisation' "
ledger = kw.get('ledger', request.get("ledger", None)) ledger = kw.get('ledger', request.get("ledger", None))
if ledger is not None: if ledger is not None:
portal_categories = context.getPortalObject().portal_categories portal_categories = context.getPortalObject().portal_categories
if isinstance(ledger, list) or isinstance(ledger, tuple): if isinstance(ledger, (tuple, list)):
kw['ledger_uid'] = [portal_categories.ledger.restrictedTraverse(item).getUid() for item in ledger] kw['ledger_uid'] = [portal_categories.ledger.restrictedTraverse(item).getUid() for item in ledger]
else: else:
kw['ledger_uid'] = portal_categories.ledger.restrictedTraverse(ledger).getUid() kw['ledger_uid'] = portal_categories.ledger.restrictedTraverse(ledger).getUid()
......
...@@ -22,7 +22,7 @@ kw['where_expression'] = " section.portal_type = 'Organisation' " ...@@ -22,7 +22,7 @@ kw['where_expression'] = " section.portal_type = 'Organisation' "
ledger = kwd.get('ledger', request.get("ledger", None)) ledger = kwd.get('ledger', request.get("ledger", None))
if ledger is not None: if ledger is not None:
portal_categories = context.getPortalObject().portal_categories portal_categories = context.getPortalObject().portal_categories
if isinstance(ledger, list) or isinstance(ledger, tuple): if isinstance(ledger, (tuple, list)):
kw['ledger_uid'] = [portal_categories.ledger.restrictedTraverse(item).getUid() for item in ledger] kw['ledger_uid'] = [portal_categories.ledger.restrictedTraverse(item).getUid() for item in ledger]
else: else:
kw['ledger_uid'] = portal_categories.ledger.restrictedTraverse(ledger).getUid() kw['ledger_uid'] = portal_categories.ledger.restrictedTraverse(ledger).getUid()
......
...@@ -27,7 +27,7 @@ kw['where_expression'] = " section.portal_type = 'Organisation' " ...@@ -27,7 +27,7 @@ kw['where_expression'] = " section.portal_type = 'Organisation' "
ledger = kwd.get('ledger', request.get("ledger", None)) ledger = kwd.get('ledger', request.get("ledger", None))
if ledger is not None: if ledger is not None:
portal_categories = context.getPortalObject().portal_categories portal_categories = context.getPortalObject().portal_categories
if isinstance(ledger, list) or isinstance(ledger, tuple): if isinstance(ledger, (tuple, list)):
kw['ledger_uid'] = [portal_categories.ledger.restrictedTraverse(item).getUid() for item in ledger] kw['ledger_uid'] = [portal_categories.ledger.restrictedTraverse(item).getUid() for item in ledger]
else: else:
kw['ledger_uid'] = portal_categories.ledger.restrictedTraverse(ledger).getUid() kw['ledger_uid'] = portal_categories.ledger.restrictedTraverse(ledger).getUid()
...@@ -47,7 +47,7 @@ accounts_to_expand_by_tp = rec_cat.getAccountTypeRelatedValueList(**params) + \ ...@@ -47,7 +47,7 @@ accounts_to_expand_by_tp = rec_cat.getAccountTypeRelatedValueList(**params) + \
total_balance = 0.0 total_balance = 0.0
for account_gap_number in accounts: for account_gap_number in accounts:
# We get all acounts strict member of this GAP category # We get all accounts strict member of this GAP category
gap = context.restrictedTraverse('portal_categories/' + getURL(account_gap_number)) gap = context.restrictedTraverse('portal_categories/' + getURL(account_gap_number))
for account in gap.getGapRelatedValueList(portal_type='Account'): for account in gap.getGapRelatedValueList(portal_type='Account'):
......
############################################################################## ##############################################################################
# coding: utf-8
# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved. # Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
# Rafael Monnerat <rafael@nexedi.com> # Rafael Monnerat <rafael@nexedi.com>
# Ivan Tyagov <ivan@nexedi.com> # Ivan Tyagov <ivan@nexedi.com>
......
...@@ -865,7 +865,7 @@ class TestTemplateTool(ERP5TypeTestCase): ...@@ -865,7 +865,7 @@ class TestTemplateTool(ERP5TypeTestCase):
erp5_test = self.portal.portal_skins['erp5_test'] erp5_test = self.portal.portal_skins['erp5_test']
self.assertTrue(erp5_test.hasObject('test_file')) self.assertTrue(erp5_test.hasObject('test_file'))
def test_ownerhsip(self): def test_ownership(self):
self.assertEqual( self.assertEqual(
self.portal.portal_skins.erp5_core.getOwnerTuple(), self.portal.portal_skins.erp5_core.getOwnerTuple(),
([self.portal.getId(), 'acl_users'], 'System Processes'), ([self.portal.getId(), 'acl_users'], 'System Processes'),
......
...@@ -1725,7 +1725,7 @@ return context.getPortalObject().foo_module.contentValues() ...@@ -1725,7 +1725,7 @@ return context.getPortalObject().foo_module.contentValues()
form_relative_url='portal_skins/erp5_ui_test/FooModule_viewFooList/listbox' form_relative_url='portal_skins/erp5_ui_test/FooModule_viewFooList/listbox'
) )
result_dict = json.loads(result) result_dict = json.loads(result)
#editalble creation date is defined at proxy form # editable creation date is defined at proxy form
# Test the listbox_uid parameter # Test the listbox_uid parameter
self.assertEqual(result_dict['_embedded']['contents'][0]['listbox_uid:list']['key'], 'listbox_uid:list') self.assertEqual(result_dict['_embedded']['contents'][0]['listbox_uid:list']['key'], 'listbox_uid:list')
self.assertEqual(result_dict['_embedded']['contents'][0]['id']['field_gadget_param']['type'], 'StringField') self.assertEqual(result_dict['_embedded']['contents'][0]['id']['field_gadget_param']['type'], 'StringField')
......
...@@ -28,7 +28,6 @@ try: ...@@ -28,7 +28,6 @@ try:
except ImportError: # BBB Zope2 except ImportError: # BBB Zope2
from Globals import package_home from Globals import package_home
import PIL.Image as PIL_Image import PIL.Image as PIL_Image
import thread
import random import random
import base64 import base64
from OFS.Folder import Folder from OFS.Folder import Folder
......
#from Products.ERP5.Document.TileImageTransformed import TileImageTransformed
#from cStringIO import StringIO
portal = context.getPortalObject() portal = context.getPortalObject()
data = portal.restrictedTraverse("portal_skins/erp5_safeimage/img/image_test.jpg") data = portal.restrictedTraverse("portal_skins/erp5_safeimage/img/image_test.jpg")
print(data.data) print(data.data)
return printed return printed
...@@ -70,7 +70,6 @@ with ImmediateReindexContextManager() as immediate_reindex_context_manager: ...@@ -70,7 +70,6 @@ with ImmediateReindexContextManager() as immediate_reindex_context_manager:
line_variation_base_category_list = line_variation_base_category_dict.keys() line_variation_base_category_list = line_variation_base_category_dict.keys()
# construct new content (container_line) # construct new content (container_line)
resource_url = resource_url
new_container_line_id = str(container.generateNewId()) new_container_line_id = str(container.generateNewId())
container_line = container.newContent( container_line = container.newContent(
immediate_reindex=immediate_reindex_context_manager, immediate_reindex=immediate_reindex_context_manager,
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from six import StringIO
class TestFormPrintoutMixin(ERP5TypeTestCase): class TestFormPrintoutMixin(ERP5TypeTestCase):
run_all_test = 1 run_all_test = 1
......
...@@ -130,7 +130,7 @@ def patch_linecache(): ...@@ -130,7 +130,7 @@ def patch_linecache():
properly without requiring to create a temporary file on the filesystem properly without requiring to create a temporary file on the filesystem
The filename is is always '<portal_components/*>' for ZODB Components, The filename is is always '<portal_components/*>' for ZODB Components,
'(FILENAME)?Script \(Python\)' for Zope Python Scripts and 'Python '(FILENAME)?Script \\(Python\\)' for Zope Python Scripts and 'Python
Expression "CODE"' for TALES expressions. Expression "CODE"' for TALES expressions.
linecache.cache filled by linecache.updatecache() called by the original linecache.cache filled by linecache.updatecache() called by the original
......
...@@ -9,7 +9,6 @@ __version__ = '0.3.0' ...@@ -9,7 +9,6 @@ __version__ = '0.3.0'
import base64 import base64
import errno import errno
import httplib
import os import os
import random import random
import re import re
...@@ -18,7 +17,6 @@ import string ...@@ -18,7 +17,6 @@ import string
import sys import sys
import time import time
import traceback import traceback
import urllib
from six.moves import configparser from six.moves import configparser
from contextlib import contextmanager from contextlib import contextmanager
from io import BytesIO from io import BytesIO
...@@ -32,7 +30,6 @@ from DateTime import DateTime ...@@ -32,7 +30,6 @@ from DateTime import DateTime
import mock import mock
import Products.ZMySQLDA.DA import Products.ZMySQLDA.DA
from Products.ZMySQLDA.DA import Connection as ZMySQLDA_Connection from Products.ZMySQLDA.DA import Connection as ZMySQLDA_Connection
from zope.globalrequest import clearRequest
from zope.globalrequest import getRequest from zope.globalrequest import getRequest
from zope.globalrequest import setRequest from zope.globalrequest import setRequest
import six import six
......
...@@ -21,7 +21,6 @@ from __future__ import print_function ...@@ -21,7 +21,6 @@ from __future__ import print_function
import six.moves.BaseHTTPServer import six.moves.BaseHTTPServer
import six.moves.CGIHTTPServer import six.moves.CGIHTTPServer
import time import time
import httplib
import sys import sys
PORT = 8000 PORT = 8000
......
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