Skip to content

Commit

Permalink
- prevent more warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dataflake committed May 16, 2018
1 parent 1a55abd commit 6ce7641
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
5 changes: 4 additions & 1 deletion Products/GenericSetup/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,10 @@ def put_ini(self, text):
"""
context = self.context
parser = ConfigParser()
parser.readfp(cStringIO(text))
try:
parser.read_file(cStringIO(text))
except AttributeError: # Python 2
parser.readfp(cStringIO(text))
for option, value in parser.defaults().items():
prop_type = context.getPropertyType(option)
if prop_type is None:
Expand Down
5 changes: 4 additions & 1 deletion Products/GenericSetup/tests/test_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,10 @@ def _parseINI(text):
from six.moves.configparser import ConfigParser
from six.moves import cStringIO
parser = ConfigParser()
parser.readfp(cStringIO(text))
try:
parser.read_file(cStringIO(text))
except AttributeError: # Python 2
parser.readfp(cStringIO(text))
return parser


Expand Down
2 changes: 2 additions & 0 deletions Products/GenericSetup/tests/test_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,8 @@ def test_writeDataFile_PdataStreamIterator(self):
self._verifyTarballContents(fileish, ['foo.txt'])
self._verifyTarballEntry(fileish, 'foo.txt', printable_bytes)

fp.close() # Prevent unclosed file warning

def test_writeDataFile_subdir(self):

site = DummySite('site').__of__(self.app)
Expand Down
5 changes: 4 additions & 1 deletion Products/GenericSetup/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@
""" Classes: SetupTool
"""

try:
from html import escape
except ImportError:
from cgi import escape
import logging
import os
import six
import time
import types
from cgi import escape
from operator import itemgetter

from AccessControl.class_init import InitializeClass
Expand Down

0 comments on commit 6ce7641

Please sign in to comment.