Skip to content

Commit

Permalink
- don't use obsolete string module functions
Browse files Browse the repository at this point in the history
  • Loading branch information
dataflake committed Oct 25, 2017
1 parent 851c04c commit a5f632a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 21 deletions.
24 changes: 10 additions & 14 deletions src/Shared/DC/ZRDB/Aqueduct.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import os
import re
from six import StringIO
import string

from Acquisition import Implicit
from App.Common import package_home
Expand Down Expand Up @@ -188,7 +187,7 @@ def default_input_form(id, arguments, action='query', tabs=''):
'Enter query parameters:<br>'
'<table>\n'
% (id, tabs, action, id),
string.joinfields(
'/n'.join(
map(
lambda a:
('<tr> <th>%s</th>\n'
Expand All @@ -204,8 +203,7 @@ def default_input_form(id, arguments, action='query', tabs=''):
'default' in a[1] and a[1]['default'] or ''
))
, items
),
'\n'),
)),
'\n<tr><td colspan=2 align=center>\n'
'<input type="SUBMIT" name="SUBMIT" value="Submit Query">\n'
'<dtml-if HTTP_REFERER>\n'
Expand Down Expand Up @@ -248,11 +246,10 @@ def custom_default_report(id, result, action='', no_table=0,
columns = result._searchable_result_columns()
__traceback_info__ = columns
heading = ('<tr>\n%s </tr>' %
string.joinfields(
''.join(
map(lambda c:
' <th>%s</th>\n' % nicify(c['name']),
columns),
''
columns)
))

if no_table:
Expand All @@ -269,7 +266,7 @@ def custom_default_report(id, result, action='', no_table=0,
% (td, n, c['type'] != 's' and ' null=""' or '', _td))

row = (' %s\n%s\n %s' % (
tr, string.joinfields(row, delim), _tr))
tr, delim.join(row), _tr))

return custom_default_report_src(
id=id, heading=heading, row=row, action=action, no_table=no_table)
Expand All @@ -281,11 +278,10 @@ def custom_default_zpt_report(id, result, action='', no_table=0,
columns = result._searchable_result_columns()
__traceback_info__ = columns
heading = ('<tr>\n%s </tr>' %
string.joinfields(
''.join(
map(lambda c:
' <th>%s</th>\n' % nicify(c['name']),
columns),
''
columns)
))

if no_table:
Expand All @@ -300,7 +296,7 @@ def custom_default_zpt_report(id, result, action='', no_table=0,
% (td, n, n, _td))

row = (' %s\n%s\n %s' % (
tr, string.joinfields(row, delim), _tr))
tr, delim.join(row), _tr))

return custom_default_zpt_report_src(
id=id, heading=heading, row=row, action=action, no_table=no_table)
Expand Down Expand Up @@ -425,13 +421,13 @@ def quotedHTML(text,
('"', '&quot;'))):

for char, name in character_entities:
text = string.replace(text, char, name)
text = text.replace(char, name)

return text


def nicify(name):
name = string.replace(name.strip(), '_', ' ')
name = name.strip().replace('_', ' ')
return name[:1].upper() + name[1:]


Expand Down
1 change: 0 additions & 1 deletion src/Shared/DC/ZRDB/Connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from cgi import escape
from logging import getLogger
from six import StringIO
import string
import sys

from AccessControl.Permissions import view_management_screens
Expand Down
9 changes: 4 additions & 5 deletions src/Shared/DC/ZRDB/DA.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import os
import re
from six import StringIO
import string
import sys
from time import time

Expand Down Expand Up @@ -430,11 +429,11 @@ def manage_advanced(self, max_rows, max_cache, cache_time,
"""
# paranoid type checking
if not isinstance(max_rows, int):
max_rows = string.atoi(max_rows)
max_rows = int(max_rows)
if not isinstance(max_cache, int):
max_cache = string.atoi(max_cache)
max_cache = int(max_cache)
if not isinstance(cache_time, int):
cache_time = string.atoi(cache_time)
cache_time = int(cache_time)
class_name = str(class_name)
class_file = str(class_file)

Expand Down Expand Up @@ -809,7 +808,7 @@ def __bobo_traverse__(self, REQUEST, key):
if results:
if len(results) > 1:
try:
return results[string.atoi(key)].__of__(da)
return results[int(key)].__of__(da)
except Exception:
raise KeyError(key)
else:
Expand Down
1 change: 0 additions & 1 deletion src/Shared/DC/ZRDB/RDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import array
import re
import string

from Acquisition import Implicit
from DateTime import DateTime
Expand Down

0 comments on commit a5f632a

Please sign in to comment.