Skip to content

beaker session encrypt_key and validate_key features break under python 3.3.3, pyramid 1.5.2 #27

Description

@ashayshub

Platform I am using:

Mac Air, Yosemite 10.10.1
Python 3.3.3
Babel 1.3
Beaker 1.6.4
beautifulsoup4 4.3.2
Chameleon 2.19
Cython 0.21.2
lingua 3.7
Mako 1.0.0
MarkupSafe 0.23
oursql 0.9.4
passlib 1.6.2
PasteDeploy 1.5.2
pip 1.5.2
polib 1.0.6
pycrypto 2.6.1
Pygments 2.0.1
pymongo 2.7.2
pyramid 1.5.2
pyramid-beaker 0.8
pyramid-chameleon 0.3
pyramid-debugtoolbar 2.3
pyramid-mako 1.0.2
pyramid-tm 0.10
pytz 2014.10
repoze.lru 0.6
requests 2.5.1
setuptools 2.1
six 1.9.0
SQLAlchemy 0.9.8
SQLAlchemy-Utils 0.29.1
teacup 0.0
transaction 1.4.3
translationstring 1.3
venusian 1.0
waitress 0.8.9
WebOb 1.4
WebTest 2.0.17
zope.deprecation 4.1.1
zope.interface 4.1.2
zope.sqlalchemy 0.7.5

What is the issue?

Whenever I try to encrypt the session using the option encrypt_key and validate_key in beaker session, I get internal server error suggesting that there is an issue in byte-string conversion.


development.ini

#pyramid_beaker settings
session.type = file
session.data_dir = %(here)s/data/sessions/data
session.lock_dir = %(here)s/data/sessions/lock
session.key = SomeKey
session.secret = SomeSecret
session.domain = localhost
session.path = /

session.encrypt_key = Test123
session.validate_key = 124Tester

Error python traceback:

pydev debugger: process 73158 is connecting

Starting server in PID 73158.
serving on http://0.0.0.0:6543
2015-01-20 12:45:31,403 ERROR [waitress][Dummy-5] Exception when serving /
Traceback (most recent call last):
  File "/Users/Home/Programming/Python/3.x/pyramid_projs/env2/lib/python3.3/site-packages/waitress-0.8.9-py3.3.egg/waitress/channel.py", line 337, in service
    task.service()
  File "/Users/Home/Programming/Python/3.x/pyramid_projs/env2/lib/python3.3/site-packages/waitress-0.8.9-py3.3.egg/waitress/task.py", line 173, in service
    self.execute()
  File "/Users/Home/Programming/Python/3.x/pyramid_projs/env2/lib/python3.3/site-packages/waitress-0.8.9-py3.3.egg/waitress/task.py", line 392, in execute
    app_iter = self.channel.server.application(env, start_response)
  File "/Users/Home/Programming/Python/3.x/pyramid_projs/env2/lib/python3.3/site-packages/pyramid/router.py", line 242, in __call__
    response = self.invoke_subrequest(request, use_tweens=True)
  File "/Users/Home/Programming/Python/3.x/pyramid_projs/env2/lib/python3.3/site-packages/pyramid/router.py", line 220, in invoke_subrequest
    request._process_response_callbacks(response)
  File "/Users/Home/Programming/Python/3.x/pyramid_projs/env2/lib/python3.3/site-packages/pyramid/request.py", line 84, in _process_response_callbacks
    callback(self, response)
  File "/Users/Home/Programming/Python/3.x/pyramid_projs/env2/lib/python3.3/site-packages/pyramid_beaker/__init__.py", line 30, in session_callback
    self.persist()
  File "/Users/Home/Programming/Python/3.x/pyramid_projs/env2/lib/python3.3/site-packages/beaker/session.py", line 717, in persist
    self._session().save()
  File "/Users/Home/Programming/Python/3.x/pyramid_projs/env2/lib/python3.3/site-packages/beaker/session.py", line 415, in save
    data = self._encrypt_data(data)
  File "/Users/Home/Programming/Python/3.x/pyramid_projs/env2/lib/python3.3/site-packages/beaker/session.py", line 262, in _encrypt_data
    self.validate_key + nonce, 1)
TypeError: Can't convert 'bytes' object to str implicitly

Error I receive on Front end:

Internal Server Error

The server encountered an unexpected internal server error

(generated by waitress)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions