-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix deprecation warnings #38
Changes from all commits
1f2f105
4d3d01d
0ad2949
e0984b1
b7a39e7
255fe5f
530180d
0eb7c21
f40323a
5b3d77b
7a2e3d4
bad4ff4
3b2504d
1b71cc3
dcbf330
356426c
f9543d5
14a77fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,7 +61,7 @@ class DateRangeIndex(UnIndex): | |
|
||
security = ClassSecurityInfo() | ||
|
||
meta_type = "DateRangeIndex" | ||
meta_type = 'DateRangeIndex' | ||
query_options = ('query', ) | ||
|
||
manage_options = ({'label': 'Properties', | ||
|
@@ -93,46 +93,46 @@ def __init__(self, id, since_field=None, until_field=None, | |
ceiling_value, precision_value) | ||
self.clear() | ||
|
||
security.declareProtected(view, 'getSinceField') | ||
@security.protected(view) | ||
def getSinceField(self): | ||
"""Get the name of the attribute indexed as start date. | ||
""" | ||
return self._since_field | ||
|
||
security.declareProtected(view, 'getUntilField') | ||
@security.protected(view) | ||
def getUntilField(self): | ||
"""Get the name of the attribute indexed as end date. | ||
""" | ||
return self._until_field | ||
|
||
security.declareProtected(view, 'getFloorValue') | ||
@security.protected(view) | ||
def getFloorValue(self): | ||
""" """ | ||
return self.floor_value | ||
|
||
security.declareProtected(view, 'getCeilingValue') | ||
@security.protected(view) | ||
def getCeilingValue(self): | ||
""" """ | ||
return self.ceiling_value | ||
|
||
security.declareProtected(view, 'getPrecisionValue') | ||
@security.protected(view) | ||
def getPrecisionValue(self): | ||
""" """ | ||
return self.precision_value | ||
|
||
manage_indexProperties = DTMLFile('manageDateRangeIndex', _dtmldir) | ||
|
||
security.declareProtected(manage_zcatalog_indexes, 'manage_edit') | ||
@security.protected(manage_zcatalog_indexes) | ||
def manage_edit(self, since_field, until_field, floor_value, | ||
ceiling_value, precision_value, REQUEST): | ||
""" """ | ||
self._edit(since_field, until_field, floor_value, ceiling_value, | ||
precision_value) | ||
REQUEST['RESPONSE'].redirect('%s/manage_main' | ||
'?manage_tabs_message=Updated' | ||
% REQUEST.get('URL2')) | ||
REQUEST['RESPONSE'].redirect('{0}/manage_main' | ||
'?manage_tabs_message=Updated'.format( | ||
REQUEST.get('URL2'))) | ||
|
||
security.declarePrivate('_edit') | ||
@security.private | ||
def _edit(self, since_field, until_field, floor_value=None, | ||
ceiling_value=None, precision_value=None): | ||
"""Update the fields used to compute the range. | ||
|
@@ -146,7 +146,7 @@ def _edit(self, since_field, until_field, floor_value=None, | |
if precision_value not in (None, ''): | ||
self.precision_value = int(precision_value) | ||
|
||
security.declareProtected(manage_zcatalog_indexes, 'clear') | ||
@security.protected(manage_zcatalog_indexes) | ||
def clear(self): | ||
"""Start over fresh.""" | ||
self._always = IITreeSet() | ||
|
@@ -224,7 +224,7 @@ def uniqueValues(self, name=None, withLengths=0): | |
the form '(value, length)'. | ||
""" | ||
if name not in (self._since_field, self._until_field): | ||
raise StopIteration | ||
return | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this change needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I may have ignored backward compatibility, but see https://docs.python.org/3.3/reference/simple_stmts.html#the-return-statement There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TIL |
||
|
||
if name == self._since_field: | ||
sets = (self._since, self._since_only) | ||
|
@@ -248,13 +248,13 @@ def getRequestCacheKey(self, record, resultset=None): | |
tid = str(term) | ||
|
||
# unique index identifier | ||
iid = '_%s_%s_%s' % (self.__class__.__name__, | ||
self.id, self.getCounter()) | ||
iid = '_{0}_{1}_{2}'.format(self.__class__.__name__, | ||
self.id, self.getCounter()) | ||
# record identifier | ||
if resultset is None: | ||
rid = '_%s' % (tid, ) | ||
rid = '_{0}'.format(tid) | ||
else: | ||
rid = '_inverse_%s' % (tid, ) | ||
rid = '_inverse_{0}'.format(tid) | ||
|
||
return (iid, rid) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this change!