Skip to content

Commit

Permalink
Use base64 module instead of codecs, which doesn't know 'base64' in P…
Browse files Browse the repository at this point in the history
…ython 3.3.
  • Loading branch information
dnouri committed Jun 24, 2015
1 parent 73ed6e7 commit 1f177cf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions palladium/persistence.py
@@ -1,7 +1,7 @@
""":class:`~palladium.interfaces.ModelPersister` implementations.
"""

import codecs
import base64
import gzip
import io
import json
Expand All @@ -22,7 +22,6 @@
from sqlalchemy.orm import scoped_session
from sqlalchemy.orm import sessionmaker
from sqlalchemy.types import TypeDecorator
from sqlalchemy.types import STRINGTYPE

from . import __version__
from .interfaces import annotate
Expand Down Expand Up @@ -369,12 +368,12 @@ class BytesToBase64Type(TypeDecorator):

def process_bind_param(self, value, dialect):
if value is not None:
value = codecs.encode(bytes(value), 'base64').decode('utf-8')
value = base64.b64encode(bytes(value)).decode('ascii')
return value

def process_result_value(self, value, dialect):
if value is not None:
value = codecs.decode(value.encode('utf-8'), 'base64')
value = base64.b64decode(value.encode('ascii'))
return value

def DBModelChunkClass(self, Base):
Expand Down

0 comments on commit 1f177cf

Please sign in to comment.