[hotfix] fixes for UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 17: ordinal not in range(128) (#4082)

* [hotfix] fixes for UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 17: ordinal not in range(128)

* [hotfix] datetime field filters issue
This commit is contained in:
Makarand Bauskar 2017-09-07 20:00:00 +05:30 committed by GitHub
parent 2ea4b9479b
commit 2495f06aba
3 changed files with 4 additions and 2 deletions

View file

@ -153,7 +153,7 @@ def export_query():
for r in data:
# encode only unicode type strings and not int, floats etc.
writer.writerow(map(lambda v: isinstance(v, string_types) and
handle_html(v.encode('utf-8')) or v, r))
handle_html(frappe.as_unicode(v)) or v, r))
f.seek(0)
frappe.response['result'] = text_type(f.read(), 'utf-8')

View file

@ -16,7 +16,7 @@ frappe.ui.form.ControlDate = frappe.ui.form.ControlData.extend({
// if date is selected but different from value, refresh
const selected_date =
moment(this.datepicker.selectedDates[0])
.format(moment.defaultDateFormat);
.format(this.date_format);
should_refresh = selected_date !== value;
} else {
// if datepicker has no selected date, refresh
@ -35,6 +35,7 @@ frappe.ui.form.ControlDate = frappe.ui.form.ControlData.extend({
lang = 'en';
}
this.today_text = __("Today");
this.date_format = moment.defaultDateFormat;
this.datepicker_options = {
language: lang,
autoClose: true,

View file

@ -2,6 +2,7 @@ frappe.ui.form.ControlDatetime = frappe.ui.form.ControlDate.extend({
set_date_options: function() {
this._super();
this.today_text = __("Now");
this.date_format = moment.defaultDatetimeFormat;
$.extend(this.datepicker_options, {
timepicker: true,
timeFormat: "hh:ii:ss",