Skip to content

Commit

Permalink
Avoid comparison between different types
Browse files Browse the repository at this point in the history
  • Loading branch information
davisagli committed Jun 26, 2018
1 parent 854d105 commit 35552e3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Products/ZopeVersionControl/Repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,23 +325,24 @@ def updateResource(self, object, selector=None):
# If the selector is non-null, we find the version specified
# and update the sticky tag. Later we'll check the version we
# found and decide whether we really need to update the object.
if history.hasVersionId(selector):
if type(selector) is str and history.hasVersionId(selector):
version = history.getVersionById(selector)
sticky = ('V', selector)

elif selector in self._labels:
elif type(selector) is str and selector in self._labels:
version = history.getVersionByLabel(selector)
sticky = ('L', selector)

elif selector in self._branches:
elif type(selector) is str and selector in self._branches:
version = history.getLatestVersion(selector)
if selector == 'mainline':
sticky = None
else:
sticky = ('B', selector)
else:
try: date = DateTime(selector)
except:
try:
date = DateTime(selector)
except Exception:
raise VersionControlError(
'Invalid version selector: %s' % selector
)
Expand Down

0 comments on commit 35552e3

Please sign in to comment.