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 unicode error in sort method #16

Merged
merged 2 commits into from
Aug 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/Changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
1.0.3 (unreleased)
------------------

- #16: Fix unicode error in sort method
- #15: Handle commas in recipient email name better
- #13: Fix bootstrap columns CSS for WeasyPrint
- #12: Added upgrade-step machinery
Expand Down
3 changes: 2 additions & 1 deletion src/senaite/impress/analysisrequest/reportview.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import DateTime
from bika.lims import POINTS_OF_CAPTURE
from Products.CMFPlone.i18nl10n import ulocalized_time
from Products.CMFPlone.utils import safe_unicode
from senaite import api
from senaite.core.supermodel.interfaces import ISuperModel
from senaite.impress import logger
Expand Down Expand Up @@ -183,7 +184,7 @@ def sort_items(self, items, reverse=False):
def sortable_title(obj):
sort_key = obj.get("SortKey") or 0.0
title = obj.title.lower()
return u"{:010.3f}{}".format(sort_key, title)
return u"{:010.3f}{}".format(sort_key, safe_unicode(title))

def _cmp(obj1, obj2):
st1 = sortable_title(obj1)
Expand Down