Skip to content
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 UnicodeEncodeError #7

Merged
merged 1 commit into from
May 4, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions ps_alchemy/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import transaction
from pyramid.view import view_config, view_defaults
from sacrud.common import pk_list_to_dict
from pyramid.compat import escape
from pyramid.compat import escape, text_type
from pyramid_sacrud import PYRAMID_SACRUD_VIEW
from pyramid.renderers import render_to_response
from sqlalchemy.orm.exc import NoResultFound
Expand All @@ -30,7 +30,7 @@ def preprocessing_value(key, value, form):
for groups in form.children:
for column in groups:
if column.name == key:
if not str(value).isdigit() and isinstance(
if not text_type(value).isdigit() and isinstance(
column.typ,
(colander.Int, colander.Integer,
colander.Float, colander.Decimal)):
Expand Down Expand Up @@ -180,7 +180,7 @@ def delete_view(self):
self.commit()
self.flash_message(
_ps("You have removed object of ${name}",
mapping={'name': escape(str(self.context.obj) or '')}))
mapping={'name': escape(text_type(self.context.obj) or '')}))
return self.list_view_response()

@view_config(
Expand Down