Skip to content

Commit

Permalink
Add Python 3.7 and fix deprecations.
Browse files Browse the repository at this point in the history
Fixes #10 and fixes #11.
  • Loading branch information
jamadden committed Oct 19, 2018
1 parent 37a8f1a commit c31c252
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Expand Up @@ -7,6 +7,12 @@ python:
- 3.6
- pypy
- pypy3
matrix:
include:
- python: "3.7"
dist: xenial
sudo: true

install:
- pip install -U pip setuptools
- pip install -U coverage coveralls
Expand Down
4 changes: 3 additions & 1 deletion CHANGES.rst
Expand Up @@ -2,9 +2,11 @@
CHANGES
=========

4.2.1 (unreleased)
4.3.0 (unreleased)
==================

- Add support for Python 3.7.

- Host documentation at https://zopesession.readthedocs.io


Expand Down
1 change: 1 addition & 0 deletions setup.py
Expand Up @@ -56,6 +56,7 @@ def read(*rnames):
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Natural Language :: English',
Expand Down
10 changes: 9 additions & 1 deletion src/zope/session/http.py
Expand Up @@ -21,6 +21,14 @@
from hashlib import sha1
from email.utils import formatdate

try:
# Python 3.3+: OS-independent CPU counter
from time import process_time
except ImportError: # pragma: no cover
# Python 2.7
from time import clock as process_time


from persistent import Persistent
import zope.location
from zope import schema
Expand Down Expand Up @@ -297,7 +305,7 @@ def generateUniqueId(self):
True
"""
data = "%.20f%.20f%.20f" % (random.random(), time.time(), time.clock())
data = "%.20f%.20f%.20f" % (random.random(), time.time(), process_time())
digest = sha1(data.encode()).digest()
s = digestEncode(digest)
# we store a HMAC of the random value together with it, which makes
Expand Down
2 changes: 1 addition & 1 deletion src/zope/session/session.py
Expand Up @@ -28,7 +28,7 @@

import zope.component
import zope.interface
from zope.component.interfaces import ComponentLookupError
from zope.interface.interfaces import ComponentLookupError
from zope.publisher.interfaces import IRequest

from zope.session.interfaces import \
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
@@ -1,6 +1,6 @@
[tox]
envlist =
py27,py34,py35,py36,pypy,pypy3,coverage,docs
py27,py34,py35,py36,py37,pypy,pypy3,coverage,docs

[testenv]
commands =
Expand Down

0 comments on commit c31c252

Please sign in to comment.